hrev48467 adds 1 changeset to branch 'master' old head: 0edd73e46756b08c896da1e39786329938a2c433 new head: d5b78822f79582d6964947a91d1c10575addfb60 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=d5b7882+%5E0edd73e ---------------------------------------------------------------------------- d5b7882: Implement Y'CbCr 4:1:0 to RGB32 conversion. * Also known as the YUV9 FourCC and used in SVQ1 (early QuickTime) videos. * Fixes part of #4512 (one more video played correctly) and replay of all old Quicktime videos when you don't have overlay support. [ Adrien Destugues <pulkomandy@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev48467 Commit: d5b78822f79582d6964947a91d1c10575addfb60 URL: http://cgit.haiku-os.org/haiku/commit/?id=d5b7882 Author: Adrien Destugues <pulkomandy@xxxxxxxxx> Date: Tue Dec 9 13:30:28 2014 UTC Ticket: https://dev.haiku-os.org/ticket/4512 ---------------------------------------------------------------------------- 1 file changed, 50 insertions(+), 16 deletions(-) src/add-ons/media/plugins/ffmpeg/gfx_conv_c.cpp | 66 ++++++++++++++++----- ---------------------------------------------------------------------------- diff --git a/src/add-ons/media/plugins/ffmpeg/gfx_conv_c.cpp b/src/add-ons/media/plugins/ffmpeg/gfx_conv_c.cpp index 3ca125a..b459a94 100644 --- a/src/add-ons/media/plugins/ffmpeg/gfx_conv_c.cpp +++ b/src/add-ons/media/plugins/ffmpeg/gfx_conv_c.cpp @@ -134,19 +134,6 @@ gfx_conv_yuv420p_ycbcr422_c(AVFrame *in, AVFrame *out, int width, int height) } } -void -gfx_conv_yuv410p_rgb32_c(AVFrame *in, AVFrame *out, int width, int height) -{ - gfx_conv_null(in, out, width, height); -} - - -void -gfx_conv_yuv411p_rgb32_c(AVFrame *in, AVFrame *out, int width, int height) -{ - gfx_conv_null(in, out, width, height); -} - #define CLIP(a) if (0xffffff00 & (uint32)a) { if (a < 0) a = 0; else a = 255; } @@ -157,7 +144,7 @@ YUV444TORGBA8888(uint8 y, uint8 u, uint8 v) int32 c = y - 16; int32 d = u - 128; int32 e = v - 128; - + int32 r = (298 * c + 409 * e + 128) >> 8; int32 g = (298 * c - 100 * d - 208 * e + 128) >> 8; int32 b = (298 * c + 516 * d + 128) >> 8; @@ -165,8 +152,55 @@ YUV444TORGBA8888(uint8 y, uint8 u, uint8 v) CLIP(r); CLIP(g); CLIP(b); - - return (uint32)((r << 16) | (g << 8) | b); + + return (uint32)((255 << 24) | (r << 16) | (g << 8) | b); +} + + +void +gfx_conv_yuv410p_rgb32_c(AVFrame *in, AVFrame *out, int width, int height) +{ + uint8 *ybase = (uint8 *)in->data[0]; + uint8 *ubase = (uint8 *)in->data[1]; + uint8 *vbase = (uint8 *)in->data[2]; + + uint32 *rgbbase = (uint32 *)out->data[0]; + + int uv_index; + + for (int32 i = 0; i < height; i++) { + uv_index = 0; + for (int32 j=0; j < width; j+=4) { + rgbbase[j] = YUV444TORGBA8888(ybase[j], ubase[uv_index], + vbase[uv_index]); + rgbbase[j + 1] = YUV444TORGBA8888(ybase[j + 1], ubase[uv_index], + vbase[uv_index]); + rgbbase[j + 2] = YUV444TORGBA8888(ybase[j + 2], ubase[uv_index], + vbase[uv_index]); + rgbbase[j + 3] = YUV444TORGBA8888(ybase[j + 3], ubase[uv_index], + vbase[uv_index]); + uv_index++; + } + + // Advance pointers to next line + ybase += in->linesize[0]; + + if ((i & 3) == 0) { + // These are the same for 4 lines + ubase += in->linesize[1]; + vbase += in->linesize[2]; + } + + rgbbase += out->linesize[0] / 4; + } + +} + + +void +gfx_conv_yuv411p_rgb32_c(AVFrame *in, AVFrame *out, int width, int height) +{ + gfx_conv_null(in, out, width, height); }