param->analyse.i_chroma_qp_offset = 0;
param->analyse.b_fast_pskip = 1;
param->analyse.b_dct_decimate = 1;
+ param->analyse.i_luma_deadzone[0] = 21;
+ param->analyse.i_luma_deadzone[1] = 11;
param->analyse.b_psnr = 1;
param->analyse.b_ssim = 1;
p->analyse.b_fast_pskip = atobool(value);
OPT("dct-decimate")
p->analyse.b_dct_decimate = atobool(value);
+ OPT("deadzone-inter")
+ p->analyse.i_luma_deadzone[0] = atoi(value);
+ OPT("deadzone-intra")
+ p->analyse.i_luma_deadzone[1] = atoi(value);
OPT("nr")
p->analyse.i_noise_reduction = atoi(value);
OPT("bitrate")
s += sprintf( s, " trellis=%d", p->analyse.i_trellis );
s += sprintf( s, " 8x8dct=%d", p->analyse.b_transform_8x8 );
s += sprintf( s, " cqm=%d", p->i_cqm_preset );
+ s += sprintf( s, " deadzone=%d,%d", p->analyse.i_luma_deadzone[0], p->analyse.i_luma_deadzone[1] );
s += sprintf( s, " chroma_qp_offset=%d", p->analyse.i_chroma_qp_offset );
s += sprintf( s, " slices=%d", p->i_threads );
s += sprintf( s, " nr=%d", p->analyse.i_noise_reduction );
s += sprintf( s, " decimate=%d", p->analyse.b_dct_decimate );
+ s += sprintf( s, " mbaff=%d", p->b_interlaced );
s += sprintf( s, " bframes=%d", p->i_bframe );
if( p->i_bframe )
int b_interlaced;
+ /* Inverted luma quantization deadzone */
+ int i_luma_deadzone[2]; // {inter, intra}
+
/* Allowed qpel MV range to stay within the picture + emulated edge pixels */
int mv_min[2];
int mv_max[2];
h->param.i_deblocking_filter_alphac0 = x264_clip3( h->param.i_deblocking_filter_alphac0, -6, 6 );
h->param.i_deblocking_filter_beta = x264_clip3( h->param.i_deblocking_filter_beta, -6, 6 );
+ h->param.analyse.i_luma_deadzone[0] = x264_clip3( h->param.analyse.i_luma_deadzone[0], 0, 32 );
+ h->param.analyse.i_luma_deadzone[1] = x264_clip3( h->param.analyse.i_luma_deadzone[1], 0, 32 );
+ h->mb.i_luma_deadzone[0] = 32 - h->param.analyse.i_luma_deadzone[0];
+ h->mb.i_luma_deadzone[1] = 32 - h->param.analyse.i_luma_deadzone[1];
h->param.i_cabac_init_idc = x264_clip3( h->param.i_cabac_init_idc, 0, 2 );
{
const int i_qbits = 16 + i_qscale / 6;
const int i_mf = i_qscale % 6;
- const int f = ( 1 << (i_qbits + b_intra) ) / 6;
+ const int f = h->mb.i_luma_deadzone[b_intra] << (i_qbits-6);
h->quantf.quant_8x8_core( dct, quant_mf[i_mf], i_qbits, f );
}
static void quant_4x4( x264_t *h, int16_t dct[4][4], int quant_mf[6][4][4], int i_qscale, int b_intra )
+{
+ const int i_qbits = 15 + i_qscale / 6;
+ const int i_mf = i_qscale % 6;
+ const int f = h->mb.i_luma_deadzone[b_intra] << (i_qbits-6);
+ h->quantf.quant_4x4_core( dct, quant_mf[i_mf], i_qbits, f );
+}
+static void quant_4x4_chroma( x264_t *h, int16_t dct[4][4], int quant_mf[6][4][4], int i_qscale, int b_intra )
{
const int i_qbits = 15 + i_qscale / 6;
const int i_mf = i_qscale % 6;
{
const int i_qbits = 16 + i_qscale / 6;
const int i_mf = i_qscale % 6;
- const int f = ( 1 << i_qbits ) / 3;
+ const int f = h->mb.i_luma_deadzone[1] << (i_qbits-6);
h->quantf.quant_4x4_dc_core( dct, quant_mf[i_mf][0][0], i_qbits, f );
}
static void quant_2x2_dc( x264_t *h, int16_t dct[2][2], int quant_mf[6][4][4], int i_qscale, int b_intra )
dct2x2[block_idx_y[i]][block_idx_x[i]] = dct4x4[i][0][0];
/* no trellis; it doesn't seem to help chroma noticeably */
- quant_4x4( h, dct4x4[i], h->quant4_mf[CQM_4IC + b_inter], i_qscale, !b_inter );
+ quant_4x4_chroma( h, dct4x4[i], h->quant4_mf[CQM_4IC + b_inter], i_qscale, !b_inter );
h->zigzagf.scan_4x4ac( h->dct.block[16+i+ch*4].residual_ac, dct4x4[i] );
if( b_decimate )
/* calculate dct coeffs */
for( i4x4 = 0, i_decimate_mb = 0; i4x4 < 4; i4x4++ )
{
- quant_4x4( h, dct4x4[i4x4], (int(*)[4][4])def_quant4_mf, i_qp, 0 );
+ quant_4x4_chroma( h, dct4x4[i4x4], (int(*)[4][4])def_quant4_mf, i_qp, 0 );
h->zigzagf.scan_4x4ac( dctscan, dct4x4[i4x4] );
i_decimate_mb += x264_mb_decimate_score( dctscan, 15 );
p_fdec = h->mb.pic.p_fdec[1+ch] + (i8&1)*4 + (i8>>1)*4*FDEC_STRIDE;
h->dctf.sub4x4_dct( dct4x4, p_fenc, p_fdec );
- quant_4x4( h, dct4x4, h->quant4_mf[CQM_4PC], i_qp, 0 );
+ quant_4x4_chroma( h, dct4x4, h->quant4_mf[CQM_4PC], i_qp, 0 );
h->zigzagf.scan_4x4ac( h->dct.block[16+i8+ch*4].residual_ac, dct4x4 );
if( array_non_zero( (int*)dct4x4, sizeof(dct4x4)/sizeof(int) ) )
{
H0( " --no-dct-decimate Disables coefficient thresholding on P-frames\n" );
H0( " --nr <integer> Noise reduction [%d]\n", defaults->analyse.i_noise_reduction );
H1( "\n" );
+ H1( " --deadzone-inter <int> Set the size of the inter luma quantization deadzone [%d]\n", defaults->analyse.i_luma_deadzone[0] );
+ H1( " --deadzone-intra <int> Set the size of the intra luma quantization deadzone [%d]\n", defaults->analyse.i_luma_deadzone[1] );
+ H1( " Deadzones should be in the range 0 - 32.\n" );
H1( " --cqm <string> Preset quant matrices [\"flat\"]\n"
" - jvt, flat\n" );
H0( " --cqmfile <string> Read custom quant matrices from a JM-compatible file\n" );
{ "trellis", required_argument, NULL, 't' },
{ "no-fast-pskip", no_argument, NULL, 0 },
{ "no-dct-decimate", no_argument, NULL, 0 },
+ { "deadzone-inter", required_argument, NULL, '0' },
+ { "deadzone-intra", required_argument, NULL, '0' },
{ "level", required_argument, NULL, 0 },
{ "ratetol", required_argument, NULL, 0 },
{ "vbv-maxrate", required_argument, NULL, 0 },
int b_dct_decimate; /* transform coefficient thresholding on P-frames */
int i_noise_reduction; /* adaptive pseudo-deadzone */
+ /* the deadzone size that will be used in luma quantization */
+ int i_luma_deadzone[2]; // {inter, intra}
+
int b_psnr; /* compute and print PSNR stats */
int b_ssim; /* compute and print SSIM stats */
} analyse;