Slightly less memory usage.
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];
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 )
{
}
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 )
/* 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 )
{
}
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 );
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 )