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>
This commit is contained in:
Andreas Rheinhardt 2021-12-23 03:57:55 +01:00
parent 22ef01f5e1
commit b821a58741
2 changed files with 44 additions and 44 deletions

View File

@ -23,7 +23,6 @@
#include "mpegutils.h"
#include "mpegvideo.h"
#include "msmpeg4data.h"
#include "simple_idct.h"
#include "wmv2.h"
#include "wmv2data.h"
@ -54,49 +53,6 @@ av_cold void ff_wmv2_common_init(Wmv2Context *w)
s->idsp.idct = NULL;
}
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);
}
void ff_mspel_motion(MpegEncContext *s, uint8_t *dest_y,
uint8_t *dest_cb, uint8_t *dest_cr,
uint8_t **ref_picture, op_pixels_func (*pix_op)[4],

View File

@ -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;