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
91 s->current_picture.motion_val[0][xy + 1 + wrap][0] = motion_x;91 s->current_picture.motion_val[0][xy + 1 + wrap][0] = motion_x;
92 s->current_picture.motion_val[0][xy + 1 + wrap][1] = motion_y;92 s->current_picture.motion_val[0][xy + 1 + wrap][1] = motion_y;
93 }93 }
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 }
103}94}
104 95
105void ff_h263_loop_filter(MpegEncContext * s){96void 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
36void ff_clean_h263_qscales(MpegEncContext *s);36void ff_clean_h263_qscales(MpegEncContext *s);
37 37
38void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code);38void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code);
39 39void ff_h263_update_mb(MpegEncContext *s);
40 40
41static inline int h263_get_motion_length(int val, int f_code)41static inline int h263_get_motion_length(int val, int f_code)
42{42{
libavcodec/ituh263enc.c+14−0
@@ -688,6 +688,20 @@ void ff_h263_encode_mb(MpegEncContext * s, · 687 unmodified lines
688 }688 }
689}689}
690 690
691void 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
691void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code)705void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code)
692{706{
693 int range, bit_size, sign, code, bits;707 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
3314 3314
3315 if (CONFIG_H263_ENCODER &&3315 if (CONFIG_H263_ENCODER &&
3316 s->out_format == FMT_H263 && s->pict_type!=AV_PICTURE_TYPE_B)3316 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);
3318 3318
3319 if(next_block==0){ //FIXME 16 vs linesize163319 if(next_block==0){ //FIXME 16 vs linesize16
3320 s->hdsp.put_pixels_tab[0][0](s->dest[0], s->sc.rd_scratchpad , s->linesize ,16);3320 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
3440 3440
3441 if (CONFIG_H263_ENCODER &&3441 if (CONFIG_H263_ENCODER &&
3442 s->out_format == FMT_H263 && s->pict_type!=AV_PICTURE_TYPE_B)3442 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);
3444 3444
3445 mpv_reconstruct_mb(s, s->block);3445 mpv_reconstruct_mb(s, s->block);
3446 }3446 }

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