mpegvideo: Move 8x8 in a separate function
This commit is contained in:
parent
95587859cc
commit
825c7c62bb
@ -747,76 +747,27 @@ static inline void apply_obmc(MpegEncContext *s,
|
||||
mx, my);
|
||||
}
|
||||
|
||||
/**
|
||||
* motion compensation of a single macroblock
|
||||
* @param s context
|
||||
* @param dest_y luma destination pointer
|
||||
* @param dest_cb chroma cb/u destination pointer
|
||||
* @param dest_cr chroma cr/v destination pointer
|
||||
* @param dir direction (0->forward, 1->backward)
|
||||
* @param ref_picture array[3] of pointers to the 3 planes of the reference picture
|
||||
* @param pix_op halfpel motion compensation function (average or put normally)
|
||||
* @param qpix_op qpel motion compensation function (average or put normally)
|
||||
* the motion vectors are taken from s->mv and the MV type from s->mv_type
|
||||
*/
|
||||
static av_always_inline void MPV_motion_internal(MpegEncContext *s,
|
||||
static inline void apply_8x8(MpegEncContext *s,
|
||||
uint8_t *dest_y,
|
||||
uint8_t *dest_cb,
|
||||
uint8_t *dest_cr,
|
||||
int dir,
|
||||
uint8_t **ref_picture,
|
||||
op_pixels_func (*pix_op)[4],
|
||||
qpel_mc_func (*qpix_op)[16],
|
||||
int is_mpeg12)
|
||||
op_pixels_func (*pix_op)[4])
|
||||
{
|
||||
int dxy, mx, my, src_x, src_y, motion_x, motion_y;
|
||||
int mb_x, mb_y, i;
|
||||
int dxy, mx, my, src_x, src_y;
|
||||
int i;
|
||||
int mb_x = s->mb_x;
|
||||
int mb_y = s->mb_y;
|
||||
uint8_t *ptr, *dest;
|
||||
|
||||
mb_x = s->mb_x;
|
||||
mb_y = s->mb_y;
|
||||
|
||||
prefetch_motion(s, ref_picture, dir);
|
||||
|
||||
if (!is_mpeg12 && s->obmc && s->pict_type != AV_PICTURE_TYPE_B) {
|
||||
apply_obmc(s, dest_y, dest_cb, dest_cr, ref_picture, pix_op);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (s->mv_type) {
|
||||
case MV_TYPE_16X16:
|
||||
if (s->mcsel) {
|
||||
if (s->real_sprite_warping_points == 1) {
|
||||
gmc1_motion(s, dest_y, dest_cb, dest_cr,
|
||||
ref_picture);
|
||||
} else {
|
||||
gmc_motion(s, dest_y, dest_cb, dest_cr,
|
||||
ref_picture);
|
||||
}
|
||||
} else if (!is_mpeg12 && s->quarter_sample) {
|
||||
qpel_motion(s, dest_y, dest_cb, dest_cr,
|
||||
0, 0, 0,
|
||||
ref_picture, pix_op, qpix_op,
|
||||
s->mv[dir][0][0], s->mv[dir][0][1], 16);
|
||||
} else if (!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) &&
|
||||
s->mspel && s->codec_id == AV_CODEC_ID_WMV2) {
|
||||
ff_mspel_motion(s, dest_y, dest_cb, dest_cr,
|
||||
ref_picture, pix_op,
|
||||
s->mv[dir][0][0], s->mv[dir][0][1], 16);
|
||||
} else {
|
||||
mpeg_motion(s, dest_y, dest_cb, dest_cr, 0,
|
||||
ref_picture, pix_op,
|
||||
s->mv[dir][0][0], s->mv[dir][0][1], 16, mb_y);
|
||||
}
|
||||
break;
|
||||
case MV_TYPE_8X8:
|
||||
if (!is_mpeg12) {
|
||||
mx = 0;
|
||||
my = 0;
|
||||
if (s->quarter_sample) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
motion_x = s->mv[dir][i][0];
|
||||
motion_y = s->mv[dir][i][1];
|
||||
int motion_x = s->mv[dir][i][0];
|
||||
int motion_y = s->mv[dir][i][1];
|
||||
|
||||
dxy = ((motion_y & 3) << 2) | (motion_x & 3);
|
||||
src_x = mb_x * 16 + (motion_x >> 2) + (i & 1) * 8;
|
||||
@ -869,6 +820,69 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
|
||||
chroma_4mv_motion(s, dest_cb, dest_cr,
|
||||
ref_picture, pix_op[1], mx, my);
|
||||
}
|
||||
|
||||
/**
|
||||
* motion compensation of a single macroblock
|
||||
* @param s context
|
||||
* @param dest_y luma destination pointer
|
||||
* @param dest_cb chroma cb/u destination pointer
|
||||
* @param dest_cr chroma cr/v destination pointer
|
||||
* @param dir direction (0->forward, 1->backward)
|
||||
* @param ref_picture array[3] of pointers to the 3 planes of the reference picture
|
||||
* @param pix_op halfpel motion compensation function (average or put normally)
|
||||
* @param qpix_op qpel motion compensation function (average or put normally)
|
||||
* the motion vectors are taken from s->mv and the MV type from s->mv_type
|
||||
*/
|
||||
static av_always_inline void MPV_motion_internal(MpegEncContext *s,
|
||||
uint8_t *dest_y,
|
||||
uint8_t *dest_cb,
|
||||
uint8_t *dest_cr,
|
||||
int dir,
|
||||
uint8_t **ref_picture,
|
||||
op_pixels_func (*pix_op)[4],
|
||||
qpel_mc_func (*qpix_op)[16],
|
||||
int is_mpeg12)
|
||||
{
|
||||
int i;
|
||||
int mb_y = s->mb_y;
|
||||
|
||||
prefetch_motion(s, ref_picture, dir);
|
||||
|
||||
if (!is_mpeg12 && s->obmc && s->pict_type != AV_PICTURE_TYPE_B) {
|
||||
apply_obmc(s, dest_y, dest_cb, dest_cr, ref_picture, pix_op);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (s->mv_type) {
|
||||
case MV_TYPE_16X16:
|
||||
if (s->mcsel) {
|
||||
if (s->real_sprite_warping_points == 1) {
|
||||
gmc1_motion(s, dest_y, dest_cb, dest_cr,
|
||||
ref_picture);
|
||||
} else {
|
||||
gmc_motion(s, dest_y, dest_cb, dest_cr,
|
||||
ref_picture);
|
||||
}
|
||||
} else if (!is_mpeg12 && s->quarter_sample) {
|
||||
qpel_motion(s, dest_y, dest_cb, dest_cr,
|
||||
0, 0, 0,
|
||||
ref_picture, pix_op, qpix_op,
|
||||
s->mv[dir][0][0], s->mv[dir][0][1], 16);
|
||||
} else if (!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) &&
|
||||
s->mspel && s->codec_id == AV_CODEC_ID_WMV2) {
|
||||
ff_mspel_motion(s, dest_y, dest_cb, dest_cr,
|
||||
ref_picture, pix_op,
|
||||
s->mv[dir][0][0], s->mv[dir][0][1], 16);
|
||||
} else {
|
||||
mpeg_motion(s, dest_y, dest_cb, dest_cr, 0,
|
||||
ref_picture, pix_op,
|
||||
s->mv[dir][0][0], s->mv[dir][0][1], 16, mb_y);
|
||||
}
|
||||
break;
|
||||
case MV_TYPE_8X8:
|
||||
if (!is_mpeg12)
|
||||
apply_8x8(s, dest_y, dest_cb, dest_cr,
|
||||
dir, ref_picture, qpix_op, pix_op);
|
||||
break;
|
||||
case MV_TYPE_FIELD:
|
||||
if (s->picture_structure == PICT_FRAME) {
|
||||
|
Loading…
Reference in New Issue
Block a user