From 8e4247c53e2bb99a31d349c4e529fc8a63fec030 Mon Sep 17 00:00:00 2001 From: Harish Mahendrakar Date: Thu, 17 Sep 2026 12:35:02 -0700 Subject: [PATCH] [decoder]: Add few entries in codec_t and initialize them for default paths Added few members in codec_t and initialized them for 420P, 8bit path. When HBD support is added these will be updated based on the parsed headers. --- common/ihevc_defs.h | 7 +++++++ decoder/ihevcd_api.c | 6 ++++++ decoder/ihevcd_decode.c | 2 +- decoder/ihevcd_structs.h | 25 +++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/common/ihevc_defs.h b/common/ihevc_defs.h index d0b11b7..fb9f979 100644 --- a/common/ihevc_defs.h +++ b/common/ihevc_defs.h @@ -272,6 +272,13 @@ enum #define BIT_DEPTH 8 #define BIT_DEPTH_LUMA BIT_DEPTH #define BIT_DEPTH_CHROMA BIT_DEPTH + +#define BIT_DEPTH_8BITS 8 +#define BIT_DEPTH_10BITS 10 + +#define PIXEL_SIZE_1BYTE sizeof(UWORD8) +#define PIXEL_SIZE_2BYTES sizeof(UWORD16) + /*****************************************************************************/ /* Profile tier level defs */ /*****************************************************************************/ diff --git a/decoder/ihevcd_api.c b/decoder/ihevcd_api.c index 8fb2463..45bc975 100644 --- a/decoder/ihevcd_api.c +++ b/decoder/ihevcd_api.c @@ -1086,6 +1086,12 @@ WORD32 ihevcd_init(codec_t *ps_codec) ps_codec->i4_max_prev_poc_lsb = -1; ps_codec->s_parse.i4_abs_pic_order_cnt = -1; + ps_codec->i4_chroma_format_idc = CHROMA_FMT_IDC_YUV420; + ps_codec->i4_pixel_size_y = PIXEL_SIZE_1BYTE; + ps_codec->i4_pixel_size_uv = PIXEL_SIZE_1BYTE; + ps_codec->i4_bit_depth_luma = BIT_DEPTH_8BITS; + ps_codec->i4_bit_depth_chroma = BIT_DEPTH_8BITS; + /* Set ref chroma format by default to 420SP UV interleaved */ ps_codec->e_ref_chroma_fmt = IV_YUV_420SP_UV; diff --git a/decoder/ihevcd_decode.c b/decoder/ihevcd_decode.c index 9be39b6..e2f6dd7 100644 --- a/decoder/ihevcd_decode.c +++ b/decoder/ihevcd_decode.c @@ -204,7 +204,7 @@ static void ihevcd_fill_outargs(codec_t *ps_codec, { ps_dec_op->u4_pic_wd = ps_codec->i4_disp_wd; ps_dec_op->u4_pic_ht = ps_codec->i4_disp_ht; - ps_dec_op->u4_bit_depth = 8; + ps_dec_op->u4_bit_depth = ps_codec->i4_bit_depth_luma; } else { diff --git a/decoder/ihevcd_structs.h b/decoder/ihevcd_structs.h index bc8fc8a..880e4dc 100644 --- a/decoder/ihevcd_structs.h +++ b/decoder/ihevcd_structs.h @@ -1819,6 +1819,31 @@ struct _codec_t */ IV_PICTURE_CODING_TYPE_T e_dec_pic_type; + /** + * ChromaFormatIDC + */ + WORD32 i4_chroma_format_idc; + + /** + * Luma bit depth - 8 and 10 bits are supported + */ + WORD32 i4_bit_depth_luma; + + /** + * Chroma bit depth - 8 and 10 bits are supported + */ + WORD32 i4_bit_depth_chroma; + + /** + * Luma sample size in bytes - 1 for 8 bit, 2 for hbd + */ + WORD32 i4_pixel_size_y; + + /** + * Chroma sample size in bytes - 1 for 8 bit, 2 for hbd + */ + WORD32 i4_pixel_size_uv; + /** * Flag to signal if a frame was decoded in this call */