Ejemplo n.º 1
0
static void put_slice_header(void* regs)
{
	put_bits(regs, 3 << 5 | 5 << 0, 8);	// NAL Header

	put_ue(regs, 0);			// first_mb_in_slice
	put_ue(regs, 2);			// slice_type
	put_ue(regs, 0);			// pic_parameter_set_id
	put_bits(regs, 0, 4);			// frame_num

	// if (IdrPicFlag)
		put_ue(regs, 0);		// idr_pic_id

	// if (pic_order_cnt_type == 0)
		put_bits(regs, 0, 8);		// pic_order_cnt_lsb

	// dec_ref_pic_marking
		put_bits(regs, 0, 1);		// no_output_of_prior_pics_flag
		put_bits(regs, 0, 1);		// long_term_reference_flag

	put_se(regs, 4);			// slice_qp_delta

	// if (deblocking_filter_control_present_flag)
		put_ue(regs, 0);		// disable_deblocking_filter_idc
		// if (disable_deblocking_filter_idc != 1)
			put_se(regs, 0);	// slice_alpha_c0_offset_div2
			put_se(regs, 0);	// slice_beta_offset_div2
}
Ejemplo n.º 2
0
static void put_pic_parameter_set(h264enc *c)
{
	put_start_code(c->regs, 3, 8);

	put_ue(c->regs, /* pic_parameter_set_id = */ 0);
	put_ue(c->regs, /* seq_parameter_set_id = */ 0);

	put_bits(c->regs, c->entropy_coding_mode_flag, 1);

	put_bits(c->regs, /* bottom_field_pic_order_in_frame_present_flag = */ 0, 1);
	put_ue(c->regs, /* num_slice_groups_minus1 = */ 0);

	put_ue(c->regs, /* num_ref_idx_l0_default_active_minus1 = */ 0);
	put_ue(c->regs, /* num_ref_idx_l1_default_active_minus1 = */ 0);

	put_bits(c->regs, /* weighted_pred_flag = */ 0, 1);
	put_bits(c->regs, /* weighted_bipred_idc = */ 0, 2);

	put_se(c->regs, (int)c->pic_init_qp - 26);
	put_se(c->regs, (int)c->pic_init_qp - 26);
	put_se(c->regs, /* chroma_qp_index_offset = */ 4);

	put_bits(c->regs, /* deblocking_filter_control_present_flag = */ 1, 1);
	put_bits(c->regs, /* constrained_intra_pred_flag = */ 0, 1);
	put_bits(c->regs, /* redundant_pic_cnt_present_flag = */ 0, 1);

	put_rbsp_trailing_bits(c->regs);
}
Ejemplo n.º 3
0
static void put_pic_parameter_set(void *regs, int qp_minus30)
{
	put_bits(regs, 3 << 5 | 8 << 0, 8);	// NAL Header
	put_ue(regs, 0);			// pic_parameter_set_id
	put_ue(regs, 0);			// seq_parameter_set_id
	put_bits(regs, 1, 1);			// entropy_coding_mode_flag
	put_bits(regs, 0, 1);			// bottom_field_pic_order_in_frame_present_flag
	put_ue(regs, 0);			// num_slice_groups_minus1
	// if (num_slice_groups_minus1 > 0)

	put_ue(regs, 0);			// num_ref_idx_l0_default_active_minus1
	put_ue(regs, 0);			// num_ref_idx_l1_default_active_minus1
	put_bits(regs, 0, 1);			// weighted_pred_flag
	put_bits(regs, 0, 2);			// weighted_bipred_idc
	//put_se(regs, 0);			// pic_init_qp_minus26 (minus slice_qp_delta)
	//put_se(regs, 0);			// pic_init_qs_minus26
	put_se(regs, qp_minus30);		// pic_init_qp_minus26 (minus slice_qp_delta)
	put_se(regs, qp_minus30);		// pic_init_qs_minus26
	put_se(regs, 4);			// chroma_qp_index_offset
	put_bits(regs, 1, 1);			// deblocking_filter_control_present_flag
	put_bits(regs, 0, 1);			// constrained_intra_pred_flag
	put_bits(regs, 0, 1);			// redundant_pic_cnt_present_flag
}
Ejemplo n.º 4
0
static void put_slice_header(h264enc *c)
{
	if (c->current_slice_type == SLICE_I)
		put_start_code(c->regs, 3, 5);
	else
		put_start_code(c->regs, 2, 1);

	put_ue(c->regs, /* first_mb_in_slice = */ 0);
	put_ue(c->regs, c->current_slice_type);
	put_ue(c->regs, /* pic_parameter_set_id = */ 0);

	put_bits(c->regs, c->current_frame_num & 0xf, 4);

	if (c->current_slice_type == SLICE_I)
		put_ue(c->regs, /* idr_pic_id = */ 0);

	if (c->current_slice_type == SLICE_P)
	{
		put_bits(c->regs, /* num_ref_idx_active_override_flag = */ 0, 1);
		put_bits(c->regs, /* ref_pic_list_modification_flag_l0 = */ 0, 1);
		put_bits(c->regs, /* adaptive_ref_pic_marking_mode_flag = */ 0, 1);
		if (c->entropy_coding_mode_flag)
			put_ue(c->regs, /* cabac_init_idc = */ 0);
	}

	if (c->current_slice_type == SLICE_I)
	{
		put_bits(c->regs, /* no_output_of_prior_pics_flag = */ 0, 1);
		put_bits(c->regs, /* long_term_reference_flag = */ 0, 1);
	}

	put_se(c->regs, /* slice_qp_delta = */ 0);

	put_ue(c->regs, /* disable_deblocking_filter_idc = */ 0);
	put_se(c->regs, /* slice_alpha_c0_offset_div2 = */ 0);
	put_se(c->regs, /* slice_beta_offset_div2 = */ 0);
}