quant8_mf[i_list][q][i] = DIV(def_quant8[q][i] * 16, h->sps->scaling_list[4+i_list][i]);
}
}
+
+#define MAX_MF X264_MIN( 0xffff, (1 << (25 - BIT_DEPTH)) - 1 )
+
for( int q = 0; q <= QP_MAX_SPEC; q++ )
{
int j;
// round to nearest, unless that would cause the deadzone to be negative
h->quant4_bias[i_list][q][i] = X264_MIN( DIV(deadzone[i_list]<<10, j), (1<<15)/j );
h->quant4_bias0[i_list][q][i] = (1<<15)/j;
- if( j > 0xffff && q > max_qp_err && (i_list == CQM_4IY || i_list == CQM_4PY) )
+ if( j > MAX_MF && q > max_qp_err && (i_list == CQM_4IY || i_list == CQM_4PY) )
max_qp_err = q;
- if( j > 0xffff && q > max_chroma_qp_err && (i_list == CQM_4IC || i_list == CQM_4PC) )
+ if( j > MAX_MF && q > max_chroma_qp_err && (i_list == CQM_4IC || i_list == CQM_4PC) )
max_chroma_qp_err = q;
}
if( h->param.analyse.b_transform_8x8 )
}
h->quant8_bias[i_list][q][i] = X264_MIN( DIV(deadzone[i_list]<<10, j), (1<<15)/j );
h->quant8_bias0[i_list][q][i] = (1<<15)/j;
- if( j > 0xffff && q > max_qp_err && (i_list == CQM_8IY || i_list == CQM_8PY) )
+ if( j > MAX_MF && q > max_qp_err && (i_list == CQM_8IY || i_list == CQM_8PY) )
max_qp_err = q;
- if( j > 0xffff && q > max_chroma_qp_err && (i_list == CQM_8IC || i_list == CQM_8PC) )
+ if( j > MAX_MF && q > max_chroma_qp_err && (i_list == CQM_8IC || i_list == CQM_8PC) )
max_chroma_qp_err = q;
}
}
h->param.analyse.i_luma_deadzone[0] = 0;
h->param.analyse.i_luma_deadzone[1] = 0;
h->param.analyse.b_transform_8x8 = 1;
- for( int i = 0; i < 6; i++ )
+ for( int i = 0; i < 8; i++ )
h->sps->scaling_list[i] = x264_cqm_flat16;
x264_cqm_init( h );
x264_quant_init( h, 0, &qf );
h->chroma_qp_table = i_chroma_qp_table + 12;
h->param.analyse.b_transform_8x8 = 1;
- for( int i_cqm = 0; i_cqm < 4; i_cqm++ )
+ static const uint8_t cqm_test4[16] =
+ {
+ 6,4,6,4,
+ 4,3,4,3,
+ 6,4,6,4,
+ 4,3,4,3
+ };
+ static const uint8_t cqm_test8[64] =
+ {
+ 3,3,4,3,3,3,4,3,
+ 3,3,4,3,3,3,4,3,
+ 4,4,5,4,4,4,5,4,
+ 3,3,4,3,3,3,4,3,
+ 3,3,4,3,3,3,4,3,
+ 3,3,4,3,3,3,4,3,
+ 4,4,5,4,4,4,5,4,
+ 3,3,4,3,3,3,4,3
+ };
+
+ for( int i_cqm = 0; i_cqm < 6; i_cqm++ )
{
if( i_cqm == 0 )
{
- for( int i = 0; i < 6; i++ )
+ for( int i = 0; i < 8; i++ )
h->sps->scaling_list[i] = x264_cqm_flat16;
h->param.i_cqm_preset = h->sps->i_cqm_preset = X264_CQM_FLAT;
}
else if( i_cqm == 1 )
{
- for( int i = 0; i < 6; i++ )
+ for( int i = 0; i < 8; i++ )
h->sps->scaling_list[i] = x264_cqm_jvt[i];
h->param.i_cqm_preset = h->sps->i_cqm_preset = X264_CQM_JVT;
}
+ else if( i_cqm == 2 )
+ {
+ for( int i = 0; i < 4; i++ )
+ h->sps->scaling_list[i] = cqm_test4;
+ for( int i = 4; i < 8; i++ )
+ h->sps->scaling_list[i] = x264_cqm_flat16;
+ h->param.i_cqm_preset = h->sps->i_cqm_preset = X264_CQM_CUSTOM;
+ }
+ else if( i_cqm == 3 )
+ {
+ for( int i = 0; i < 4; i++ )
+ h->sps->scaling_list[i] = x264_cqm_flat16;
+ for( int i = 4; i < 8; i++ )
+ h->sps->scaling_list[i] = cqm_test8;
+ h->param.i_cqm_preset = h->sps->i_cqm_preset = X264_CQM_CUSTOM;
+ }
else
{
int max_scale = BIT_DEPTH < 10 ? 255 : 228;
- if( i_cqm == 2 )
+ if( i_cqm == 4 )
for( int i = 0; i < 64; i++ )
cqm_buf[i] = 10 + rand() % (max_scale - 9);
else
for( int i = 0; i < 64; i++ )
cqm_buf[i] = 1;
- for( int i = 0; i < 6; i++ )
+ for( int i = 0; i < 8; i++ )
h->sps->scaling_list[i] = cqm_buf;
h->param.i_cqm_preset = h->sps->i_cqm_preset = X264_CQM_CUSTOM;
}
static const int scale1d[8] = {32,31,24,31,32,31,24,31}; \
for( int i = 0; i < max; i++ ) \
{ \
- unsigned int scale = (255*scale1d[(i>>3)&7]*scale1d[i&7])/16; \
- dct1[i] = dct2[i] = (j>>(i>>6))&1 ? (rand()%(2*scale+1))-scale : 0; \
+ int scale = (PIXEL_MAX*scale1d[(i>>3)&7]*scale1d[i&7])/16; \
+ dct1[i] = dct2[i] = (j>>(i>>6))&1 ? (rand30()%(2*scale+1))-scale : 0; \
} \
}
static const int scale1d[4] = {4,6,4,6}; \
for( int i = 0; i < max; i++ ) \
{ \
- unsigned int scale = 255*scale1d[(i>>2)&3]*scale1d[i&3]; \
- dct1[i] = dct2[i] = (j>>(i>>4))&1 ? (rand()%(2*scale+1))-scale : 0; \
+ int scale = PIXEL_MAX*scale1d[(i>>2)&3]*scale1d[i&3]; \
+ dct1[i] = dct2[i] = (j>>(i>>4))&1 ? (rand30()%(2*scale+1))-scale : 0; \
} \
}