History

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

Andreas Rheinhardt committed 2 years ago

Commit 2cbca731 parent bed17eb4 files · +17 −12Browse files

Showing the changes to libavcodec (4 of 4 files). Show all

Unified · Split

4 files
  1. libavcodec/h263.c +0 −9
  2. libavcodec/h263enc.h +1 −1
  3. libavcodec/ituh263enc.c +14 −0
  4. libavcodec/mpegvideo_enc.c +2 −2
libavcodec/h263.c+0−9
@@ -91,15 +91,6 @@ void ff_h263_update_motion_val(MpegEncContext * s){ · 90 unmodified lines
9191 s->current_picture.motion_val[0][xy + 1 + wrap][0] = motion_x;
9292 s->current_picture.motion_val[0][xy + 1 + wrap][1] = motion_y;
9393 }
94−
95− if(s->encoding){ //FIXME encoding MUST be cleaned up
96− if (s->mv_type == MV_TYPE_8X8)
97− s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_8x8;
98− else if(s->mb_intra)
99− s->current_picture.mb_type[mb_xy] = MB_TYPE_INTRA;
100− else
101− s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_16x16;
102− }
10394 }
10495
10596 void ff_h263_loop_filter(MpegEncContext * s){
libavcodec/h263enc.h+1−1
@@ -36,7 +36,7 @@ void ff_init_qscale_tab(MpegEncContext *s); · 35 unmodified lines
3636 void ff_clean_h263_qscales(MpegEncContext *s);
3737
3838 void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code);
39−
39+void ff_h263_update_mb(MpegEncContext *s);
4040
4141 static inline int h263_get_motion_length(int val, int f_code)
4242 {
libavcodec/ituh263enc.c+14−0
@@ -688,6 +688,20 @@ void ff_h263_encode_mb(MpegEncContext * s, · 687 unmodified lines
688688 }
689689 }
690690
691+void ff_h263_update_mb(MpegEncContext *s)
692+{
693+ const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
694+
695+ if (s->mv_type == MV_TYPE_8X8)
696+ s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_8x8;
697+ else if(s->mb_intra)
698+ s->current_picture.mb_type[mb_xy] = MB_TYPE_INTRA;
699+ else
700+ s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_16x16;
701+
702+ ff_h263_update_motion_val(s);
703+}
704+
691705 void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code)
692706 {
693707 int range, bit_size, sign, code, bits;
libavcodec/mpegvideo_enc.c+2−2
@@ -3314,7 +3314,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 3313 unmodified lines
33143314
33153315 if (CONFIG_H263_ENCODER &&
33163316 s->out_format == FMT_H263 && s->pict_type!=AV_PICTURE_TYPE_B)
3317− ff_h263_update_motion_val(s);
3317+ ff_h263_update_mb(s);
33183318
33193319 if(next_block==0){ //FIXME 16 vs linesize16
33203320 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){ · 119 unmodified lines
34403440
34413441 if (CONFIG_H263_ENCODER &&
34423442 s->out_format == FMT_H263 && s->pict_type!=AV_PICTURE_TYPE_B)
3443− ff_h263_update_motion_val(s);
3443+ ff_h263_update_mb(s);
34443444
34453445 mpv_reconstruct_mb(s, s->block);
34463446 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t