Commit 7091b47e authored by Loren Merritt's avatar Loren Merritt

use some extra packing modes for CQM headers.

fix typo in --cqm4p[yc].



git-svn-id: svn://svn.videolan.org/x264/trunk@392 df754926-b1dd-0310-bc7b-ec298dee348c
parent a977f764
......@@ -46,15 +46,31 @@ static void scaling_list_write( bs_t *s, x264_pps_t *pps, int idx )
const uint8_t *def_list = (idx==CQM_4IC) ? pps->scaling_list[CQM_4IY]
: (idx==CQM_4PC) ? pps->scaling_list[CQM_4PY]
: x264_cqm_jvt[idx];
int j;
if( memcmp( list, def_list, len ) )
if( !memcmp( list, def_list, len ) )
bs_write( s, 1, 0 ); // scaling_list_present_flag
else if( !memcmp( list, x264_cqm_jvt[idx], len ) )
{
bs_write( s, 1, 1 ); // scaling_list_present_flag
for( j = 0; j < len; j++ )
bs_write_se( s, list[zigzag[j]] - (j>0 ? list[zigzag[j-1]] : 8) ); // delta
bs_write_se( s, -8 ); // use jvt list
}
else
bs_write( s, 1, 0 ); // scaling_list_present_flag
{
int j, run;
bs_write( s, 1, 1 ); // scaling_list_present_flag
// try run-length compression of trailing values
for( run = len; run > 1; run-- )
if( list[zigzag[run-1]] != list[zigzag[run-2]] )
break;
if( run < len && len - run < bs_size_se( (int8_t)-list[zigzag[run]] ) )
run = len;
for( j = 0; j < run; j++ )
bs_write_se( s, (int8_t)(list[zigzag[j]] - (j>0 ? list[zigzag[j-1]] : 8)) ); // delta
if( run < len )
bs_write_se( s, (int8_t)-list[zigzag[run]] );
}
}
void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param )
......
......@@ -890,11 +890,11 @@ static int Parse( int argc, char **argv,
break;
case OPT_CQM4PY:
param->i_cqm_preset = X264_CQM_CUSTOM;
b_error |= parse_cqm( optarg, param->cqm_4iy, 16 );
b_error |= parse_cqm( optarg, param->cqm_4py, 16 );
break;
case OPT_CQM4PC:
param->i_cqm_preset = X264_CQM_CUSTOM;
b_error |= parse_cqm( optarg, param->cqm_4ic, 16 );
b_error |= parse_cqm( optarg, param->cqm_4pc, 16 );
break;
case OPT_CQM8I:
param->i_cqm_preset = X264_CQM_CUSTOM;
......
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