summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2019-01-18 14:27:14 -0800
committerJohn Stebbins <[email protected]>2019-01-20 09:20:47 -0800
commit563958843beb27b410df19a020e35e51afa298a0 (patch)
tree9858a9158b3c4812ecae2531e6a7ead8d9ba07dc /libhb
parent96e63ecf50d0bafd273ea17ff3f3bbf49ff42f7b (diff)
lapsharp: blank frame buffer stride region
Zero is not black. Stride is used in computations and is assumed black. Fixes https://github.com/HandBrake/HandBrake/issues/1751
Diffstat (limited to 'libhb')
-rw-r--r--libhb/fifo.c28
-rw-r--r--libhb/internal.h1
-rw-r--r--libhb/lapsharp.c1
3 files changed, 30 insertions, 0 deletions
diff --git a/libhb/fifo.c b/libhb/fifo.c
index 6bf642678..b631e46db 100644
--- a/libhb/fifo.c
+++ b/libhb/fifo.c
@@ -597,6 +597,34 @@ hb_buffer_t * hb_frame_buffer_init( int pix_fmt, int width, int height )
return buf;
}
+void hb_frame_buffer_blank_stride(hb_buffer_t * buf)
+{
+ int pp, xx, yy, stride;
+
+ for (pp = 0; pp < 4; pp++)
+ {
+ if (buf->plane[pp].data != NULL)
+ {
+ stride = buf->plane[pp].stride;
+ for (yy = 0; yy < buf->plane[pp].height; yy++)
+ {
+ for (xx = buf->plane[pp].width; xx < stride; xx++)
+ {
+ *(buf->plane[pp].data + (yy * stride) + xx) = 0x80;
+ }
+ }
+ for (yy = buf->plane[pp].height;
+ yy < buf->plane[pp].height_stride; yy++)
+ {
+ for (xx = 0; xx < stride; xx++)
+ {
+ *(buf->plane[pp].data + (yy * stride) + xx) = 0x80;
+ }
+ }
+ }
+ }
+}
+
// this routine reallocs a buffer for an uncompressed YUV420 video frame
// with dimensions width x height.
void hb_video_buffer_realloc( hb_buffer_t * buf, int width, int height )
diff --git a/libhb/internal.h b/libhb/internal.h
index cd46c1265..1ad82d7f3 100644
--- a/libhb/internal.h
+++ b/libhb/internal.h
@@ -161,6 +161,7 @@ void hb_buffer_pool_free( void );
hb_buffer_t * hb_buffer_init( int size );
hb_buffer_t * hb_buffer_eof_init( void );
hb_buffer_t * hb_frame_buffer_init( int pix_fmt, int w, int h);
+void hb_frame_buffer_blank_stride(hb_buffer_t * buf);
void hb_buffer_init_planes( hb_buffer_t * b );
void hb_buffer_realloc( hb_buffer_t *, int size );
void hb_video_buffer_realloc( hb_buffer_t * b, int w, int h );
diff --git a/libhb/lapsharp.c b/libhb/lapsharp.c
index eb1c72aee..29d3122f5 100644
--- a/libhb/lapsharp.c
+++ b/libhb/lapsharp.c
@@ -283,6 +283,7 @@ static int hb_lapsharp_work(hb_filter_object_t *filter,
return HB_FILTER_DONE;
}
+ hb_frame_buffer_blank_stride(in);
out = hb_frame_buffer_init(in->f.fmt, in->f.width, in->f.height);
int c;