Prefix NAL unit type enum constants with KVZ_.

This commit is contained in:
Arttu Ylä-Outinen 2015-09-15 10:19:31 +03:00
parent 4e5c7fe6e8
commit 1c898a2f4a
3 changed files with 56 additions and 46 deletions

View file

@ -31,7 +31,7 @@
static void encoder_state_write_bitstream_aud(encoder_state_t * const state) static void encoder_state_write_bitstream_aud(encoder_state_t * const state)
{ {
bitstream_t * const stream = &state->stream; bitstream_t * const stream = &state->stream;
kvz_nal_write(stream, AUD_NUT, 0, 1); kvz_nal_write(stream, KVZ_NAL_AUD_NUT, 0, 1);
uint8_t pic_type = state->global->slicetype == KVZ_SLICE_I ? 0 uint8_t pic_type = state->global->slicetype == KVZ_SLICE_I ? 0
: state->global->slicetype == KVZ_SLICE_P ? 1 : state->global->slicetype == KVZ_SLICE_P ? 1
@ -654,8 +654,8 @@ void kvz_encoder_state_write_bitstream_slice_header(encoder_state_t * const stat
#endif #endif
WRITE_U(stream, (state->slice->start_in_rs == 0), 1, "first_slice_segment_in_pic_flag"); WRITE_U(stream, (state->slice->start_in_rs == 0), 1, "first_slice_segment_in_pic_flag");
if (state->global->pictype >= NAL_BLA_W_LP if (state->global->pictype >= KVZ_NAL_BLA_W_LP
&& state->global->pictype <= NAL_RSV_IRAP_VCL23) { && state->global->pictype <= KVZ_NAL_RSV_IRAP_VCL23) {
WRITE_U(stream, 1, 1, "no_output_of_prior_pics_flag"); WRITE_U(stream, 1, 1, "no_output_of_prior_pics_flag");
} }
@ -674,8 +674,8 @@ void kvz_encoder_state_write_bitstream_slice_header(encoder_state_t * const stat
//WRITE_U(stream, 1, 1, "pic_output_flag"); //WRITE_U(stream, 1, 1, "pic_output_flag");
//end if //end if
//if( IdrPicFlag ) <- nal_unit_type == 5 //if( IdrPicFlag ) <- nal_unit_type == 5
if (state->global->pictype != NAL_IDR_W_RADL if (state->global->pictype != KVZ_NAL_IDR_W_RADL
&& state->global->pictype != NAL_IDR_N_LP) { && state->global->pictype != KVZ_NAL_IDR_N_LP) {
int last_poc = 0; int last_poc = 0;
int poc_shift = 0; int poc_shift = 0;
@ -790,7 +790,7 @@ static void add_checksum(encoder_state_t * const state)
uint32_t checksum_val; uint32_t checksum_val;
unsigned int i; unsigned int i;
kvz_nal_write(stream, NAL_SUFFIT_SEI_NUT, 0, 0); kvz_nal_write(stream, KVZ_NAL_SUFFIX_SEI_NUT, 0, 0);
kvz_image_checksum(frame->rec, checksum, state->encoder_control->bitdepth); kvz_image_checksum(frame->rec, checksum, state->encoder_control->bitdepth);
@ -845,21 +845,21 @@ static void encoder_state_write_bitstream_main(encoder_state_t * const state)
first_nal_in_au = false; first_nal_in_au = false;
// Video Parameter Set (VPS) // Video Parameter Set (VPS)
kvz_nal_write(stream, NAL_VPS_NUT, 0, 1); kvz_nal_write(stream, KVZ_NAL_VPS_NUT, 0, 1);
encoder_state_write_bitstream_vid_parameter_set(state); encoder_state_write_bitstream_vid_parameter_set(state);
// Sequence Parameter Set (SPS) // Sequence Parameter Set (SPS)
kvz_nal_write(stream, NAL_SPS_NUT, 0, 1); kvz_nal_write(stream, KVZ_NAL_SPS_NUT, 0, 1);
encoder_state_write_bitstream_seq_parameter_set(state); encoder_state_write_bitstream_seq_parameter_set(state);
// Picture Parameter Set (PPS) // Picture Parameter Set (PPS)
kvz_nal_write(stream, NAL_PPS_NUT, 0, 1); kvz_nal_write(stream, KVZ_NAL_PPS_NUT, 0, 1);
encoder_state_write_bitstream_pic_parameter_set(state); encoder_state_write_bitstream_pic_parameter_set(state);
} }
// Send Kvazaar version information only in the first frame. // Send Kvazaar version information only in the first frame.
if (state->global->frame == 0 && state->encoder_control->cfg->add_encoder_info) { if (state->global->frame == 0 && state->encoder_control->cfg->add_encoder_info) {
kvz_nal_write(stream, PREFIX_SEI_NUT, 0, first_nal_in_au); kvz_nal_write(stream, KVZ_NAL_PREFIX_SEI_NUT, 0, first_nal_in_au);
encoder_state_write_bitstream_prefix_sei_version(state); encoder_state_write_bitstream_prefix_sei_version(state);
// spec:sei_rbsp() rbsp_trailing_bits // spec:sei_rbsp() rbsp_trailing_bits
@ -870,11 +870,11 @@ static void encoder_state_write_bitstream_main(encoder_state_t * const state)
if (state->encoder_control->vui.frame_field_info_present_flag){ if (state->encoder_control->vui.frame_field_info_present_flag){
// These should be optional, needed for earlier versions // These should be optional, needed for earlier versions
// of HM decoder to accept bitstream // of HM decoder to accept bitstream
//kvz_nal_write(stream, PREFIX_SEI_NUT, 0, 0); //kvz_nal_write(stream, KVZ_NAL_PREFIX_SEI_NUT, 0, 0);
//encoder_state_write_active_parameter_sets_sei_message(state); //encoder_state_write_active_parameter_sets_sei_message(state);
//kvz_bitstream_rbsp_trailing_bits(stream); //kvz_bitstream_rbsp_trailing_bits(stream);
kvz_nal_write(stream, PREFIX_SEI_NUT, 0, first_nal_in_au); kvz_nal_write(stream, KVZ_NAL_PREFIX_SEI_NUT, 0, first_nal_in_au);
encoder_state_write_picture_timing_sei_message(state); encoder_state_write_picture_timing_sei_message(state);
// spec:sei_rbsp() rbsp_trailing_bits // spec:sei_rbsp() rbsp_trailing_bits
@ -882,7 +882,7 @@ static void encoder_state_write_bitstream_main(encoder_state_t * const state)
} }
{ {
uint8_t nal_type = (state->global->is_idr_frame ? NAL_IDR_W_RADL : NAL_TRAIL_R); uint8_t nal_type = (state->global->is_idr_frame ? KVZ_NAL_IDR_W_RADL : KVZ_NAL_TRAIL_R);
kvz_nal_write(stream, nal_type, 0, first_nal_in_au); kvz_nal_write(stream, nal_type, 0, first_nal_in_au);
} }

View file

@ -784,10 +784,10 @@ static void encoder_state_new_frame(encoder_state_t * const state) {
if (state->global->is_idr_frame) { if (state->global->is_idr_frame) {
encoder_state_reset_poc(state); encoder_state_reset_poc(state);
state->global->slicetype = KVZ_SLICE_I; state->global->slicetype = KVZ_SLICE_I;
state->global->pictype = NAL_IDR_W_RADL; state->global->pictype = KVZ_NAL_IDR_W_RADL;
} else { } else {
state->global->slicetype = encoder->cfg->intra_period==1 ? KVZ_SLICE_I : (state->encoder_control->cfg->gop_len?KVZ_SLICE_B:KVZ_SLICE_P); state->global->slicetype = encoder->cfg->intra_period==1 ? KVZ_SLICE_I : (state->encoder_control->cfg->gop_len?KVZ_SLICE_B:KVZ_SLICE_P);
state->global->pictype = NAL_TRAIL_R; state->global->pictype = KVZ_NAL_TRAIL_R;
if (state->encoder_control->cfg->gop_len) { if (state->encoder_control->cfg->gop_len) {
if (encoder->cfg->intra_period > 1 && (state->global->poc % encoder->cfg->intra_period) == 0) { if (encoder->cfg->intra_period > 1 && (state->global->poc % encoder->cfg->intra_period) == 0) {
state->global->slicetype = KVZ_SLICE_I; state->global->slicetype = KVZ_SLICE_I;

View file

@ -40,51 +40,61 @@
* \brief NAL unit type codes. * \brief NAL unit type codes.
* *
* These are the nal_unit_type codes from Table 7-1 ITU-T H.265 v1.0. * These are the nal_unit_type codes from Table 7-1 ITU-T H.265 v1.0.
* The type codes have been prefixed with "NAL_".
*/ */
enum { enum kvz_nal_unit_type {
NAL_TRAIL_N = 0,
NAL_TRAIL_R = 1,
NAL_TSA_N = 2, // Trailing pictures
NAL_TSA_R = 3,
NAL_STSA_N = 4, KVZ_NAL_TRAIL_N = 0,
NAL_STSA_R = 5, KVZ_NAL_TRAIL_R = 1,
NAL_RADL_N = 6, KVZ_NAL_TSA_N = 2,
NAL_RADL_R = 7, KVZ_NAL_TSA_R = 3,
NAL_RASL_N = 8, KVZ_NAL_STSA_N = 4,
NAL_RASL_R = 9, KVZ_NAL_STSA_R = 5,
// Reserved RSV_VCL_ N/R 10-15 // Leading pictures
NAL_BLA_W_LP = 16, KVZ_NAL_RADL_N = 6,
NAL_BLA_W_RADL = 17, KVZ_NAL_RADL_R = 7,
NAL_BLA_N_LP = 18,
NAL_IDR_W_RADL = 19, KVZ_NAL_RASL_N = 8,
NAL_IDR_N_LP = 20, KVZ_NAL_RASL_R = 9,
NAL_CRA_NUT = 21, // Reserved non-IRAP RSV_VCL_N/R 10-15
// Reserved RSV_IRAP_VCL 22-23 // Intra random access point pictures
NAL_RSV_IRAP_VCL23 = 23,
// Reserved RSV_VCL 24-31 KVZ_NAL_BLA_W_LP = 16,
KVZ_NAL_BLA_W_RADL = 17,
KVZ_NAL_BLA_N_LP = 18,
NAL_VPS_NUT = 32, KVZ_NAL_IDR_W_RADL = 19,
NAL_SPS_NUT = 33, KVZ_NAL_IDR_N_LP = 20,
NAL_PPS_NUT = 34,
AUD_NUT = 35, KVZ_NAL_CRA_NUT = 21,
EOS_NUT = 36,
EOB_NUT = 37,
FD_NUT = 38,
PREFIX_SEI_NUT = 39, // Reserved IRAP
NAL_SUFFIT_SEI_NUT = 40,
KVZ_NAL_RSV_IRAP_VCL22 = 22,
KVZ_NAL_RSV_IRAP_VCL23 = 23,
// Reserved non-IRAP RSV_VCL 24-32
// non-VCL
KVZ_NAL_VPS_NUT = 32,
KVZ_NAL_SPS_NUT = 33,
KVZ_NAL_PPS_NUT = 34,
KVZ_NAL_AUD_NUT = 35,
KVZ_NAL_EOS_NUT = 36,
KVZ_NAL_EOB_NUT = 37,
KVZ_NAL_FD_NUT = 38,
KVZ_NAL_PREFIX_SEI_NUT = 39,
KVZ_NAL_SUFFIX_SEI_NUT = 40,
// Reserved RSV_NVCL 41-47 // Reserved RSV_NVCL 41-47
// Unspecified UNSPEC 48-63 // Unspecified UNSPEC 48-63