[x264-devel] Avoid some unnecessary allocations with B-frames/CABAC off
Jason Garrett-Glaser
git at videolan.org
Wed Aug 24 22:40:18 CEST 2011
x264 | branch: master | Jason Garrett-Glaser <jason at x264.com> | Tue Aug 16 13:02:24 2011 -0700| [6881f2475a98dca0de8b33e18223d9341f90fb12] | committer: Jason Garrett-Glaser
Avoid some unnecessary allocations with B-frames/CABAC off
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=6881f2475a98dca0de8b33e18223d9341f90fb12
---
common/macroblock.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/common/macroblock.c b/common/macroblock.c
index 2a65dc2..6b5779e 100644
--- a/common/macroblock.c
+++ b/common/macroblock.c
@@ -247,7 +247,6 @@ int x264_macroblock_cache_allocate( x264_t *h )
CHECKED_MALLOC( h->mb.qp, i_mb_count * sizeof(int8_t) );
CHECKED_MALLOC( h->mb.cbp, i_mb_count * sizeof(int16_t) );
- CHECKED_MALLOC( h->mb.skipbp, i_mb_count * sizeof(int8_t) );
CHECKED_MALLOC( h->mb.mb_transform_size, i_mb_count * sizeof(int8_t) );
CHECKED_MALLOC( h->mb.slice_table, i_mb_count * sizeof(uint16_t) );
memset( h->mb.slice_table, -1, i_mb_count * sizeof(uint16_t) );
@@ -260,9 +259,11 @@ int x264_macroblock_cache_allocate( x264_t *h )
if( h->param.b_cabac )
{
+ CHECKED_MALLOC( h->mb.skipbp, i_mb_count * sizeof(int8_t) );
CHECKED_MALLOC( h->mb.chroma_pred_mode, i_mb_count * sizeof(int8_t) );
CHECKED_MALLOC( h->mb.mvd[0], i_mb_count * sizeof( **h->mb.mvd ) );
- CHECKED_MALLOC( h->mb.mvd[1], i_mb_count * sizeof( **h->mb.mvd ) );
+ if( h->param.i_bframe )
+ CHECKED_MALLOC( h->mb.mvd[1], i_mb_count * sizeof( **h->mb.mvd ) );
}
for( int i = 0; i < 2; i++ )
@@ -329,6 +330,7 @@ void x264_macroblock_cache_free( x264_t *h )
if( h->param.b_cabac )
{
+ x264_free( h->mb.skipbp );
x264_free( h->mb.chroma_pred_mode );
x264_free( h->mb.mvd[0] );
x264_free( h->mb.mvd[1] );
@@ -337,7 +339,6 @@ void x264_macroblock_cache_free( x264_t *h )
x264_free( h->mb.intra4x4_pred_mode );
x264_free( h->mb.non_zero_count );
x264_free( h->mb.mb_transform_size );
- x264_free( h->mb.skipbp );
x264_free( h->mb.cbp );
x264_free( h->mb.qp );
}
More information about the x264-devel
mailing list