diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-12-23 03:57:55 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-01-04 16:28:55 +0100 |
commit | b821a58741fddce0e103b2d9a93c313904241003 (patch) | |
tree | 9db09bf9950fe35141683e46181225106b739841 /libavcodec/wmv2dec.c | |
parent | 22ef01f5e142ffc38d4365b284cba5747a2d9982 (diff) | |
download | ffmpeg-b821a58741fddce0e103b2d9a93c313904241003.tar.gz |
avcodec/wmv2: Move ff_wmv2_add_mb() to the wmv2dec
Only the decoder ever used it.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/wmv2dec.c')
-rw-r--r-- | libavcodec/wmv2dec.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c index c500e3e779..f7745c5a83 100644 --- a/libavcodec/wmv2dec.c +++ b/libavcodec/wmv2dec.c @@ -27,9 +27,53 @@ #include "mpegvideo.h" #include "msmpeg4.h" #include "msmpeg4data.h" +#include "simple_idct.h" #include "wmv2.h" +static void wmv2_add_block(Wmv2Context *w, int16_t *block1, + uint8_t *dst, int stride, int n) +{ + MpegEncContext *const s = &w->s; + + if (s->block_last_index[n] >= 0) { + switch (w->abt_type_table[n]) { + case 0: + w->wdsp.idct_add(dst, stride, block1); + break; + case 1: + ff_simple_idct84_add(dst, stride, block1); + ff_simple_idct84_add(dst + 4 * stride, stride, w->abt_block2[n]); + s->bdsp.clear_block(w->abt_block2[n]); + break; + case 2: + ff_simple_idct48_add(dst, stride, block1); + ff_simple_idct48_add(dst + 4, stride, w->abt_block2[n]); + s->bdsp.clear_block(w->abt_block2[n]); + break; + default: + av_log(s->avctx, AV_LOG_ERROR, "internal error in WMV2 abt\n"); + } + } +} + +void ff_wmv2_add_mb(MpegEncContext *s, int16_t block1[6][64], + uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr) +{ + Wmv2Context *const w = (Wmv2Context *) s; + + wmv2_add_block(w, block1[0], dest_y, s->linesize, 0); + wmv2_add_block(w, block1[1], dest_y + 8, s->linesize, 1); + wmv2_add_block(w, block1[2], dest_y + 8 * s->linesize, s->linesize, 2); + wmv2_add_block(w, block1[3], dest_y + 8 + 8 * s->linesize, s->linesize, 3); + + if (s->avctx->flags & AV_CODEC_FLAG_GRAY) + return; + + wmv2_add_block(w, block1[4], dest_cb, s->uvlinesize, 4); + wmv2_add_block(w, block1[5], dest_cr, s->uvlinesize, 5); +} + static int parse_mb_skip(Wmv2Context *w) { int mb_x, mb_y; |