summaryrefslogtreecommitdiffstats
path: root/libhb/sync.c
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2020-12-02 22:55:51 +0100
committerDamiano Galassi <[email protected]>2020-12-02 22:55:51 +0100
commit15601f1b4aa14126ccb06ccd8041bed41aa3a7bf (patch)
tree56b61eaa177ee836baabb344c32f760fa4cbec67 /libhb/sync.c
parent35f6cc74910cb95ccbb11e2e082f6144105c2ccd (diff)
libhb: fix black buffer creation when the pixel format bit depth is 10 or more.
Diffstat (limited to 'libhb/sync.c')
-rw-r--r--libhb/sync.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libhb/sync.c b/libhb/sync.c
index b68d3ae73..66f0f56fe 100644
--- a/libhb/sync.c
+++ b/libhb/sync.c
@@ -374,9 +374,15 @@ static hb_buffer_t * CreateBlackBuf( sync_stream_t * stream,
buf = hb_frame_buffer_init(stream->common->job->pix_fmt,
stream->common->job->title->geometry.width,
stream->common->job->title->geometry.height);
- memset(buf->plane[0].data, 0x00, buf->plane[0].size);
- memset(buf->plane[1].data, 0x80, buf->plane[1].size);
- memset(buf->plane[2].data, 0x80, buf->plane[2].size);
+ uint8_t *planes[4];
+ ptrdiff_t linesizes[4];
+ for (int i = 0; i <= buf->f.max_plane; ++i)
+ {
+ planes[i] = buf->plane[i].data;
+ linesizes[i] = buf->plane[i].stride;
+ }
+ av_image_fill_black(planes, linesizes, stream->common->job->pix_fmt,
+ AVCOL_RANGE_JPEG, buf->f.width, buf->f.height);
}
else
{