video-format: Fix 10LE32 formats packing function

The source offset (soff) was not incremented for each component and then
each group of 3 components were inverted. This was causing a staircase
effect combined with some noise.

https://bugzilla.gnome.org/show_bug.cgi?id=789876
This commit is contained in:
Nicolas Dufresne 2018-02-06 16:16:15 -05:00
parent c8b99139b1
commit eb7565b60e

View file

@ -4616,13 +4616,11 @@ pack_GRAY10_LE32 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
guint32 Y = 0; guint32 Y = 0;
for (c = 0; c < num_comps; c++) { for (c = 0; c < num_comps; c++) {
Y <<= 10; Y |= s[soff + 1] >> 6 << (10 * c);
Y |= s[soff + 1] >> 6; soff += 4;
} }
GST_WRITE_UINT32_LE (dy + i, Y); GST_WRITE_UINT32_LE (dy + i, Y);
soff += 4;
} }
} }
@ -4745,31 +4743,31 @@ pack_NV12_10LE32 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
guint32 Y = 0; guint32 Y = 0;
for (c = 0; c < num_comps; c++) { for (c = 0; c < num_comps; c++) {
Y <<= 10; Y |= s[soff + 1] >> 6 << (10 * c);
Y |= s[soff + 1] >> 6;
if (!IS_CHROMA_LINE_420 (y, flags)) if (IS_CHROMA_LINE_420 (y, flags)) {
continue; switch ((pix + c) % 6) {
case 0:
switch ((pix + c) % 6) { UV = s[soff + 2] >> 6;
case 0: UV |= s[soff + 3] >> 6 << 10;
UV = s[soff + 2] >> 6; break;
UV |= s[soff + 3] >> 6 << 10; case 2:
break; UV |= s[soff + 2] >> 6 << 20;
case 2: GST_WRITE_UINT32_LE (duv + i, UV);
UV |= s[soff + 2] >> 6 << 20; UV = s[soff + 3] >> 6;
GST_WRITE_UINT32_LE (duv + i, UV); break;
UV = s[soff + 3] >> 6; case 4:
break; UV |= s[soff + 2] >> 6 << 10;
case 4: UV |= s[soff + 3] >> 6 << 20;
UV |= s[soff + 2] >> 6 << 10; GST_WRITE_UINT32_LE (duv + i, UV);
UV |= s[soff + 3] >> 6 << 20; break;
GST_WRITE_UINT32_LE (duv + i, UV); default:
break; /* keep value */
default: break;
/* keep value */ }
break;
} }
soff += 4;
} }
GST_WRITE_UINT32_LE (dy + i, Y); GST_WRITE_UINT32_LE (dy + i, Y);
@ -4777,7 +4775,6 @@ pack_NV12_10LE32 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
if (IS_CHROMA_LINE_420 (y, flags) && num_comps < 3) if (IS_CHROMA_LINE_420 (y, flags) && num_comps < 3)
GST_WRITE_UINT32_LE (duv + i, UV); GST_WRITE_UINT32_LE (duv + i, UV);
soff += 4;
} }
} }
@ -4898,8 +4895,7 @@ pack_NV16_10LE32 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
guint32 Y = 0; guint32 Y = 0;
for (c = 0; c < num_comps; c++) { for (c = 0; c < num_comps; c++) {
Y <<= 10; Y |= s[soff + 1] >> 6 << (10 * c);
Y |= s[soff + 1] >> 6;
switch ((pix + c) % 6) { switch ((pix + c) % 6) {
case 0: case 0:
@ -4920,14 +4916,14 @@ pack_NV16_10LE32 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
/* keep value */ /* keep value */
break; break;
} }
soff += 4;
} }
GST_WRITE_UINT32_LE (dy + i, Y); GST_WRITE_UINT32_LE (dy + i, Y);
if (num_comps < 3) if (num_comps < 3)
GST_WRITE_UINT32_LE (duv + i, UV); GST_WRITE_UINT32_LE (duv + i, UV);
soff += 4;
} }
} }