aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2018-07-18 21:17:29 +0200
committerPaul B Mahol <onemda@gmail.com>2018-07-22 10:03:56 +0200
commit1b0922584e463d5979d92bc4613a44e41a56c315 (patch)
tree9a103217d12c24ed207ac7a5a326ea4d4639fa92 /libavcodec
parent251329fa76c0dd9be7f1d78173b3314cc7364dc4 (diff)
downloadffmpeg-1b0922584e463d5979d92bc4613a44e41a56c315.tar.gz
avcodec/bink: add 'k' version support
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/bink.c21
1 files changed, 21 insertions, 0 deletions
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));