avcodec/h263: Move encoder-only part out of ff_h263_update_motion_val()

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2024-05-03 17:25:12 +02:00
parent bed17eba47
commit 2cbca73975
4 changed files with 17 additions and 12 deletions

View File

@@ -91,15 +91,6 @@ void ff_h263_update_motion_val(MpegEncContext * s){
s->current_picture.motion_val[0][xy + 1 + wrap][0] = motion_x;
s->current_picture.motion_val[0][xy + 1 + wrap][1] = motion_y;
}
if(s->encoding){ //FIXME encoding MUST be cleaned up
if (s->mv_type == MV_TYPE_8X8)
s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_8x8;
else if(s->mb_intra)
s->current_picture.mb_type[mb_xy] = MB_TYPE_INTRA;
else
s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_16x16;
}
}
void ff_h263_loop_filter(MpegEncContext * s){

View File

@@ -36,7 +36,7 @@ void ff_init_qscale_tab(MpegEncContext *s);
void ff_clean_h263_qscales(MpegEncContext *s);
void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code);
void ff_h263_update_mb(MpegEncContext *s);
static inline int h263_get_motion_length(int val, int f_code)
{

View File

@@ -688,6 +688,20 @@ void ff_h263_encode_mb(MpegEncContext * s,
}
}
void ff_h263_update_mb(MpegEncContext *s)
{
const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
if (s->mv_type == MV_TYPE_8X8)
s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_8x8;
else if(s->mb_intra)
s->current_picture.mb_type[mb_xy] = MB_TYPE_INTRA;
else
s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_16x16;
ff_h263_update_motion_val(s);
}
void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code)
{
int range, bit_size, sign, code, bits;

View File

@@ -3314,7 +3314,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
if (CONFIG_H263_ENCODER &&
s->out_format == FMT_H263 && s->pict_type!=AV_PICTURE_TYPE_B)
ff_h263_update_motion_val(s);
ff_h263_update_mb(s);
if(next_block==0){ //FIXME 16 vs linesize16
s->hdsp.put_pixels_tab[0][0](s->dest[0], s->sc.rd_scratchpad , s->linesize ,16);
@@ -3440,7 +3440,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
if (CONFIG_H263_ENCODER &&
s->out_format == FMT_H263 && s->pict_type!=AV_PICTURE_TYPE_B)
ff_h263_update_motion_val(s);
ff_h263_update_mb(s);
mpv_reconstruct_mb(s, s->block);
}