int b_pic_order;
int i_num_slice_groups;
- int i_num_ref_idx_l0_active;
- int i_num_ref_idx_l1_active;
+ int i_num_ref_idx_l0_default_active;
+ int i_num_ref_idx_l1_default_active;
int b_weighted_pred;
int b_weighted_bipred;
{
x264_slice_header_init( h, &h->sh, h->sps, h->pps, -1, h->i_frame_num, i_global_qp );
- /* always set the real higher num of ref frame used */
- h->sh.b_num_ref_idx_override = 1;
h->sh.i_num_ref_idx_l0_active = h->i_ref0 <= 0 ? 1 : h->i_ref0;
h->sh.i_num_ref_idx_l1_active = h->i_ref1 <= 0 ? 1 : h->i_ref1;
+ if( h->sh.i_num_ref_idx_l0_active != h->pps->i_num_ref_idx_l0_default_active ||
+ (h->sh.i_type == SLICE_TYPE_B && h->sh.i_num_ref_idx_l1_active != h->pps->i_num_ref_idx_l1_default_active) )
+ {
+ h->sh.b_num_ref_idx_override = 1;
+ }
}
h->fdec->i_frame_num = h->sh.i_frame_num;
pps->b_pic_order = param->b_interlaced;
pps->i_num_slice_groups = 1;
- pps->i_num_ref_idx_l0_active = 1;
- pps->i_num_ref_idx_l1_active = 1;
+ pps->i_num_ref_idx_l0_default_active = param->i_frame_reference;
+ pps->i_num_ref_idx_l1_default_active = 1;
pps->b_weighted_pred = param->analyse.i_weighted_pred > 0;
pps->b_weighted_bipred = param->analyse.b_weighted_bipred ? 2 : 0;
bs_write( s, 1, pps->b_pic_order );
bs_write_ue( s, pps->i_num_slice_groups - 1 );
- bs_write_ue( s, pps->i_num_ref_idx_l0_active - 1 );
- bs_write_ue( s, pps->i_num_ref_idx_l1_active - 1 );
+ bs_write_ue( s, pps->i_num_ref_idx_l0_default_active - 1 );
+ bs_write_ue( s, pps->i_num_ref_idx_l1_default_active - 1 );
bs_write( s, 1, pps->b_weighted_pred );
bs_write( s, 2, pps->b_weighted_bipred );