2017-07-15 18:42:33 +02:00
/*
* Copyright ( c ) 2017 Ronald S . Bultje < rsbultje @ gmail . com >
* Copyright ( c ) 2017 Ashish Pratap Singh < ashk43712 @ gmail . com >
*
* This file is part of FFmpeg .
*
* FFmpeg is free software ; you can redistribute it and / or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation ; either
* version 2.1 of the License , or ( at your option ) any later version .
*
* FFmpeg is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
* Lesser General Public License for more details .
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg ; if not , write to the Free Software
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA
*/
/**
* @ file
* Calculate the VMAF between two input videos .
*/
# include <pthread.h>
# include <libvmaf.h>
# include "libavutil/avstring.h"
# include "libavutil/opt.h"
# include "libavutil/pixdesc.h"
# include "avfilter.h"
# include "drawutils.h"
# include "formats.h"
2017-08-31 19:47:37 +02:00
# include "framesync.h"
2017-07-15 18:42:33 +02:00
# include "internal.h"
# include "video.h"
typedef struct LIBVMAFContext {
const AVClass * class ;
lavfi/vf_libvmaf: convert to framesync2.
After this commit, the code compiles, but on my setup it
segfaults before and after. It also prints the very worrying
warning:
src/libavfilter/vf_libvmaf.c:161:66: warning: passing argument 4 of ‘compute_vmaf’ from incompatible pointer type [-Wincompatible-pointer-types]
/tmp/i/include/libvmaf.h:26:8: note: expected ‘int (*)(float *, float *, float *, int, void *)’ but argument is of type ‘int (*)(float *, float *, float *, int, double *, void *)’
==12116== Thread 6:
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Use of uninitialised value of size 8
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Invalid read of size 4
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116== Address 0x40 is not stack'd, malloc'd or (recently) free'd
==12116==
==12116==
==12116== Process terminating with default action of signal 11 (SIGSEGV)
==12116== Access not within mapped region at address 0x40
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
2017-07-31 11:40:25 +02:00
FFFrameSync fs ;
2017-07-15 18:42:33 +02:00
const AVPixFmtDescriptor * desc ;
int width ;
int height ;
double vmaf_score ;
2018-04-30 17:33:51 +02:00
int vmaf_thread_created ;
2017-07-15 18:42:33 +02:00
pthread_t vmaf_thread ;
pthread_mutex_t lock ;
pthread_cond_t cond ;
int eof ;
AVFrame * gmain ;
AVFrame * gref ;
int frame_set ;
char * model_path ;
char * log_path ;
char * log_fmt ;
int disable_clip ;
int disable_avx ;
int enable_transform ;
int phone_model ;
int psnr ;
int ssim ;
int ms_ssim ;
char * pool ;
2018-08-08 00:05:16 +02:00
int n_threads ;
int n_subsample ;
int enable_conf_interval ;
2017-12-18 14:59:39 +02:00
int error ;
2017-07-15 18:42:33 +02:00
} LIBVMAFContext ;
# define OFFSET(x) offsetof(LIBVMAFContext, x)
# define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static const AVOption libvmaf_options [ ] = {
{ " model_path " , " Set the model to be used for computing vmaf. " , OFFSET ( model_path ) , AV_OPT_TYPE_STRING , { . str = " /usr/local/share/model/vmaf_v0.6.1.pkl " } , 0 , 1 , FLAGS } ,
{ " log_path " , " Set the file path to be used to store logs. " , OFFSET ( log_path ) , AV_OPT_TYPE_STRING , { . str = NULL } , 0 , 1 , FLAGS } ,
2020-08-20 18:39:27 +02:00
{ " log_fmt " , " Set the format of the log (csv, json or xml). " , OFFSET ( log_fmt ) , AV_OPT_TYPE_STRING , { . str = NULL } , 0 , 1 , FLAGS } ,
2017-07-15 18:42:33 +02:00
{ " enable_transform " , " Enables transform for computing vmaf. " , OFFSET ( enable_transform ) , AV_OPT_TYPE_BOOL , { . i64 = 0 } , 0 , 1 , FLAGS } ,
{ " phone_model " , " Invokes the phone model that will generate higher VMAF scores. " , OFFSET ( phone_model ) , AV_OPT_TYPE_BOOL , { . i64 = 0 } , 0 , 1 , FLAGS } ,
{ " psnr " , " Enables computing psnr along with vmaf. " , OFFSET ( psnr ) , AV_OPT_TYPE_BOOL , { . i64 = 0 } , 0 , 1 , FLAGS } ,
{ " ssim " , " Enables computing ssim along with vmaf. " , OFFSET ( ssim ) , AV_OPT_TYPE_BOOL , { . i64 = 0 } , 0 , 1 , FLAGS } ,
{ " ms_ssim " , " Enables computing ms-ssim along with vmaf. " , OFFSET ( ms_ssim ) , AV_OPT_TYPE_BOOL , { . i64 = 0 } , 0 , 1 , FLAGS } ,
{ " pool " , " Set the pool method to be used for computing vmaf. " , OFFSET ( pool ) , AV_OPT_TYPE_STRING , { . str = NULL } , 0 , 1 , FLAGS } ,
2018-08-08 00:05:16 +02:00
{ " n_threads " , " Set number of threads to be used when computing vmaf. " , OFFSET ( n_threads ) , AV_OPT_TYPE_INT , { . i64 = 0 } , 0 , UINT_MAX , FLAGS } ,
{ " n_subsample " , " Set interval for frame subsampling used when computing vmaf. " , OFFSET ( n_subsample ) , AV_OPT_TYPE_INT , { . i64 = 1 } , 1 , UINT_MAX , FLAGS } ,
{ " enable_conf_interval " , " Enables confidence interval. " , OFFSET ( enable_conf_interval ) , AV_OPT_TYPE_BOOL , { . i64 = 0 } , 0 , 1 , FLAGS } ,
2017-07-15 18:42:33 +02:00
{ NULL }
} ;
lavfi/vf_libvmaf: convert to framesync2.
After this commit, the code compiles, but on my setup it
segfaults before and after. It also prints the very worrying
warning:
src/libavfilter/vf_libvmaf.c:161:66: warning: passing argument 4 of ‘compute_vmaf’ from incompatible pointer type [-Wincompatible-pointer-types]
/tmp/i/include/libvmaf.h:26:8: note: expected ‘int (*)(float *, float *, float *, int, void *)’ but argument is of type ‘int (*)(float *, float *, float *, int, double *, void *)’
==12116== Thread 6:
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Use of uninitialised value of size 8
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Invalid read of size 4
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116== Address 0x40 is not stack'd, malloc'd or (recently) free'd
==12116==
==12116==
==12116== Process terminating with default action of signal 11 (SIGSEGV)
==12116== Access not within mapped region at address 0x40
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
2017-07-31 11:40:25 +02:00
FRAMESYNC_DEFINE_CLASS ( libvmaf , LIBVMAFContext , fs ) ;
2017-07-15 18:42:33 +02:00
# define read_frame_fn(type, bits) \
2017-08-03 07:34:01 +02:00
static int read_frame_ # # bits # # bit ( float * ref_data , float * main_data , \
float * temp_data , int stride , void * ctx ) \
2017-07-15 18:42:33 +02:00
{ \
2017-08-03 07:34:01 +02:00
LIBVMAFContext * s = ( LIBVMAFContext * ) ctx ; \
2017-07-15 18:42:33 +02:00
int ret ; \
\
pthread_mutex_lock ( & s - > lock ) ; \
\
while ( ! s - > frame_set & & ! s - > eof ) { \
pthread_cond_wait ( & s - > cond , & s - > lock ) ; \
} \
\
if ( s - > frame_set ) { \
int ref_stride = s - > gref - > linesize [ 0 ] ; \
int main_stride = s - > gmain - > linesize [ 0 ] ; \
\
const type * ref_ptr = ( const type * ) s - > gref - > data [ 0 ] ; \
const type * main_ptr = ( const type * ) s - > gmain - > data [ 0 ] ; \
\
float * ptr = ref_data ; \
2019-10-12 21:41:50 +02:00
float factor = 1.f / ( 1 < < ( bits - 8 ) ) ; \
2017-07-15 18:42:33 +02:00
\
int h = s - > height ; \
int w = s - > width ; \
\
int i , j ; \
\
for ( i = 0 ; i < h ; i + + ) { \
for ( j = 0 ; j < w ; j + + ) { \
2019-10-12 21:41:50 +02:00
ptr [ j ] = ref_ptr [ j ] * factor ; \
2017-07-15 18:42:33 +02:00
} \
ref_ptr + = ref_stride / sizeof ( * ref_ptr ) ; \
ptr + = stride / sizeof ( * ptr ) ; \
} \
\
ptr = main_data ; \
\
for ( i = 0 ; i < h ; i + + ) { \
for ( j = 0 ; j < w ; j + + ) { \
2019-10-12 21:41:50 +02:00
ptr [ j ] = main_ptr [ j ] * factor ; \
2017-07-15 18:42:33 +02:00
} \
main_ptr + = main_stride / sizeof ( * main_ptr ) ; \
ptr + = stride / sizeof ( * ptr ) ; \
} \
} \
\
ret = ! s - > frame_set ; \
\
2018-03-25 18:44:49 +02:00
av_frame_unref ( s - > gref ) ; \
av_frame_unref ( s - > gmain ) ; \
2017-07-15 18:42:33 +02:00
s - > frame_set = 0 ; \
\
pthread_cond_signal ( & s - > cond ) ; \
pthread_mutex_unlock ( & s - > lock ) ; \
\
if ( ret ) { \
return 2 ; \
} \
\
return 0 ; \
}
read_frame_fn ( uint8_t , 8 ) ;
read_frame_fn ( uint16_t , 10 ) ;
static void compute_vmaf_score ( LIBVMAFContext * s )
{
int ( * read_frame ) ( float * ref_data , float * main_data , float * temp_data ,
2017-08-03 07:34:01 +02:00
int stride , void * ctx ) ;
2017-11-06 14:49:19 +02:00
char * format ;
2017-07-15 18:42:33 +02:00
if ( s - > desc - > comp [ 0 ] . depth < = 8 ) {
read_frame = read_frame_8bit ;
} else {
read_frame = read_frame_10bit ;
}
2017-11-06 14:49:19 +02:00
format = ( char * ) s - > desc - > name ;
2017-12-18 14:59:39 +02:00
s - > error = compute_vmaf ( & s - > vmaf_score , format , s - > width , s - > height ,
read_frame , s , s - > model_path , s - > log_path ,
s - > log_fmt , 0 , 0 , s - > enable_transform ,
s - > phone_model , s - > psnr , s - > ssim ,
2018-08-08 00:05:16 +02:00
s - > ms_ssim , s - > pool ,
s - > n_threads , s - > n_subsample , s - > enable_conf_interval ) ;
2017-07-15 18:42:33 +02:00
}
static void * call_vmaf ( void * ctx )
{
LIBVMAFContext * s = ( LIBVMAFContext * ) ctx ;
compute_vmaf_score ( s ) ;
2017-12-18 14:59:39 +02:00
if ( ! s - > error ) {
av_log ( ctx , AV_LOG_INFO , " VMAF score: %f \n " , s - > vmaf_score ) ;
} else {
pthread_mutex_lock ( & s - > lock ) ;
pthread_cond_signal ( & s - > cond ) ;
pthread_mutex_unlock ( & s - > lock ) ;
}
2017-07-15 18:42:33 +02:00
pthread_exit ( NULL ) ;
2017-12-18 14:59:39 +02:00
return NULL ;
2017-07-15 18:42:33 +02:00
}
lavfi/vf_libvmaf: convert to framesync2.
After this commit, the code compiles, but on my setup it
segfaults before and after. It also prints the very worrying
warning:
src/libavfilter/vf_libvmaf.c:161:66: warning: passing argument 4 of ‘compute_vmaf’ from incompatible pointer type [-Wincompatible-pointer-types]
/tmp/i/include/libvmaf.h:26:8: note: expected ‘int (*)(float *, float *, float *, int, void *)’ but argument is of type ‘int (*)(float *, float *, float *, int, double *, void *)’
==12116== Thread 6:
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Use of uninitialised value of size 8
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Invalid read of size 4
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116== Address 0x40 is not stack'd, malloc'd or (recently) free'd
==12116==
==12116==
==12116== Process terminating with default action of signal 11 (SIGSEGV)
==12116== Access not within mapped region at address 0x40
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
2017-07-31 11:40:25 +02:00
static int do_vmaf ( FFFrameSync * fs )
2017-07-15 18:42:33 +02:00
{
lavfi/vf_libvmaf: convert to framesync2.
After this commit, the code compiles, but on my setup it
segfaults before and after. It also prints the very worrying
warning:
src/libavfilter/vf_libvmaf.c:161:66: warning: passing argument 4 of ‘compute_vmaf’ from incompatible pointer type [-Wincompatible-pointer-types]
/tmp/i/include/libvmaf.h:26:8: note: expected ‘int (*)(float *, float *, float *, int, void *)’ but argument is of type ‘int (*)(float *, float *, float *, int, double *, void *)’
==12116== Thread 6:
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Use of uninitialised value of size 8
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Invalid read of size 4
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116== Address 0x40 is not stack'd, malloc'd or (recently) free'd
==12116==
==12116==
==12116== Process terminating with default action of signal 11 (SIGSEGV)
==12116== Access not within mapped region at address 0x40
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
2017-07-31 11:40:25 +02:00
AVFilterContext * ctx = fs - > parent ;
2017-07-15 18:42:33 +02:00
LIBVMAFContext * s = ctx - > priv ;
2017-11-30 15:13:15 +02:00
AVFrame * master , * ref ;
lavfi/vf_libvmaf: convert to framesync2.
After this commit, the code compiles, but on my setup it
segfaults before and after. It also prints the very worrying
warning:
src/libavfilter/vf_libvmaf.c:161:66: warning: passing argument 4 of ‘compute_vmaf’ from incompatible pointer type [-Wincompatible-pointer-types]
/tmp/i/include/libvmaf.h:26:8: note: expected ‘int (*)(float *, float *, float *, int, void *)’ but argument is of type ‘int (*)(float *, float *, float *, int, double *, void *)’
==12116== Thread 6:
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Use of uninitialised value of size 8
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Invalid read of size 4
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116== Address 0x40 is not stack'd, malloc'd or (recently) free'd
==12116==
==12116==
==12116== Process terminating with default action of signal 11 (SIGSEGV)
==12116== Access not within mapped region at address 0x40
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
2017-07-31 11:40:25 +02:00
int ret ;
2017-11-30 15:13:15 +02:00
ret = ff_framesync_dualinput_get ( fs , & master , & ref ) ;
lavfi/vf_libvmaf: convert to framesync2.
After this commit, the code compiles, but on my setup it
segfaults before and after. It also prints the very worrying
warning:
src/libavfilter/vf_libvmaf.c:161:66: warning: passing argument 4 of ‘compute_vmaf’ from incompatible pointer type [-Wincompatible-pointer-types]
/tmp/i/include/libvmaf.h:26:8: note: expected ‘int (*)(float *, float *, float *, int, void *)’ but argument is of type ‘int (*)(float *, float *, float *, int, double *, void *)’
==12116== Thread 6:
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Use of uninitialised value of size 8
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Invalid read of size 4
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116== Address 0x40 is not stack'd, malloc'd or (recently) free'd
==12116==
==12116==
==12116== Process terminating with default action of signal 11 (SIGSEGV)
==12116== Access not within mapped region at address 0x40
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
2017-07-31 11:40:25 +02:00
if ( ret < 0 )
return ret ;
if ( ! ref )
2017-11-30 15:13:15 +02:00
return ff_filter_frame ( ctx - > outputs [ 0 ] , master ) ;
2017-07-15 18:42:33 +02:00
pthread_mutex_lock ( & s - > lock ) ;
2017-12-18 14:59:39 +02:00
while ( s - > frame_set & & ! s - > error ) {
2017-07-15 18:42:33 +02:00
pthread_cond_wait ( & s - > cond , & s - > lock ) ;
}
2017-12-18 14:59:39 +02:00
if ( s - > error ) {
av_log ( ctx , AV_LOG_ERROR ,
" libvmaf encountered an error, check log for details \n " ) ;
pthread_mutex_unlock ( & s - > lock ) ;
return AVERROR ( EINVAL ) ;
}
2017-07-15 18:42:33 +02:00
av_frame_ref ( s - > gref , ref ) ;
2017-11-30 15:13:15 +02:00
av_frame_ref ( s - > gmain , master ) ;
2017-07-15 18:42:33 +02:00
s - > frame_set = 1 ;
pthread_cond_signal ( & s - > cond ) ;
pthread_mutex_unlock ( & s - > lock ) ;
2017-11-30 15:13:15 +02:00
return ff_filter_frame ( ctx - > outputs [ 0 ] , master ) ;
2017-07-15 18:42:33 +02:00
}
static av_cold int init ( AVFilterContext * ctx )
{
LIBVMAFContext * s = ctx - > priv ;
s - > gref = av_frame_alloc ( ) ;
s - > gmain = av_frame_alloc ( ) ;
2019-11-20 17:24:22 +02:00
if ( ! s - > gref | | ! s - > gmain )
return AVERROR ( ENOMEM ) ;
2017-12-18 14:59:39 +02:00
s - > error = 0 ;
2017-07-15 18:42:33 +02:00
2018-04-30 17:33:51 +02:00
s - > vmaf_thread_created = 0 ;
2017-07-15 18:42:33 +02:00
pthread_mutex_init ( & s - > lock , NULL ) ;
pthread_cond_init ( & s - > cond , NULL ) ;
lavfi/vf_libvmaf: convert to framesync2.
After this commit, the code compiles, but on my setup it
segfaults before and after. It also prints the very worrying
warning:
src/libavfilter/vf_libvmaf.c:161:66: warning: passing argument 4 of ‘compute_vmaf’ from incompatible pointer type [-Wincompatible-pointer-types]
/tmp/i/include/libvmaf.h:26:8: note: expected ‘int (*)(float *, float *, float *, int, void *)’ but argument is of type ‘int (*)(float *, float *, float *, int, double *, void *)’
==12116== Thread 6:
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Use of uninitialised value of size 8
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Invalid read of size 4
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116== Address 0x40 is not stack'd, malloc'd or (recently) free'd
==12116==
==12116==
==12116== Process terminating with default action of signal 11 (SIGSEGV)
==12116== Access not within mapped region at address 0x40
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
2017-07-31 11:40:25 +02:00
s - > fs . on_event = do_vmaf ;
2017-07-15 18:42:33 +02:00
return 0 ;
}
static int query_formats ( AVFilterContext * ctx )
{
static const enum AVPixelFormat pix_fmts [ ] = {
AV_PIX_FMT_YUV444P , AV_PIX_FMT_YUV422P , AV_PIX_FMT_YUV420P ,
AV_PIX_FMT_YUV444P10LE , AV_PIX_FMT_YUV422P10LE , AV_PIX_FMT_YUV420P10LE ,
AV_PIX_FMT_NONE
} ;
AVFilterFormats * fmts_list = ff_make_format_list ( pix_fmts ) ;
if ( ! fmts_list )
return AVERROR ( ENOMEM ) ;
return ff_set_common_formats ( ctx , fmts_list ) ;
}
static int config_input_ref ( AVFilterLink * inlink )
{
AVFilterContext * ctx = inlink - > dst ;
LIBVMAFContext * s = ctx - > priv ;
int th ;
if ( ctx - > inputs [ 0 ] - > w ! = ctx - > inputs [ 1 ] - > w | |
ctx - > inputs [ 0 ] - > h ! = ctx - > inputs [ 1 ] - > h ) {
av_log ( ctx , AV_LOG_ERROR , " Width and height of input videos must be same. \n " ) ;
return AVERROR ( EINVAL ) ;
}
if ( ctx - > inputs [ 0 ] - > format ! = ctx - > inputs [ 1 ] - > format ) {
av_log ( ctx , AV_LOG_ERROR , " Inputs must be of same pixel format. \n " ) ;
return AVERROR ( EINVAL ) ;
}
s - > desc = av_pix_fmt_desc_get ( inlink - > format ) ;
s - > width = ctx - > inputs [ 0 ] - > w ;
s - > height = ctx - > inputs [ 0 ] - > h ;
th = pthread_create ( & s - > vmaf_thread , NULL , call_vmaf , ( void * ) s ) ;
if ( th ) {
av_log ( ctx , AV_LOG_ERROR , " Thread creation failed. \n " ) ;
return AVERROR ( EINVAL ) ;
}
2018-04-30 17:33:51 +02:00
s - > vmaf_thread_created = 1 ;
2017-07-15 18:42:33 +02:00
return 0 ;
}
static int config_output ( AVFilterLink * outlink )
{
AVFilterContext * ctx = outlink - > src ;
LIBVMAFContext * s = ctx - > priv ;
AVFilterLink * mainlink = ctx - > inputs [ 0 ] ;
int ret ;
2017-08-31 19:47:37 +02:00
ret = ff_framesync_init_dualinput ( & s - > fs , ctx ) ;
lavfi/vf_libvmaf: convert to framesync2.
After this commit, the code compiles, but on my setup it
segfaults before and after. It also prints the very worrying
warning:
src/libavfilter/vf_libvmaf.c:161:66: warning: passing argument 4 of ‘compute_vmaf’ from incompatible pointer type [-Wincompatible-pointer-types]
/tmp/i/include/libvmaf.h:26:8: note: expected ‘int (*)(float *, float *, float *, int, void *)’ but argument is of type ‘int (*)(float *, float *, float *, int, double *, void *)’
==12116== Thread 6:
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Use of uninitialised value of size 8
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Invalid read of size 4
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116== Address 0x40 is not stack'd, malloc'd or (recently) free'd
==12116==
==12116==
==12116== Process terminating with default action of signal 11 (SIGSEGV)
==12116== Access not within mapped region at address 0x40
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
2017-07-31 11:40:25 +02:00
if ( ret < 0 )
return ret ;
2017-07-15 18:42:33 +02:00
outlink - > w = mainlink - > w ;
outlink - > h = mainlink - > h ;
outlink - > time_base = mainlink - > time_base ;
outlink - > sample_aspect_ratio = mainlink - > sample_aspect_ratio ;
outlink - > frame_rate = mainlink - > frame_rate ;
2017-08-31 19:47:37 +02:00
if ( ( ret = ff_framesync_configure ( & s - > fs ) ) < 0 )
2017-07-15 18:42:33 +02:00
return ret ;
return 0 ;
}
lavfi/vf_libvmaf: convert to framesync2.
After this commit, the code compiles, but on my setup it
segfaults before and after. It also prints the very worrying
warning:
src/libavfilter/vf_libvmaf.c:161:66: warning: passing argument 4 of ‘compute_vmaf’ from incompatible pointer type [-Wincompatible-pointer-types]
/tmp/i/include/libvmaf.h:26:8: note: expected ‘int (*)(float *, float *, float *, int, void *)’ but argument is of type ‘int (*)(float *, float *, float *, int, double *, void *)’
==12116== Thread 6:
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Use of uninitialised value of size 8
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Invalid read of size 4
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116== Address 0x40 is not stack'd, malloc'd or (recently) free'd
==12116==
==12116==
==12116== Process terminating with default action of signal 11 (SIGSEGV)
==12116== Access not within mapped region at address 0x40
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
2017-07-31 11:40:25 +02:00
static int activate ( AVFilterContext * ctx )
2017-07-15 18:42:33 +02:00
{
lavfi/vf_libvmaf: convert to framesync2.
After this commit, the code compiles, but on my setup it
segfaults before and after. It also prints the very worrying
warning:
src/libavfilter/vf_libvmaf.c:161:66: warning: passing argument 4 of ‘compute_vmaf’ from incompatible pointer type [-Wincompatible-pointer-types]
/tmp/i/include/libvmaf.h:26:8: note: expected ‘int (*)(float *, float *, float *, int, void *)’ but argument is of type ‘int (*)(float *, float *, float *, int, double *, void *)’
==12116== Thread 6:
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Use of uninitialised value of size 8
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Invalid read of size 4
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116== Address 0x40 is not stack'd, malloc'd or (recently) free'd
==12116==
==12116==
==12116== Process terminating with default action of signal 11 (SIGSEGV)
==12116== Access not within mapped region at address 0x40
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
2017-07-31 11:40:25 +02:00
LIBVMAFContext * s = ctx - > priv ;
2017-08-31 19:47:37 +02:00
return ff_framesync_activate ( & s - > fs ) ;
2017-07-15 18:42:33 +02:00
}
static av_cold void uninit ( AVFilterContext * ctx )
{
LIBVMAFContext * s = ctx - > priv ;
2017-08-31 19:47:37 +02:00
ff_framesync_uninit ( & s - > fs ) ;
2017-07-15 18:42:33 +02:00
pthread_mutex_lock ( & s - > lock ) ;
s - > eof = 1 ;
pthread_cond_signal ( & s - > cond ) ;
pthread_mutex_unlock ( & s - > lock ) ;
2018-04-30 17:33:51 +02:00
if ( s - > vmaf_thread_created )
{
pthread_join ( s - > vmaf_thread , NULL ) ;
s - > vmaf_thread_created = 0 ;
}
2017-07-15 18:42:33 +02:00
av_frame_free ( & s - > gref ) ;
av_frame_free ( & s - > gmain ) ;
pthread_mutex_destroy ( & s - > lock ) ;
pthread_cond_destroy ( & s - > cond ) ;
}
static const AVFilterPad libvmaf_inputs [ ] = {
{
. name = " main " ,
. type = AVMEDIA_TYPE_VIDEO ,
} , {
. name = " reference " ,
. type = AVMEDIA_TYPE_VIDEO ,
. config_props = config_input_ref ,
} ,
{ NULL }
} ;
static const AVFilterPad libvmaf_outputs [ ] = {
{
. name = " default " ,
. type = AVMEDIA_TYPE_VIDEO ,
. config_props = config_output ,
} ,
{ NULL }
} ;
2021-04-19 18:33:56 +02:00
const AVFilter ff_vf_libvmaf = {
2017-07-15 18:42:33 +02:00
. name = " libvmaf " ,
. description = NULL_IF_CONFIG_SMALL ( " Calculate the VMAF between two video streams. " ) ,
lavfi/vf_libvmaf: convert to framesync2.
After this commit, the code compiles, but on my setup it
segfaults before and after. It also prints the very worrying
warning:
src/libavfilter/vf_libvmaf.c:161:66: warning: passing argument 4 of ‘compute_vmaf’ from incompatible pointer type [-Wincompatible-pointer-types]
/tmp/i/include/libvmaf.h:26:8: note: expected ‘int (*)(float *, float *, float *, int, void *)’ but argument is of type ‘int (*)(float *, float *, float *, int, double *, void *)’
==12116== Thread 6:
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Use of uninitialised value of size 8
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Invalid read of size 4
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116== Address 0x40 is not stack'd, malloc'd or (recently) free'd
==12116==
==12116==
==12116== Process terminating with default action of signal 11 (SIGSEGV)
==12116== Access not within mapped region at address 0x40
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
2017-07-31 11:40:25 +02:00
. preinit = libvmaf_framesync_preinit ,
2017-07-15 18:42:33 +02:00
. init = init ,
. uninit = uninit ,
. query_formats = query_formats ,
lavfi/vf_libvmaf: convert to framesync2.
After this commit, the code compiles, but on my setup it
segfaults before and after. It also prints the very worrying
warning:
src/libavfilter/vf_libvmaf.c:161:66: warning: passing argument 4 of ‘compute_vmaf’ from incompatible pointer type [-Wincompatible-pointer-types]
/tmp/i/include/libvmaf.h:26:8: note: expected ‘int (*)(float *, float *, float *, int, void *)’ but argument is of type ‘int (*)(float *, float *, float *, int, double *, void *)’
==12116== Thread 6:
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Conditional jump or move depends on uninitialised value(s)
==12116== at 0x526D432: cons_ (ocval.h:1188)
==12116== by 0x526D432: GenericIT (ocval.h:1119)
==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94)
==12116== by 0x5211F5D: loads (pickleloader.h:566)
==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290)
==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405)
==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77)
==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Use of uninitialised value of size 8
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116==
==12116== Invalid read of size 4
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
==12116== Address 0x40 is not stack'd, malloc'd or (recently) free'd
==12116==
==12116==
==12116== Process terminating with default action of signal 11 (SIGSEGV)
==12116== Access not within mapped region at address 0x40
==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147)
==12116== by 0x52AB5E8: combo (combo.c:149)
==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278)
==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645)
==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161)
==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170)
==12116== by 0x7967493: start_thread (pthread_create.c:333)
==12116== by 0x7F69A8E: clone (clone.S:97)
2017-07-31 11:40:25 +02:00
. activate = activate ,
2017-07-15 18:42:33 +02:00
. priv_size = sizeof ( LIBVMAFContext ) ,
. priv_class = & libvmaf_class ,
. inputs = libvmaf_inputs ,
. outputs = libvmaf_outputs ,
} ;