mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 18:50:48 +00:00
aomenc: Handle 8 bit_depth images with AOM_IMG_FMT_HIGHBITDEPTH enabled
https://bugzilla.gnome.org/show_bug.cgi?id=791674
This commit is contained in:
parent
1d96d9e842
commit
10a37e0c35
1 changed files with 16 additions and 4 deletions
|
@ -285,7 +285,7 @@ static void
|
|||
gst_av1_dec_image_to_buffer (GstAV1Dec * dec, const aom_image_t * img,
|
||||
GstBuffer * buffer)
|
||||
{
|
||||
int deststride, srcstride, height, width, line, comp;
|
||||
int deststride, srcstride, height, width, line, comp, y;
|
||||
guint8 *dest, *src;
|
||||
GstVideoFrame frame;
|
||||
GstVideoInfo *info = &dec->output_state->info;
|
||||
|
@ -298,13 +298,25 @@ gst_av1_dec_image_to_buffer (GstAV1Dec * dec, const aom_image_t * img,
|
|||
for (comp = 0; comp < 3; comp++) {
|
||||
dest = GST_VIDEO_FRAME_COMP_DATA (&frame, comp);
|
||||
src = img->planes[comp];
|
||||
width = GST_VIDEO_FRAME_COMP_WIDTH (&frame, comp)
|
||||
* GST_VIDEO_FRAME_COMP_PSTRIDE (&frame, comp);
|
||||
width =
|
||||
GST_VIDEO_FRAME_COMP_WIDTH (&frame,
|
||||
comp) * GST_VIDEO_FRAME_COMP_PSTRIDE (&frame, comp);
|
||||
height = GST_VIDEO_FRAME_COMP_HEIGHT (&frame, comp);
|
||||
deststride = GST_VIDEO_FRAME_COMP_STRIDE (&frame, comp);
|
||||
srcstride = img->stride[comp];
|
||||
|
||||
if (srcstride == deststride) {
|
||||
if ((img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) && img->bit_depth == 8) {
|
||||
GST_TRACE_OBJECT (dec,
|
||||
"HIGHBITDEPTH image with 8 bit_depth. Comp %d: %d != %d, copying "
|
||||
"line by line.", comp, srcstride, deststride);
|
||||
for (line = 0; line < height; line++) {
|
||||
for (y = 0; y < width; y++) {
|
||||
dest[y] = src[y * 2];
|
||||
}
|
||||
dest += deststride;
|
||||
src += srcstride;
|
||||
}
|
||||
} else if (srcstride == deststride) {
|
||||
GST_TRACE_OBJECT (dec, "Stride matches. Comp %d: %d, copying full plane",
|
||||
comp, srcstride);
|
||||
memcpy (dest, src, srcstride * height);
|
||||
|
|
Loading…
Reference in a new issue