[FFmpeg-cvslog] avcodec/bink: add 'k' version support

Paul B Mahol git at videolan.org
Sun Jul 22 11:33:52 EEST 2018


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Jul 18 21:17:29 2018 +0200| [1b0922584e463d5979d92bc4613a44e41a56c315] | committer: Paul B Mahol

avcodec/bink: add 'k' version support

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

 libavcodec/bink.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index c4cf617a8b..b3136b763c 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -371,11 +371,19 @@ static const uint8_t bink_rlelens[4] = { 4, 8, 12, 32 };
 
 static int read_block_types(AVCodecContext *avctx, GetBitContext *gb, Bundle *b)
 {
+    BinkContext * const c = avctx->priv_data;
     int t, v;
     int last = 0;
     const uint8_t *dec_end;
 
     CHECK_READ_VAL(gb, b, t);
+    if (c->version == 'k') {
+        t ^= 0xBBu;
+        if (t == 0) {
+            b->cur_dec = NULL;
+            return 0;
+        }
+    }
     dec_end = b->cur_dec + t;
     if (dec_end > b->data_end) {
         av_log(avctx, AV_LOG_ERROR, "Too many block type values\n");
@@ -994,6 +1002,17 @@ static int bink_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
     int bw = is_chroma ? (c->avctx->width  + 15) >> 4 : (c->avctx->width  + 7) >> 3;
     int bh = is_chroma ? (c->avctx->height + 15) >> 4 : (c->avctx->height + 7) >> 3;
     int width = c->avctx->width >> is_chroma;
+    int height = c->avctx->height >> is_chroma;
+
+    if (c->version == 'k' && get_bits1(gb)) {
+        int fill = get_bits(gb, 8);
+
+        dst = frame->data[plane_idx];
+
+        for (i = 0; i < height; i++)
+            memset(dst + i * stride, fill, width);
+        goto end;
+    }
 
     init_lengths(c, FFMAX(width, 8), bw);
     for (i = 0; i < BINK_NB_SRC; i++)
@@ -1190,6 +1209,8 @@ static int bink_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
             }
         }
     }
+
+end:
     if (get_bits_count(gb) & 0x1F) //next plane data starts at 32-bit boundary
         skip_bits_long(gb, 32 - (get_bits_count(gb) & 0x1F));
 



More information about the ffmpeg-cvslog mailing list