[vlc-commits] rawvideo: fix sign for yuv2 chroma

Tristan Matthews git at videolan.org
Wed Jan 8 21:51:01 CET 2020


vlc | branch: master | Tristan Matthews <tmatth at videolan.org> | Sat Apr  2 01:37:20 2016 -0400| [48cdaf0f0e45db3fcd64f63d0ddca778d4f64220] | committer: Francois Cartegnie

rawvideo: fix sign for yuv2 chroma

Refs #16720

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=48cdaf0f0e45db3fcd64f63d0ddca778d4f64220
---

 modules/codec/rawvideo.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/modules/codec/rawvideo.c b/modules/codec/rawvideo.c
index 3c3e789dfe..c43932d437 100644
--- a/modules/codec/rawvideo.c
+++ b/modules/codec/rawvideo.c
@@ -101,6 +101,12 @@ static int OpenCommon( decoder_t *p_dec )
 
     es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
 
+    if( p_dec->fmt_in.i_codec == VLC_CODEC_YUV2 )
+    {
+        p_dec->fmt_out.video.i_chroma =
+        p_dec->fmt_out.i_codec = VLC_CODEC_YUYV;
+    }
+
     if( p_dec->fmt_out.video.i_frame_rate == 0 ||
         p_dec->fmt_out.video.i_frame_rate_base == 0)
     {
@@ -207,6 +213,12 @@ static void FillPicture( decoder_t *p_dec, block_t *p_block, picture_t *p_pic )
         for( int x = 0; x < p_pic->p[i].i_visible_lines; x++ )
         {
             memcpy( p_dst, p_src, p_pic->p[i].i_visible_pitch );
+            /*Fix chroma sign.*/
+            if( p_dec->fmt_in.i_codec == VLC_CODEC_YUV2 ) {
+                for( int y = 0; y < p_pic->p[i].i_visible_pitch; y++ ) {
+                    p_dst[2*y + 1] ^= 0x80;
+                }
+            }
             p_src += p_sys->pitches[i];
             p_dst += p_pic->p[i].i_pitch;
         }



More information about the vlc-commits mailing list