mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-23 11:19:55 +00:00
avcodec/bink: add 'k' version support
This commit is contained in:
parent
251329fa76
commit
1b0922584e
@ -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));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user