[x264-devel] Fix b-pyramid MMCO remove for frame-packing==5
Anton Mitrofanov
git at videolan.org
Sun Jul 20 11:58:28 CEST 2014
x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Sat Jun 21 23:52:39 2014 +0400| [3fda920e6f1e4a8f76680c001962542866408114] | committer: Fiona Glaser
Fix b-pyramid MMCO remove for frame-packing==5
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=3fda920e6f1e4a8f76680c001962542866408114
---
encoder/encoder.c | 33 +++++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 8 deletions(-)
diff --git a/encoder/encoder.c b/encoder/encoder.c
index e484046..bf96f45 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -2154,6 +2154,31 @@ static inline void x264_reference_build_list( x264_t *h, int i_poc )
h->fref[1][h->i_ref[1]++] = h->frames.reference[i];
}
+ if( h->sh.i_mmco_remove_from_end )
+ {
+ /* Order ref0 for MMCO remove */
+ do
+ {
+ b_ok = 1;
+ for( int i = 0; i < h->i_ref[0] - 1; i++ )
+ {
+ if( h->fref[0][i]->i_frame < h->fref[0][i+1]->i_frame )
+ {
+ XCHG( x264_frame_t*, h->fref[0][i], h->fref[0][i+1] );
+ b_ok = 0;
+ break;
+ }
+ }
+ } while( !b_ok );
+
+ for( int i = h->i_ref[0]-1; i >= h->i_ref[0] - h->sh.i_mmco_remove_from_end; i-- )
+ {
+ int diff = h->i_frame_num - h->fref[0][i]->i_frame_num;
+ h->sh.mmco[h->sh.i_mmco_command_count].i_poc = h->fref[0][i]->i_poc;
+ h->sh.mmco[h->sh.i_mmco_command_count++].i_difference_of_pic_nums = diff;
+ }
+ }
+
/* Order reference lists by distance from the current frame. */
for( int list = 0; list < 2; list++ )
{
@@ -2176,14 +2201,6 @@ static inline void x264_reference_build_list( x264_t *h, int i_poc )
} while( !b_ok );
}
- if( h->sh.i_mmco_remove_from_end )
- for( int i = h->i_ref[0]-1; i >= h->i_ref[0] - h->sh.i_mmco_remove_from_end; i-- )
- {
- int diff = h->i_frame_num - h->fref[0][i]->i_frame_num;
- h->sh.mmco[h->sh.i_mmco_command_count].i_poc = h->fref[0][i]->i_poc;
- h->sh.mmco[h->sh.i_mmco_command_count++].i_difference_of_pic_nums = diff;
- }
-
x264_reference_check_reorder( h );
h->i_ref[1] = X264_MIN( h->i_ref[1], h->frames.i_max_ref1 );
More information about the x264-devel
mailing list