From 1c898a2f4a6f9eaec93a91fd0bfeca1090cc0132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arttu=20Yl=C3=A4-Outinen?= Date: Tue, 15 Sep 2015 10:19:31 +0300 Subject: [PATCH] Prefix NAL unit type enum constants with KVZ_. --- src/encoder_state-bitstream.c | 26 ++++++------- src/encoderstate.c | 4 +- src/nal.h | 72 ++++++++++++++++++++--------------- 3 files changed, 56 insertions(+), 46 deletions(-) diff --git a/src/encoder_state-bitstream.c b/src/encoder_state-bitstream.c index 188d8c39..9307bc38 100644 --- a/src/encoder_state-bitstream.c +++ b/src/encoder_state-bitstream.c @@ -31,7 +31,7 @@ static void encoder_state_write_bitstream_aud(encoder_state_t * const state) { 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 : 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 WRITE_U(stream, (state->slice->start_in_rs == 0), 1, "first_slice_segment_in_pic_flag"); - if (state->global->pictype >= NAL_BLA_W_LP - && state->global->pictype <= NAL_RSV_IRAP_VCL23) { + if (state->global->pictype >= KVZ_NAL_BLA_W_LP + && state->global->pictype <= KVZ_NAL_RSV_IRAP_VCL23) { 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"); //end if //if( IdrPicFlag ) <- nal_unit_type == 5 - if (state->global->pictype != NAL_IDR_W_RADL - && state->global->pictype != NAL_IDR_N_LP) { + if (state->global->pictype != KVZ_NAL_IDR_W_RADL + && state->global->pictype != KVZ_NAL_IDR_N_LP) { int last_poc = 0; int poc_shift = 0; @@ -790,7 +790,7 @@ static void add_checksum(encoder_state_t * const state) uint32_t checksum_val; 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); @@ -845,21 +845,21 @@ static void encoder_state_write_bitstream_main(encoder_state_t * const state) first_nal_in_au = false; // 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); // 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); // 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); } // Send Kvazaar version information only in the first frame. 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); // 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){ // These should be optional, needed for earlier versions // 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); //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); // 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); } diff --git a/src/encoderstate.c b/src/encoderstate.c index 5b5349f2..01ac4168 100644 --- a/src/encoderstate.c +++ b/src/encoderstate.c @@ -784,10 +784,10 @@ static void encoder_state_new_frame(encoder_state_t * const state) { if (state->global->is_idr_frame) { encoder_state_reset_poc(state); state->global->slicetype = KVZ_SLICE_I; - state->global->pictype = NAL_IDR_W_RADL; + state->global->pictype = KVZ_NAL_IDR_W_RADL; } 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->pictype = NAL_TRAIL_R; + state->global->pictype = KVZ_NAL_TRAIL_R; if (state->encoder_control->cfg->gop_len) { if (encoder->cfg->intra_period > 1 && (state->global->poc % encoder->cfg->intra_period) == 0) { state->global->slicetype = KVZ_SLICE_I; diff --git a/src/nal.h b/src/nal.h index 7db5d3e2..d2e334a9 100644 --- a/src/nal.h +++ b/src/nal.h @@ -40,51 +40,61 @@ * \brief NAL unit type codes. * * 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 { - NAL_TRAIL_N = 0, - NAL_TRAIL_R = 1, +enum kvz_nal_unit_type { - NAL_TSA_N = 2, - NAL_TSA_R = 3, + // Trailing pictures - NAL_STSA_N = 4, - NAL_STSA_R = 5, + KVZ_NAL_TRAIL_N = 0, + KVZ_NAL_TRAIL_R = 1, - NAL_RADL_N = 6, - NAL_RADL_R = 7, + KVZ_NAL_TSA_N = 2, + KVZ_NAL_TSA_R = 3, - NAL_RASL_N = 8, - NAL_RASL_R = 9, + KVZ_NAL_STSA_N = 4, + KVZ_NAL_STSA_R = 5, - // Reserved RSV_VCL_ N/R 10-15 + // Leading pictures - NAL_BLA_W_LP = 16, - NAL_BLA_W_RADL = 17, - NAL_BLA_N_LP = 18, + KVZ_NAL_RADL_N = 6, + KVZ_NAL_RADL_R = 7, - NAL_IDR_W_RADL = 19, - NAL_IDR_N_LP = 20, + KVZ_NAL_RASL_N = 8, + KVZ_NAL_RASL_R = 9, - NAL_CRA_NUT = 21, + // Reserved non-IRAP RSV_VCL_N/R 10-15 - // Reserved RSV_IRAP_VCL 22-23 - NAL_RSV_IRAP_VCL23 = 23, + // Intra random access point pictures - // 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, - NAL_SPS_NUT = 33, - NAL_PPS_NUT = 34, + KVZ_NAL_IDR_W_RADL = 19, + KVZ_NAL_IDR_N_LP = 20, - AUD_NUT = 35, - EOS_NUT = 36, - EOB_NUT = 37, - FD_NUT = 38, + KVZ_NAL_CRA_NUT = 21, - PREFIX_SEI_NUT = 39, - NAL_SUFFIT_SEI_NUT = 40, + // Reserved IRAP + + 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 // Unspecified UNSPEC 48-63