100
100
for( int p = 0; p < (CHROMA444 ? 3 : 1); p++ )
101
101
for( int y = 0; y < h->param.i_height; y++ )
102
102
fwrite( &h->fdec->plane[p][y*h->fdec->i_stride[p]], sizeof(pixel), h->param.i_width, f );
103
if( CHROMA_FORMAT == CHROMA_420 || CHROMA_FORMAT == CHROMA_422 )
105
105
int cw = h->param.i_width>>1;
106
106
int ch = h->param.i_height>>CHROMA_V_SHIFT;
294
294
sh->b_weighted_pred = sh->weight[0][0].weightfn || sh->weight[0][1].weightfn || sh->weight[0][2].weightfn;
295
295
/* pred_weight_table() */
296
bs_write_ue( s, sh->weight[0][0].i_denom );
297
bs_write_ue( s, sh->weight[0][1].i_denom );
296
bs_write_ue( s, sh->weight[0][0].i_denom ); /* luma_log2_weight_denom */
297
if( sh->sps->i_chroma_format_idc )
298
bs_write_ue( s, sh->weight[0][1].i_denom ); /* chroma_log2_weight_denom */
298
299
for( int i = 0; i < sh->i_num_ref_idx_l0_active; i++ )
300
301
int luma_weight_l0_flag = !!sh->weight[i][0].weightfn;
301
int chroma_weight_l0_flag = !!sh->weight[i][1].weightfn || !!sh->weight[i][2].weightfn;
302
302
bs_write1( s, luma_weight_l0_flag );
303
303
if( luma_weight_l0_flag )
305
305
bs_write_se( s, sh->weight[i][0].i_scale );
306
306
bs_write_se( s, sh->weight[i][0].i_offset );
308
bs_write1( s, chroma_weight_l0_flag );
309
if( chroma_weight_l0_flag )
308
if( sh->sps->i_chroma_format_idc )
311
for( int j = 1; j < 3; j++ )
310
int chroma_weight_l0_flag = sh->weight[i][1].weightfn || sh->weight[i][2].weightfn;
311
bs_write1( s, chroma_weight_l0_flag );
312
if( chroma_weight_l0_flag )
313
bs_write_se( s, sh->weight[i][j].i_scale );
314
bs_write_se( s, sh->weight[i][j].i_offset );
314
for( int j = 1; j < 3; j++ )
316
bs_write_se( s, sh->weight[i][j].i_scale );
317
bs_write_se( s, sh->weight[i][j].i_offset );
476
480
int i_csp = h->param.i_csp & X264_CSP_MASK;
477
481
#if X264_CHROMA_FORMAT
478
if( CHROMA_FORMAT != CHROMA_420 && i_csp >= X264_CSP_I420 && i_csp < X264_CSP_I422 )
482
if( CHROMA_FORMAT != CHROMA_400 && i_csp == X264_CSP_I400 )
484
x264_log( h, X264_LOG_ERROR, "not compiled with 4:0:0 support\n" );
487
else if( CHROMA_FORMAT != CHROMA_420 && i_csp >= X264_CSP_I420 && i_csp < X264_CSP_I422 )
480
489
x264_log( h, X264_LOG_ERROR, "not compiled with 4:2:0 support\n" );
494
503
if( i_csp <= X264_CSP_NONE || i_csp >= X264_CSP_MAX )
496
x264_log( h, X264_LOG_ERROR, "invalid CSP (only I420/YV12/NV12/NV21/I422/YV16/NV16/YUYV/UYVY/"
505
x264_log( h, X264_LOG_ERROR, "invalid CSP (only I400/I420/YV12/NV12/NV21/I422/YV16/NV16/YUYV/UYVY/"
497
506
"I444/YV24/BGR/BGRA/RGB supported)\n" );
501
int w_mod = i_csp < X264_CSP_I444 ? 2 : 1;
502
int h_mod = (i_csp < X264_CSP_I422 ? 2 : 1) << PARAM_INTERLACED;
511
int h_mod = 1 << PARAM_INTERLACED;
512
if( i_csp == X264_CSP_I400 )
514
h->param.analyse.i_chroma_qp_offset = 0;
515
h->param.analyse.b_chroma_me = 0;
516
h->param.vui.i_colmatrix = 2; /* undefined */
518
else if( i_csp < X264_CSP_I444 )
521
if( i_csp < X264_CSP_I422 )
503
525
if( h->param.i_width % w_mod )
505
527
x264_log( h, X264_LOG_ERROR, "width not divisible by %d (%dx%d)\n",
1737
1762
(h->sps->i_profile_idc == PROFILE_BASELINE || h->sps->i_profile_idc == PROFILE_MAIN) ) )
1738
1763
strcpy( level, "1b" );
1740
if( h->sps->i_profile_idc < PROFILE_HIGH10 )
1742
x264_log( h, X264_LOG_INFO, "profile %s, level %s\n",
1747
static const char * const subsampling[4] = { "4:0:0", "4:2:0", "4:2:2", "4:4:4" };
1748
x264_log( h, X264_LOG_INFO, "profile %s, level %s, %s %d-bit\n",
1749
profile, level, subsampling[CHROMA_FORMAT], BIT_DEPTH );
1765
static const char * const subsampling[4] = { "4:0:0", "4:2:0", "4:2:2", "4:4:4" };
1766
x264_log( h, X264_LOG_INFO, "profile %s, level %s, %s, %d-bit\n",
1767
profile, level, subsampling[CHROMA_FORMAT], BIT_DEPTH );
4256
int csize = CHROMA444 ? 4 : 1;
4257
if( i_mb_count != i_all_intra )
4258
sprintf( buf, " inter: %.1f%% %.1f%% %.1f%%",
4259
h->stat.i_mb_cbp[1] * 100.0 / ((i_mb_count - i_all_intra)*4),
4260
h->stat.i_mb_cbp[3] * 100.0 / ((i_mb_count - i_all_intra)*csize),
4261
h->stat.i_mb_cbp[5] * 100.0 / ((i_mb_count - i_all_intra)*csize) );
4262
x264_log( h, X264_LOG_INFO, "coded y,%s,%s intra: %.1f%% %.1f%% %.1f%%%s\n",
4263
CHROMA444?"u":"uvDC", CHROMA444?"v":"uvAC",
4264
h->stat.i_mb_cbp[0] * 100.0 / (i_all_intra*4),
4265
h->stat.i_mb_cbp[2] * 100.0 / (i_all_intra*csize),
4266
h->stat.i_mb_cbp[4] * 100.0 / (i_all_intra*csize), buf );
4275
int csize = CHROMA444 ? 4 : 1;
4276
if( i_mb_count != i_all_intra )
4277
sprintf( buf, " inter: %.1f%% %.1f%% %.1f%%",
4278
h->stat.i_mb_cbp[1] * 100.0 / ((i_mb_count - i_all_intra)*4),
4279
h->stat.i_mb_cbp[3] * 100.0 / ((i_mb_count - i_all_intra)*csize),
4280
h->stat.i_mb_cbp[5] * 100.0 / ((i_mb_count - i_all_intra)*csize) );
4281
x264_log( h, X264_LOG_INFO, "coded y,%s,%s intra: %.1f%% %.1f%% %.1f%%%s\n",
4282
CHROMA444?"u":"uvDC", CHROMA444?"v":"uvAC",
4283
h->stat.i_mb_cbp[0] * 100.0 / (i_all_intra*4),
4284
h->stat.i_mb_cbp[2] * 100.0 / (i_all_intra*csize),
4285
h->stat.i_mb_cbp[4] * 100.0 / (i_all_intra*csize), buf );
4289
if( i_mb_count != i_all_intra )
4290
sprintf( buf, " inter: %.1f%%", h->stat.i_mb_cbp[1] * 100.0 / ((i_mb_count - i_all_intra)*4) );
4291
x264_log( h, X264_LOG_INFO, "coded y intra: %.1f%%%s\n",
4292
h->stat.i_mb_cbp[0] * 100.0 / (i_all_intra*4), buf );
4268
4295
int64_t fixed_pred_modes[4][9] = {{0}};
4269
4296
int64_t sum_pred_modes[4] = {0};
4310
4337
fixed_pred_modes[3][3] * 100.0 / sum_pred_modes[3] );
4312
4339
if( h->param.analyse.i_weighted_pred >= X264_WEIGHTP_SIMPLE && h->stat.i_frame_count[SLICE_TYPE_P] > 0 )
4313
x264_log( h, X264_LOG_INFO, "Weighted P-Frames: Y:%.1f%% UV:%.1f%%\n",
4314
h->stat.i_wpred[0] * 100.0 / h->stat.i_frame_count[SLICE_TYPE_P],
4315
h->stat.i_wpred[1] * 100.0 / h->stat.i_frame_count[SLICE_TYPE_P] );
4343
sprintf( buf, " UV:%.1f%%", h->stat.i_wpred[1] * 100.0 / h->stat.i_frame_count[SLICE_TYPE_P] );
4344
x264_log( h, X264_LOG_INFO, "Weighted P-Frames: Y:%.1f%%%s\n",
4345
h->stat.i_wpred[0] * 100.0 / h->stat.i_frame_count[SLICE_TYPE_P], buf );
4317
4348
for( int i_list = 0; i_list < 2; i_list++ )
4318
4349
for( int i_slice = 0; i_slice < 2; i_slice++ )