Commit e835a9d3 authored by Paul B Mahol's avatar Paul B Mahol

avfilter/vf_libvmaf: fix filtering of >8 bit data

This is what reference does.
parent 19587c93
...@@ -110,6 +110,7 @@ FRAMESYNC_DEFINE_CLASS(libvmaf, LIBVMAFContext, fs); ...@@ -110,6 +110,7 @@ FRAMESYNC_DEFINE_CLASS(libvmaf, LIBVMAFContext, fs);
const type *main_ptr = (const type *) s->gmain->data[0]; \ const type *main_ptr = (const type *) s->gmain->data[0]; \
\ \
float *ptr = ref_data; \ float *ptr = ref_data; \
float factor = 1.f / (1 << (bits - 8)); \
\ \
int h = s->height; \ int h = s->height; \
int w = s->width; \ int w = s->width; \
...@@ -118,7 +119,7 @@ FRAMESYNC_DEFINE_CLASS(libvmaf, LIBVMAFContext, fs); ...@@ -118,7 +119,7 @@ FRAMESYNC_DEFINE_CLASS(libvmaf, LIBVMAFContext, fs);
\ \
for (i = 0; i < h; i++) { \ for (i = 0; i < h; i++) { \
for ( j = 0; j < w; j++) { \ for ( j = 0; j < w; j++) { \
ptr[j] = (float)ref_ptr[j]; \ ptr[j] = ref_ptr[j] * factor; \
} \ } \
ref_ptr += ref_stride / sizeof(*ref_ptr); \ ref_ptr += ref_stride / sizeof(*ref_ptr); \
ptr += stride / sizeof(*ptr); \ ptr += stride / sizeof(*ptr); \
...@@ -128,7 +129,7 @@ FRAMESYNC_DEFINE_CLASS(libvmaf, LIBVMAFContext, fs); ...@@ -128,7 +129,7 @@ FRAMESYNC_DEFINE_CLASS(libvmaf, LIBVMAFContext, fs);
\ \
for (i = 0; i < h; i++) { \ for (i = 0; i < h; i++) { \
for (j = 0; j < w; j++) { \ for (j = 0; j < w; j++) { \
ptr[j] = (float)main_ptr[j]; \ ptr[j] = main_ptr[j] * factor; \
} \ } \
main_ptr += main_stride / sizeof(*main_ptr); \ main_ptr += main_stride / sizeof(*main_ptr); \
ptr += stride / sizeof(*ptr); \ ptr += stride / sizeof(*ptr); \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment