[FFmpeg-cvslog] avcodec/sheervideo: fix Y prediction in decode_ybr(i) for older formats

Paul B Mahol git at videolan.org
Sun Sep 18 19:50:27 EEST 2016


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Sep 18 18:19:15 2016 +0200| [260de8a264b7525d6ce5a16f3a46d612f03d1a49] | committer: Paul B Mahol

avcodec/sheervideo: fix Y prediction in decode_ybr(i) for older formats

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=260de8a264b7525d6ce5a16f3a46d612f03d1a49
---

 libavcodec/sheervideo.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/sheervideo.c b/libavcodec/sheervideo.c
index 2f08b7b..be14e71 100644
--- a/libavcodec/sheervideo.c
+++ b/libavcodec/sheervideo.c
@@ -31,6 +31,7 @@
 
 typedef struct SheerVideoContext {
     unsigned format;
+    int alt;
     VLC vlc[2];
     void (*decode_frame)(AVCodecContext *avctx, AVFrame *p, GetBitContext *gb);
 } SheerVideoContext;
@@ -2038,7 +2039,7 @@ static void decode_ybri(AVCodecContext *avctx, AVFrame *p, GetBitContext *gb)
             dst_v[x] = get_bits(gb, 8);
         }
     } else {
-        int pred[4] = { 125, -128, -128, -128 };
+        int pred[4] = { s->alt ? 125 : -146, -128, -128, -128 };
 
         for (x = 0; x < avctx->width; x++) {
             int y, u, v;
@@ -2106,7 +2107,7 @@ static void decode_ybr(AVCodecContext *avctx, AVFrame *p, GetBitContext *gb)
             dst_v[x] = get_bits(gb, 8);
         }
     } else {
-        int pred[4] = { 125, -128, -128, -128 };
+        int pred[4] = { s->alt ? 125 : -146, -128, -128, -128 };
 
         for (x = 0; x < avctx->width; x++) {
             int y, u, v;
@@ -2887,6 +2888,7 @@ static int decode_frame(AVCodecContext *avctx,
         AV_RL32(avpkt->data) != MKTAG('Z','w','a','k'))
         return AVERROR_INVALIDDATA;
 
+    s->alt = 0;
     format = AV_RL32(avpkt->data + 16);
     switch (format) {
     case MKTAG(' ', 'R', 'G', 'B'):
@@ -2972,6 +2974,7 @@ static int decode_frame(AVCodecContext *avctx,
         }
         break;
     case MKTAG(' ', 'Y', 'B', 'R'):
+        s->alt = 1;
     case MKTAG(' ', 'Y', 'b', 'R'):
         avctx->pix_fmt = AV_PIX_FMT_YUV444P;
         s->decode_frame = decode_ybr;
@@ -2981,6 +2984,7 @@ static int decode_frame(AVCodecContext *avctx,
         }
         break;
     case MKTAG(' ', 'y', 'B', 'R'):
+        s->alt = 1;
     case MKTAG(' ', 'y', 'b', 'R'):
         avctx->pix_fmt = AV_PIX_FMT_YUV444P;
         s->decode_frame = decode_ybri;



More information about the ffmpeg-cvslog mailing list