diff --git a/src/kvazaar.c b/src/kvazaar.c index 59d24d05f..651f934ad 100644 --- a/src/kvazaar.c +++ b/src/kvazaar.c @@ -117,6 +117,7 @@ static void set_frame_info(kvz_frame_info *const info, const encoder_state_t *co { info->poc = state->global->poc, info->qp = state->global->QP; + info->nal_unit_type = state->global->pictype; info->slice_type = state->global->slicetype; kvz_encoder_get_ref_lists(state, info->ref_list_len, info->ref_list); } diff --git a/src/kvazaar.h b/src/kvazaar.h index a0939d24d..117918618 100644 --- a/src/kvazaar.h +++ b/src/kvazaar.h @@ -191,6 +191,70 @@ typedef struct kvz_picture { int64_t dts; //!< \brief Decompression timestamp. } kvz_picture; +/** + * \brief NAL unit type codes. + * + * These are the nal_unit_type codes from Table 7-1 ITU-T H.265 v1.0. + */ +enum kvz_nal_unit_type { + + // Trailing pictures + + KVZ_NAL_TRAIL_N = 0, + KVZ_NAL_TRAIL_R = 1, + + KVZ_NAL_TSA_N = 2, + KVZ_NAL_TSA_R = 3, + + KVZ_NAL_STSA_N = 4, + KVZ_NAL_STSA_R = 5, + + // Leading pictures + + KVZ_NAL_RADL_N = 6, + KVZ_NAL_RADL_R = 7, + + KVZ_NAL_RASL_N = 8, + KVZ_NAL_RASL_R = 9, + + // Reserved non-IRAP RSV_VCL_N/R 10-15 + + // Intra random access point pictures + + KVZ_NAL_BLA_W_LP = 16, + KVZ_NAL_BLA_W_RADL = 17, + KVZ_NAL_BLA_N_LP = 18, + + KVZ_NAL_IDR_W_RADL = 19, + KVZ_NAL_IDR_N_LP = 20, + + KVZ_NAL_CRA_NUT = 21, + + // 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 +}; + enum kvz_slice_type { KVZ_SLICE_B = 0, KVZ_SLICE_P = 1, @@ -212,6 +276,11 @@ typedef struct kvz_frame_info { */ int8_t qp; + /** + * \brief Type of the NAL VCL unit + */ + enum kvz_nal_unit_type nal_unit_type; + /** * \brief Type of the slice */ diff --git a/src/nal.h b/src/nal.h index d2e334a95..5f94645c8 100644 --- a/src/nal.h +++ b/src/nal.h @@ -32,74 +32,6 @@ #include "image.h" #include "bitstream.h" - -////////////////////////////////////////////////////////////////////////// -// TYPES - -/** - * \brief NAL unit type codes. - * - * These are the nal_unit_type codes from Table 7-1 ITU-T H.265 v1.0. - */ -enum kvz_nal_unit_type { - - // Trailing pictures - - KVZ_NAL_TRAIL_N = 0, - KVZ_NAL_TRAIL_R = 1, - - KVZ_NAL_TSA_N = 2, - KVZ_NAL_TSA_R = 3, - - KVZ_NAL_STSA_N = 4, - KVZ_NAL_STSA_R = 5, - - // Leading pictures - - KVZ_NAL_RADL_N = 6, - KVZ_NAL_RADL_R = 7, - - KVZ_NAL_RASL_N = 8, - KVZ_NAL_RASL_R = 9, - - // Reserved non-IRAP RSV_VCL_N/R 10-15 - - // Intra random access point pictures - - KVZ_NAL_BLA_W_LP = 16, - KVZ_NAL_BLA_W_RADL = 17, - KVZ_NAL_BLA_N_LP = 18, - - KVZ_NAL_IDR_W_RADL = 19, - KVZ_NAL_IDR_N_LP = 20, - - KVZ_NAL_CRA_NUT = 21, - - // 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 -}; - #define SEI_HASH_MAX_LENGTH 4 //////////////////////////////////////////////////////////////////////////