Commit f4186f5e authored by Fiona Glaser's avatar Fiona Glaser

Merge nnz_backup with scratch buffer

Slightly less memory usage.
parent ee911101
......@@ -532,7 +532,6 @@ struct x264_t
int8_t *skipbp; /* block pattern for SKIP or DIRECT (sub)mbs. B-frames + cabac only */
int8_t *mb_transform_size; /* transform_size_8x8_flag of each mb */
uint8_t *intra_border_backup[2][3]; /* bottom pixels of the previous mb row, used for intra prediction after the framebuffer has been deblocked */
uint8_t (*nnz_backup)[16]; /* when using cavlc + 8x8dct, the deblocker uses a modified nnz */
/* buffer for weighted versions of the reference frames */
uint8_t *p_weight_buf[16];
......
......@@ -661,9 +661,10 @@ void x264_frame_deblock_row( x264_t *h, int mb_y )
int stride2y = stridey << b_interlaced;
int strideuv = h->fdec->i_stride[1];
int stride2uv = strideuv << b_interlaced;
uint8_t (*nnz_backup)[16] = h->scratch_buffer;
if( !h->pps->b_cabac && h->pps->b_transform_8x8_mode )
munge_cavlc_nnz( h, mb_y, h->mb.nnz_backup, munge_cavlc_nnz_row );
munge_cavlc_nnz( h, mb_y, nnz_backup, munge_cavlc_nnz_row );
for( mb_x = 0; mb_x < h->sps->i_mb_width; mb_x += (~b_interlaced | mb_y)&1, mb_y ^= b_interlaced )
{
......@@ -823,7 +824,7 @@ void x264_frame_deblock_row( x264_t *h, int mb_y )
}
if( !h->pps->b_cabac && h->pps->b_transform_8x8_mode )
munge_cavlc_nnz( h, mb_y, h->mb.nnz_backup, restore_cavlc_nnz_row );
munge_cavlc_nnz( h, mb_y, nnz_backup, restore_cavlc_nnz_row );
}
void x264_frame_deblock( x264_t *h )
......
......@@ -701,7 +701,6 @@ int x264_macroblock_cache_init( x264_t *h )
/* all coeffs */
CHECKED_MALLOC( h->mb.non_zero_count, i_mb_count * 24 * sizeof(uint8_t) );
CHECKED_MALLOC( h->mb.nnz_backup, h->sps->i_mb_width * 4 * 16 * sizeof(uint8_t) );
if( h->param.b_cabac )
{
......@@ -797,7 +796,6 @@ void x264_macroblock_cache_end( x264_t *h )
}
x264_free( h->mb.intra4x4_pred_mode );
x264_free( h->mb.non_zero_count );
x264_free( h->mb.nnz_backup );
x264_free( h->mb.mb_transform_size );
x264_free( h->mb.skipbp );
x264_free( h->mb.cbp );
......
......@@ -1018,7 +1018,9 @@ x264_t *x264_encoder_open( x264_param_t *param )
int buf_tesa = (h->param.analyse.i_me_method >= X264_ME_ESA) *
((me_range*2+18) * sizeof(int16_t) + (me_range+4) * (me_range+1) * 4 * sizeof(mvsad_t));
int buf_mbtree = h->param.rc.b_mb_tree * ((h->sps->i_mb_width+3)&~3) * sizeof(int);
CHECKED_MALLOC( h->thread[i]->scratch_buffer, X264_MAX4( buf_hpel, buf_ssim, buf_tesa, buf_mbtree ) );
int buf_nnz = !h->param.b_cabac * h->pps->b_transform_8x8_mode * (h->sps->i_mb_width * 4 * 16 * sizeof(uint8_t));
int scratch_size = X264_MAX4( buf_hpel, buf_ssim, buf_tesa, X264_MAX( buf_mbtree, buf_nnz ) );
CHECKED_MALLOC( h->thread[i]->scratch_buffer, scratch_size );
}
if( x264_ratecontrol_new( h ) < 0 )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment