Merge changes I015ebe03,Idc0b0db5
am: 00fa4b6490
Change-Id: I71e761af5fd1551643418dd7979491c2a6b7a7ee
This commit is contained in:
commit
7684b467b4
34 changed files with 4421 additions and 110 deletions
|
|
@ -322,6 +322,7 @@ cc_library_static {
|
|||
"encoder/irc_vbr_str_prms.c",
|
||||
"encoder/ime.c",
|
||||
"encoder/ime_distortion_metrics.c",
|
||||
"encoder/ih264e_sei.c",
|
||||
],
|
||||
|
||||
arch: {
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ list(APPEND LIBAVCENC_SRCS
|
|||
"${AVC_ROOT}/encoder/ih264e_encode_header.c"
|
||||
"${AVC_ROOT}/encoder/ih264e_function_selector_generic.c"
|
||||
"${AVC_ROOT}/encoder/ih264e_fmt_conv.c"
|
||||
"${AVC_ROOT}/encoder/ih264e_sei.c"
|
||||
"${AVC_ROOT}/encoder/irc_rate_control_api.c"
|
||||
"${AVC_ROOT}/encoder/irc_bit_allocation.c"
|
||||
"${AVC_ROOT}/encoder/irc_cbr_buffer_control.c"
|
||||
|
|
|
|||
|
|
@ -690,4 +690,50 @@ typedef enum
|
|||
#define TOP_MB_AVAILABLE_MASK 0x04
|
||||
#define TOP_RIGHT_MB_AVAILABLE_MASK 0x08
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @brief SEI macros
|
||||
******************************************************************************
|
||||
*/
|
||||
/*
|
||||
* @brief specifies the number of colour primary components of the mastering display
|
||||
*/
|
||||
#define NUM_SEI_MDCV_PRIMARIES 3
|
||||
|
||||
/*
|
||||
* @brief specifies the number of colour primary components of the nominal content colour volume
|
||||
*/
|
||||
#define NUM_SEI_CCV_PRIMARIES 3
|
||||
|
||||
#define DISPLAY_PRIMARIES_X_UPPER_LIMIT 37000
|
||||
#define DISPLAY_PRIMARIES_X_LOWER_LIMIT 5
|
||||
#define DISPLAY_PRIMARIES_X_DIVISION_FACTOR 5
|
||||
|
||||
#define DISPLAY_PRIMARIES_Y_UPPER_LIMIT 42000
|
||||
#define DISPLAY_PRIMARIES_Y_LOWER_LIMIT 5
|
||||
#define DISPLAY_PRIMARIES_Y_DIVISION_FACTOR 5
|
||||
|
||||
#define WHITE_POINT_X_UPPER_LIMIT 37000
|
||||
#define WHITE_POINT_X_LOWER_LIMIT 5
|
||||
#define WHITE_POINT_X_DIVISION_FACTOR 5
|
||||
|
||||
#define WHITE_POINT_Y_UPPER_LIMIT 42000
|
||||
#define WHITE_POINT_Y_LOWER_LIMIT 5
|
||||
#define WHITE_POINT_Y_DIVISION_FACTOR 5
|
||||
|
||||
#define MAX_DISPLAY_MASTERING_LUMINANCE_UPPER_LIMIT 100000000
|
||||
#define MAX_DISPLAY_MASTERING_LUMINANCE_LOWER_LIMIT 50000
|
||||
#define MAX_DISPLAY_MASTERING_LUMINANCE_DIVISION_FACTOR 10000
|
||||
|
||||
#define MIN_DISPLAY_MASTERING_LUMINANCE_UPPER_LIMIT 50000
|
||||
#define MIN_DISPLAY_MASTERING_LUMINANCE_LOWER_LIMIT 1
|
||||
|
||||
#define AMBIENT_LIGHT_X_UPPER_LIMIT 50000
|
||||
#define AMBIENT_LIGHT_Y_UPPER_LIMIT 50000
|
||||
|
||||
#define CCV_PRIMARIES_X_UPPER_LIMIT 5000000
|
||||
#define CCV_PRIMARIES_X_LOWER_LIMIT -5000000
|
||||
#define CCV_PRIMARIES_Y_UPPER_LIMIT 5000000
|
||||
#define CCV_PRIMARIES_Y_LOWER_LIMIT -5000000
|
||||
|
||||
#endif /* IH264_DEFS_H_ */
|
||||
|
|
|
|||
|
|
@ -1719,4 +1719,200 @@ typedef struct
|
|||
UWORD32 b16_chroma_csbp: 8;
|
||||
}inter_mb_t;
|
||||
|
||||
/**
|
||||
* Structure to hold Mastering Display Color Volume SEI
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* Array to store the display_primaries_x values
|
||||
*/
|
||||
UWORD16 au2_display_primaries_x[NUM_SEI_MDCV_PRIMARIES];
|
||||
|
||||
/**
|
||||
* Array to store the display_primaries_y values
|
||||
*/
|
||||
UWORD16 au2_display_primaries_y[NUM_SEI_MDCV_PRIMARIES];
|
||||
|
||||
/**
|
||||
* Variable to store the white point x value
|
||||
*/
|
||||
UWORD16 u2_white_point_x;
|
||||
|
||||
/**
|
||||
* Variable to store the white point y value
|
||||
*/
|
||||
UWORD16 u2_white_point_y;
|
||||
|
||||
/**
|
||||
* Variable to store the max display mastering luminance value
|
||||
*/
|
||||
UWORD32 u4_max_display_mastering_luminance;
|
||||
|
||||
/**
|
||||
* Variable to store the min display mastering luminance value
|
||||
*/
|
||||
UWORD32 u4_min_display_mastering_luminance;
|
||||
}sei_mdcv_params_t;
|
||||
|
||||
|
||||
/**
|
||||
* Structure for Content Light Level Info
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* The maximum pixel intensity of all samples
|
||||
*/
|
||||
UWORD16 u2_max_content_light_level;
|
||||
|
||||
/**
|
||||
* The average pixel intensity of all samples
|
||||
*/
|
||||
UWORD16 u2_max_pic_average_light_level;
|
||||
}sei_cll_params_t;
|
||||
|
||||
|
||||
/**
|
||||
* Structure to hold Ambient viewing environment SEI
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* specifies the environmental illluminance of the ambient viewing environment
|
||||
*/
|
||||
UWORD32 u4_ambient_illuminance;
|
||||
|
||||
/*
|
||||
* specify the normalized x chromaticity coordinates of the
|
||||
* environmental ambient light in the nominal viewing environment
|
||||
*/
|
||||
UWORD16 u2_ambient_light_x;
|
||||
|
||||
/*
|
||||
* specify the normalized y chromaticity coordinates of the
|
||||
* environmental ambient light in the nominal viewing environment
|
||||
*/
|
||||
UWORD16 u2_ambient_light_y;
|
||||
}sei_ave_params_t;
|
||||
|
||||
|
||||
/**
|
||||
* Structure to hold Content color volume SEI
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/*
|
||||
* Flag used to control persistence of CCV SEI messages
|
||||
*/
|
||||
UWORD8 u1_ccv_cancel_flag;
|
||||
|
||||
/*
|
||||
* specifies the persistence of the CCV SEI message for the current layer
|
||||
*/
|
||||
UWORD8 u1_ccv_persistence_flag;
|
||||
|
||||
/*
|
||||
* specifies the presence of syntax elements ccv_primaries_x and ccv_primaries_y
|
||||
*/
|
||||
UWORD8 u1_ccv_primaries_present_flag;
|
||||
|
||||
/*
|
||||
* specifies that the syntax element ccv_min_luminance_value is present
|
||||
*/
|
||||
UWORD8 u1_ccv_min_luminance_value_present_flag;
|
||||
|
||||
/*
|
||||
* specifies that the syntax element ccv_max_luminance_value is present
|
||||
*/
|
||||
UWORD8 u1_ccv_max_luminance_value_present_flag;
|
||||
|
||||
/*
|
||||
* specifies that the syntax element ccv_avg_luminance_value is present
|
||||
*/
|
||||
UWORD8 u1_ccv_avg_luminance_value_present_flag;
|
||||
|
||||
/*
|
||||
* shall be equal to 0 in bitstreams conforming to this version. Other values
|
||||
* for reserved_zero_2bits are reserved for future use
|
||||
*/
|
||||
UWORD8 u1_ccv_reserved_zero_2bits;
|
||||
|
||||
/*
|
||||
* specify the normalized x chromaticity coordinates of the colour
|
||||
* primary component c of the nominal content colour volume
|
||||
*/
|
||||
WORD32 ai4_ccv_primaries_x[NUM_SEI_CCV_PRIMARIES];
|
||||
|
||||
/*
|
||||
* specify the normalized y chromaticity coordinates of the colour
|
||||
* primary component c of the nominal content colour volume
|
||||
*/
|
||||
WORD32 ai4_ccv_primaries_y[NUM_SEI_CCV_PRIMARIES];
|
||||
|
||||
/*
|
||||
* specifies the normalized minimum luminance value
|
||||
*/
|
||||
UWORD32 u4_ccv_min_luminance_value;
|
||||
|
||||
/*
|
||||
* specifies the normalized maximum luminance value
|
||||
*/
|
||||
UWORD32 u4_ccv_max_luminance_value;
|
||||
|
||||
/*
|
||||
* specifies the normalized average luminance value
|
||||
*/
|
||||
UWORD32 u4_ccv_avg_luminance_value;
|
||||
}sei_ccv_params_t;
|
||||
|
||||
|
||||
/**
|
||||
* Structure to hold SEI parameters Info
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* mastering display color volume info present flag
|
||||
*/
|
||||
UWORD8 u1_sei_mdcv_params_present_flag;
|
||||
|
||||
/*
|
||||
* MDCV parameters
|
||||
*/
|
||||
sei_mdcv_params_t s_sei_mdcv_params;
|
||||
|
||||
/**
|
||||
* content light level info present flag
|
||||
*/
|
||||
UWORD8 u1_sei_cll_params_present_flag;
|
||||
|
||||
/*
|
||||
* CLL parameters
|
||||
*/
|
||||
sei_cll_params_t s_sei_cll_params;
|
||||
|
||||
/**
|
||||
* ambient viewing environment info present flag
|
||||
*/
|
||||
UWORD8 u1_sei_ave_params_present_flag;
|
||||
|
||||
/*
|
||||
* AVE parameters
|
||||
*/
|
||||
sei_ave_params_t s_sei_ave_params;
|
||||
|
||||
/**
|
||||
* content color volume info present flag
|
||||
*/
|
||||
UWORD8 u1_sei_ccv_params_present_flag;
|
||||
|
||||
/*
|
||||
* CCV parameters
|
||||
*/
|
||||
sei_ccv_params_t s_sei_ccv_params;
|
||||
} sei_params_t;
|
||||
|
||||
|
||||
#endif /* _IH264_STRUCTS_H_ */
|
||||
|
|
|
|||
261
decoder/ih264d.h
261
decoder/ih264d.h
|
|
@ -198,7 +198,20 @@ typedef enum {
|
|||
IH264D_CMD_CTL_GPU_ENABLE_DISABLE = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x200,
|
||||
|
||||
/** Set degrade level */
|
||||
IH264D_CMD_CTL_DEGRADE = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x300
|
||||
IH264D_CMD_CTL_DEGRADE = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x300,
|
||||
|
||||
/** Get SEI MDCV parameters */
|
||||
IH264D_CMD_CTL_GET_SEI_MDCV_PARAMS = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x301,
|
||||
|
||||
/** Get SEI CLL parameters */
|
||||
IH264D_CMD_CTL_GET_SEI_CLL_PARAMS = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x302,
|
||||
|
||||
/** Get SEI AVE parameters */
|
||||
IH264D_CMD_CTL_GET_SEI_AVE_PARAMS = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x303,
|
||||
|
||||
/** Get SEI CCV parameters */
|
||||
IH264D_CMD_CTL_GET_SEI_CCV_PARAMS = IVD_CMD_CTL_CODEC_SUBCMD_START + 0x304
|
||||
|
||||
}IH264D_CMD_CTL_SUB_CMDS;
|
||||
/*****************************************************************************/
|
||||
/* Video control Flush */
|
||||
|
|
@ -469,6 +482,252 @@ typedef struct
|
|||
UWORD32 u4_max_dec_frame_buffering;
|
||||
}ih264d_ctl_get_vui_params_op_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* u4_size
|
||||
*/
|
||||
UWORD32 u4_size;
|
||||
|
||||
/**
|
||||
* cmd
|
||||
*/
|
||||
IVD_API_COMMAND_TYPE_T e_cmd;
|
||||
|
||||
/**
|
||||
* sub_cmd
|
||||
*/
|
||||
IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd;
|
||||
}ih264d_ctl_get_sei_mdcv_params_ip_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* u4_size
|
||||
*/
|
||||
UWORD32 u4_size;
|
||||
|
||||
/**
|
||||
* error_code
|
||||
*/
|
||||
UWORD32 u4_error_code;
|
||||
|
||||
/**
|
||||
* Array to store the display_primaries_x values
|
||||
*/
|
||||
UWORD16 au2_display_primaries_x[NUM_SEI_MDCV_PRIMARIES];
|
||||
|
||||
/**
|
||||
* Array to store the display_primaries_y values
|
||||
*/
|
||||
UWORD16 au2_display_primaries_y[NUM_SEI_MDCV_PRIMARIES];
|
||||
|
||||
/**
|
||||
* Variable to store the white point x value
|
||||
*/
|
||||
UWORD16 u2_white_point_x;
|
||||
|
||||
/**
|
||||
* Variable to store the white point y value
|
||||
*/
|
||||
UWORD16 u2_white_point_y;
|
||||
|
||||
/**
|
||||
* Variable to store the max display mastering luminance value
|
||||
*/
|
||||
UWORD32 u4_max_display_mastering_luminance;
|
||||
|
||||
/**
|
||||
* Variable to store the min display mastering luminance value
|
||||
*/
|
||||
UWORD32 u4_min_display_mastering_luminance;
|
||||
}ih264d_ctl_get_sei_mdcv_params_op_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* u4_size
|
||||
*/
|
||||
UWORD32 u4_size;
|
||||
|
||||
/**
|
||||
* cmd
|
||||
*/
|
||||
IVD_API_COMMAND_TYPE_T e_cmd;
|
||||
|
||||
/**
|
||||
* sub_cmd
|
||||
*/
|
||||
IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd;
|
||||
}ih264d_ctl_get_sei_cll_params_ip_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* u4_size
|
||||
*/
|
||||
UWORD32 u4_size;
|
||||
|
||||
/**
|
||||
* error_code
|
||||
*/
|
||||
UWORD32 u4_error_code;
|
||||
|
||||
/**
|
||||
* The maximum pixel intensity of all samples
|
||||
*/
|
||||
UWORD16 u2_max_content_light_level;
|
||||
|
||||
/**
|
||||
* The average pixel intensity of all samples
|
||||
*/
|
||||
UWORD16 u2_max_pic_average_light_level;
|
||||
} ih264d_ctl_get_sei_cll_params_op_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* u4_size
|
||||
*/
|
||||
UWORD32 u4_size;
|
||||
|
||||
/**
|
||||
* cmd
|
||||
*/
|
||||
IVD_API_COMMAND_TYPE_T e_cmd;
|
||||
|
||||
/**
|
||||
* sub_cmd
|
||||
*/
|
||||
IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd;
|
||||
}ih264d_ctl_get_sei_ave_params_ip_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* u4_size
|
||||
*/
|
||||
UWORD32 u4_size;
|
||||
|
||||
/**
|
||||
* error_code
|
||||
*/
|
||||
UWORD32 u4_error_code;
|
||||
|
||||
/**
|
||||
* specifies the environmental illluminance of the ambient viewing environment
|
||||
*/
|
||||
UWORD32 u4_ambient_illuminance;
|
||||
|
||||
/*
|
||||
* specify the normalized x chromaticity coordinates of the
|
||||
* environmental ambient light in the nominal viewing environment
|
||||
*/
|
||||
UWORD16 u2_ambient_light_x;
|
||||
|
||||
/*
|
||||
* specify the normalized y chromaticity coordinates of the
|
||||
* environmental ambient light in the nominal viewing environment
|
||||
*/
|
||||
UWORD16 u2_ambient_light_y;
|
||||
} ih264d_ctl_get_sei_ave_params_op_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* u4_size
|
||||
*/
|
||||
UWORD32 u4_size;
|
||||
|
||||
/**
|
||||
* cmd
|
||||
*/
|
||||
IVD_API_COMMAND_TYPE_T e_cmd;
|
||||
|
||||
/**
|
||||
* sub_cmd
|
||||
*/
|
||||
IVD_CONTROL_API_COMMAND_TYPE_T e_sub_cmd;
|
||||
}ih264d_ctl_get_sei_ccv_params_ip_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* u4_size
|
||||
*/
|
||||
UWORD32 u4_size;
|
||||
|
||||
/**
|
||||
* error_code
|
||||
*/
|
||||
UWORD32 u4_error_code;
|
||||
|
||||
/*
|
||||
* Flag used to control persistence of CCV SEI messages
|
||||
*/
|
||||
UWORD8 u1_ccv_cancel_flag;
|
||||
|
||||
/*
|
||||
* specifies the persistence of the CCV SEI message for the current layer
|
||||
*/
|
||||
UWORD8 u1_ccv_persistence_flag;
|
||||
|
||||
/*
|
||||
* specifies the presence of syntax elements ccv_primaries_x and ccv_primaries_y
|
||||
*/
|
||||
UWORD8 u1_ccv_primaries_present_flag;
|
||||
|
||||
/*
|
||||
* specifies that the syntax element ccv_min_luminance_value is present
|
||||
*/
|
||||
UWORD8 u1_ccv_min_luminance_value_present_flag;
|
||||
|
||||
/*
|
||||
* specifies that the syntax element ccv_max_luminance_value is present
|
||||
*/
|
||||
UWORD8 u1_ccv_max_luminance_value_present_flag;
|
||||
|
||||
/*
|
||||
* specifies that the syntax element ccv_avg_luminance_value is present
|
||||
*/
|
||||
UWORD8 u1_ccv_avg_luminance_value_present_flag;
|
||||
|
||||
/*
|
||||
* shall be equal to 0 in bitstreams conforming to this version. Other values
|
||||
* for reserved_zero_2bits are reserved for future use
|
||||
*/
|
||||
UWORD8 u1_ccv_reserved_zero_2bits;
|
||||
|
||||
/*
|
||||
* specify the normalized x chromaticity coordinates of the colour
|
||||
* primary component c of the nominal content colour volume
|
||||
*/
|
||||
WORD32 ai4_ccv_primaries_x[NUM_SEI_CCV_PRIMARIES];
|
||||
|
||||
/*
|
||||
* specify the normalized y chromaticity coordinates of the colour
|
||||
* primary component c of the nominal content colour volume
|
||||
*/
|
||||
WORD32 ai4_ccv_primaries_y[NUM_SEI_CCV_PRIMARIES];
|
||||
|
||||
/*
|
||||
* specifies the normalized minimum luminance value
|
||||
*/
|
||||
UWORD32 u4_ccv_min_luminance_value;
|
||||
|
||||
/*
|
||||
* specifies the normalized maximum luminance value
|
||||
*/
|
||||
UWORD32 u4_ccv_max_luminance_value;
|
||||
|
||||
/*
|
||||
* specifies the normalized average luminance value
|
||||
*/
|
||||
UWORD32 u4_ccv_avg_luminance_value;
|
||||
} ih264d_ctl_get_sei_ccv_params_op_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* closing brace for extern "C" */
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -139,6 +139,22 @@ WORD32 ih264d_get_vui_params(iv_obj_t *dec_hdl,
|
|||
void *pv_api_ip,
|
||||
void *pv_api_op);
|
||||
|
||||
WORD32 ih264d_get_sei_mdcv_params(iv_obj_t *dec_hdl,
|
||||
void *pv_api_ip,
|
||||
void *pv_api_op);
|
||||
|
||||
WORD32 ih264d_get_sei_cll_params(iv_obj_t *dec_hdl,
|
||||
void *pv_api_ip,
|
||||
void *pv_api_op);
|
||||
|
||||
WORD32 ih264d_get_sei_ave_params(iv_obj_t *dec_hdl,
|
||||
void *pv_api_ip,
|
||||
void *pv_api_op);
|
||||
|
||||
WORD32 ih264d_get_sei_ccv_params(iv_obj_t *dec_hdl,
|
||||
void *pv_api_ip,
|
||||
void *pv_api_op);
|
||||
|
||||
WORD32 ih264d_set_num_cores(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op);
|
||||
|
||||
WORD32 ih264d_deblock_display(dec_struct_t *ps_dec);
|
||||
|
|
@ -155,6 +171,31 @@ WORD32 ih264d_set_degrade(iv_obj_t *ps_codec_obj,
|
|||
void ih264d_fill_output_struct_from_context(dec_struct_t *ps_dec,
|
||||
ivd_video_decode_op_t *ps_dec_op);
|
||||
|
||||
/*!
|
||||
**************************************************************************
|
||||
* \if Function name : ih264d_export_sei_params \endif
|
||||
*
|
||||
* \brief
|
||||
* Exports sei params from decoder to application.
|
||||
*
|
||||
* \return
|
||||
* 0 on Success and error code otherwise
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
void ih264d_export_sei_params(ivd_sei_decode_op_t *ps_sei_decode_op, dec_struct_t *ps_dec)
|
||||
{
|
||||
WORD32 i4_status = IV_SUCCESS;
|
||||
sei *ps_sei = (sei *)ps_dec->pv_disp_sei_params;
|
||||
|
||||
i4_status = ih264d_export_sei_mdcv_params(ps_sei_decode_op, ps_sei, &ps_dec->s_sei_export);
|
||||
i4_status = ih264d_export_sei_cll_params(ps_sei_decode_op, ps_sei, &ps_dec->s_sei_export);
|
||||
i4_status = ih264d_export_sei_ave_params(ps_sei_decode_op, ps_sei, &ps_dec->s_sei_export);
|
||||
i4_status = ih264d_export_sei_ccv_params(ps_sei_decode_op, ps_sei, &ps_dec->s_sei_export);
|
||||
|
||||
UNUSED(i4_status);
|
||||
}
|
||||
|
||||
static IV_API_CALL_STATUS_T api_check_struct_sanity(iv_obj_t *ps_handle,
|
||||
void *pv_api_ip,
|
||||
void *pv_api_op)
|
||||
|
|
@ -777,6 +818,114 @@ static IV_API_CALL_STATUS_T api_check_struct_sanity(iv_obj_t *ps_handle,
|
|||
|
||||
break;
|
||||
}
|
||||
case IH264D_CMD_CTL_GET_SEI_MDCV_PARAMS:
|
||||
{
|
||||
ih264d_ctl_get_sei_mdcv_params_ip_t *ps_ip;
|
||||
ih264d_ctl_get_sei_mdcv_params_op_t *ps_op;
|
||||
|
||||
ps_ip = (ih264d_ctl_get_sei_mdcv_params_ip_t *)pv_api_ip;
|
||||
ps_op = (ih264d_ctl_get_sei_mdcv_params_op_t *)pv_api_op;
|
||||
|
||||
if(ps_ip->u4_size != sizeof(ih264d_ctl_get_sei_mdcv_params_ip_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVD_IP_API_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(ps_op->u4_size != sizeof(ih264d_ctl_get_sei_mdcv_params_op_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVD_OP_API_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case IH264D_CMD_CTL_GET_SEI_CLL_PARAMS:
|
||||
{
|
||||
ih264d_ctl_get_sei_cll_params_ip_t *ps_ip;
|
||||
ih264d_ctl_get_sei_cll_params_op_t *ps_op;
|
||||
|
||||
ps_ip = (ih264d_ctl_get_sei_cll_params_ip_t *)pv_api_ip;
|
||||
ps_op = (ih264d_ctl_get_sei_cll_params_op_t *)pv_api_op;
|
||||
|
||||
if(ps_ip->u4_size != sizeof(ih264d_ctl_get_sei_cll_params_ip_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVD_IP_API_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(ps_op->u4_size != sizeof(ih264d_ctl_get_sei_cll_params_op_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVD_OP_API_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case IH264D_CMD_CTL_GET_SEI_AVE_PARAMS:
|
||||
{
|
||||
ih264d_ctl_get_sei_ave_params_ip_t *ps_ip;
|
||||
ih264d_ctl_get_sei_ave_params_op_t *ps_op;
|
||||
|
||||
ps_ip = (ih264d_ctl_get_sei_ave_params_ip_t *)pv_api_ip;
|
||||
ps_op = (ih264d_ctl_get_sei_ave_params_op_t *)pv_api_op;
|
||||
|
||||
if(ps_ip->u4_size != sizeof(ih264d_ctl_get_sei_ave_params_ip_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVD_IP_API_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(ps_op->u4_size != sizeof(ih264d_ctl_get_sei_ave_params_op_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVD_OP_API_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case IH264D_CMD_CTL_GET_SEI_CCV_PARAMS:
|
||||
{
|
||||
ih264d_ctl_get_sei_ccv_params_ip_t *ps_ip;
|
||||
ih264d_ctl_get_sei_ccv_params_op_t *ps_op;
|
||||
|
||||
ps_ip = (ih264d_ctl_get_sei_ccv_params_ip_t *)pv_api_ip;
|
||||
ps_op = (ih264d_ctl_get_sei_ccv_params_op_t *)pv_api_op;
|
||||
|
||||
if(ps_ip->u4_size != sizeof(ih264d_ctl_get_sei_ccv_params_ip_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVD_IP_API_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(ps_op->u4_size != sizeof(ih264d_ctl_get_sei_ccv_params_op_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVD_OP_API_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case IH264D_CMD_CTL_SET_NUM_CORES:
|
||||
{
|
||||
ih264d_ctl_set_num_cores_ip_t *ps_ip;
|
||||
|
|
@ -939,6 +1088,9 @@ void ih264d_init_decoder(void * ps_dec_params)
|
|||
size = sizeof(sei);
|
||||
memset(ps_dec->ps_sei, 0, size);
|
||||
|
||||
size = sizeof(sei);
|
||||
memset(ps_dec->ps_sei_parse, 0, size);
|
||||
|
||||
size = sizeof(dpb_commands_t);
|
||||
memset(ps_dec->ps_dpb_cmds, 0, size);
|
||||
|
||||
|
|
@ -1163,6 +1315,7 @@ WORD32 ih264d_free_static_bufs(iv_obj_t *dec_hdl)
|
|||
PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_pic_buf_base);
|
||||
PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_dec_err_status);
|
||||
PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_sei);
|
||||
PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_sei_parse);
|
||||
PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_dpb_cmds);
|
||||
PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_bitstrm);
|
||||
PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_cur_slice);
|
||||
|
|
@ -1334,6 +1487,12 @@ WORD32 ih264d_allocate_static_bufs(iv_obj_t **dec_hdl, void *pv_api_ip, void *pv
|
|||
memset(pv_buf, 0, size);
|
||||
ps_dec->ps_sei = (sei *)pv_buf;
|
||||
|
||||
size = sizeof(sei);
|
||||
pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
|
||||
RETURN_IF((NULL == pv_buf), IV_FAIL);
|
||||
memset(pv_buf, 0, size);
|
||||
ps_dec->ps_sei_parse = (sei *)pv_buf;
|
||||
|
||||
size = sizeof(dpb_commands_t);
|
||||
pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
|
||||
RETURN_IF((NULL == pv_buf), IV_FAIL);
|
||||
|
|
@ -1639,6 +1798,10 @@ UWORD32 ih264d_map_error(UWORD32 i4_err_status)
|
|||
case ERROR_INV_RANGE_QP_T:
|
||||
case ERROR_INV_SPS_PPS_T:
|
||||
case ERROR_INV_SLICE_HDR_T:
|
||||
case ERROR_INV_SEI_MDCV_PARAMS:
|
||||
case ERROR_INV_SEI_CLL_PARAMS:
|
||||
case ERROR_INV_SEI_AVE_PARAMS:
|
||||
case ERROR_INV_SEI_CCV_PARAMS:
|
||||
temp = 1 << IVD_CORRUPTEDHEADER;
|
||||
break;
|
||||
|
||||
|
|
@ -2037,6 +2200,8 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
ps_dec->u4_output_present = 1;
|
||||
|
||||
}
|
||||
ih264d_export_sei_params(&ps_dec_op->s_sei_decode_op, ps_dec);
|
||||
|
||||
ih264d_release_display_field(ps_dec, &(ps_dec->s_disp_op));
|
||||
|
||||
ps_dec_op->u4_pic_wd = (UWORD32)ps_dec->u2_disp_width;
|
||||
|
|
@ -3341,7 +3506,22 @@ WORD32 ih264d_ctl(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
|||
ret = ih264d_get_vui_params(dec_hdl, (void *)pv_api_ip,
|
||||
(void *)pv_api_op);
|
||||
break;
|
||||
|
||||
case IH264D_CMD_CTL_GET_SEI_MDCV_PARAMS:
|
||||
ret = ih264d_get_sei_mdcv_params(dec_hdl, (void *)pv_api_ip,
|
||||
(void *)pv_api_op);
|
||||
break;
|
||||
case IH264D_CMD_CTL_GET_SEI_CLL_PARAMS:
|
||||
ret = ih264d_get_sei_cll_params(dec_hdl, (void *)pv_api_ip,
|
||||
(void *)pv_api_op);
|
||||
break;
|
||||
case IH264D_CMD_CTL_GET_SEI_AVE_PARAMS:
|
||||
ret = ih264d_get_sei_ave_params(dec_hdl, (void *)pv_api_ip,
|
||||
(void *)pv_api_op);
|
||||
break;
|
||||
case IH264D_CMD_CTL_GET_SEI_CCV_PARAMS:
|
||||
ret = ih264d_get_sei_ccv_params(dec_hdl, (void *)pv_api_ip,
|
||||
(void *)pv_api_op);
|
||||
break;
|
||||
case IH264D_CMD_CTL_SET_PROCESSOR:
|
||||
ret = ih264d_set_processor(dec_hdl, (void *)pv_api_ip,
|
||||
(void *)pv_api_op);
|
||||
|
|
@ -3634,6 +3814,238 @@ WORD32 ih264d_get_vui_params(iv_obj_t *dec_hdl,
|
|||
|
||||
return IV_SUCCESS;
|
||||
}
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_get_sei_mdcv_params */
|
||||
/* */
|
||||
/* Description : This function populates SEI mdcv message in */
|
||||
/* output structure */
|
||||
/* Inputs : iv_obj_t decoder handle */
|
||||
/* : pv_api_ip pointer to input structure */
|
||||
/* : pv_api_op pointer to output structure */
|
||||
/* Outputs : */
|
||||
/* Returns : returns 0; 1 with error code when MDCV is not present */
|
||||
/* */
|
||||
/* Issues : none */
|
||||
/* */
|
||||
/* Revision History: */
|
||||
/* */
|
||||
/* DD MM YYYY Author(s) Changes (Describe the changes made) */
|
||||
/* */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
WORD32 ih264d_get_sei_mdcv_params(iv_obj_t *dec_hdl,
|
||||
void *pv_api_ip,
|
||||
void *pv_api_op)
|
||||
{
|
||||
ih264d_ctl_get_sei_mdcv_params_ip_t *ps_ip;
|
||||
ih264d_ctl_get_sei_mdcv_params_op_t *ps_op;
|
||||
dec_struct_t *ps_dec = dec_hdl->pv_codec_handle;
|
||||
sei_mdcv_params_t *ps_sei_mdcv;
|
||||
WORD32 i4_count;
|
||||
|
||||
ps_ip = (ih264d_ctl_get_sei_mdcv_params_ip_t *)pv_api_ip;
|
||||
ps_op = (ih264d_ctl_get_sei_mdcv_params_op_t *)pv_api_op;
|
||||
UNUSED(ps_ip);
|
||||
|
||||
if(0 == ps_dec->s_sei_export.u1_sei_mdcv_params_present_flag)
|
||||
{
|
||||
ps_op->u4_error_code = ERROR_SEI_MDCV_PARAMS_NOT_FOUND;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
ps_sei_mdcv = &ps_dec->s_sei_export.s_sei_mdcv_params;
|
||||
|
||||
for(i4_count = 0; i4_count < NUM_SEI_MDCV_PRIMARIES; i4_count++)
|
||||
{
|
||||
ps_op->au2_display_primaries_x[i4_count] = ps_sei_mdcv->au2_display_primaries_x[i4_count];
|
||||
ps_op->au2_display_primaries_y[i4_count] = ps_sei_mdcv->au2_display_primaries_y[i4_count];
|
||||
}
|
||||
|
||||
ps_op->u2_white_point_x = ps_sei_mdcv->u2_white_point_x;
|
||||
ps_op->u2_white_point_y = ps_sei_mdcv->u2_white_point_y;
|
||||
ps_op->u4_max_display_mastering_luminance = ps_sei_mdcv->u4_max_display_mastering_luminance;
|
||||
ps_op->u4_min_display_mastering_luminance = ps_sei_mdcv->u4_min_display_mastering_luminance;
|
||||
|
||||
return IV_SUCCESS;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_get_sei_cll_params */
|
||||
/* */
|
||||
/* Description : This function populates SEI cll message in */
|
||||
/* output structure */
|
||||
/* Inputs : iv_obj_t decoder handle */
|
||||
/* : pv_api_ip pointer to input structure */
|
||||
/* : pv_api_op pointer to output structure */
|
||||
/* Outputs : */
|
||||
/* Returns : returns 0; 1 with error code when CLL is not present */
|
||||
/* */
|
||||
/* Issues : none */
|
||||
/* */
|
||||
/* Revision History: */
|
||||
/* */
|
||||
/* DD MM YYYY Author(s) Changes (Describe the changes made) */
|
||||
/* */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
WORD32 ih264d_get_sei_cll_params(iv_obj_t *dec_hdl,
|
||||
void *pv_api_ip,
|
||||
void *pv_api_op)
|
||||
{
|
||||
ih264d_ctl_get_sei_cll_params_ip_t *ps_ip;
|
||||
ih264d_ctl_get_sei_cll_params_op_t *ps_op;
|
||||
dec_struct_t *ps_dec = dec_hdl->pv_codec_handle;
|
||||
sei_cll_params_t *ps_sei_cll;
|
||||
|
||||
ps_ip = (ih264d_ctl_get_sei_cll_params_ip_t *)pv_api_ip;
|
||||
ps_op = (ih264d_ctl_get_sei_cll_params_op_t *)pv_api_op;
|
||||
UNUSED(ps_ip);
|
||||
|
||||
if(0 == ps_dec->s_sei_export.u1_sei_cll_params_present_flag)
|
||||
{
|
||||
ps_op->u4_error_code = ERROR_SEI_CLL_PARAMS_NOT_FOUND;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
ps_sei_cll = &ps_dec->s_sei_export.s_sei_cll_params;
|
||||
|
||||
ps_op->u2_max_content_light_level = ps_sei_cll->u2_max_content_light_level;
|
||||
ps_op->u2_max_pic_average_light_level = ps_sei_cll->u2_max_pic_average_light_level;
|
||||
|
||||
return IV_SUCCESS;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_get_sei_ave_params */
|
||||
/* */
|
||||
/* Description : This function populates SEI ave message in */
|
||||
/* output structure */
|
||||
/* Inputs : iv_obj_t decoder handle */
|
||||
/* : pv_api_ip pointer to input structure */
|
||||
/* : pv_api_op pointer to output structure */
|
||||
/* Outputs : */
|
||||
/* Returns : returns 0; 1 with error code when AVE is not present */
|
||||
/* */
|
||||
/* Issues : none */
|
||||
/* */
|
||||
/* Revision History: */
|
||||
/* */
|
||||
/* DD MM YYYY Author(s) Changes (Describe the changes made) */
|
||||
/* */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
WORD32 ih264d_get_sei_ave_params(iv_obj_t *dec_hdl,
|
||||
void *pv_api_ip,
|
||||
void *pv_api_op)
|
||||
{
|
||||
ih264d_ctl_get_sei_ave_params_ip_t *ps_ip;
|
||||
ih264d_ctl_get_sei_ave_params_op_t *ps_op;
|
||||
dec_struct_t *ps_dec = dec_hdl->pv_codec_handle;
|
||||
sei_ave_params_t *ps_sei_ave;
|
||||
|
||||
ps_ip = (ih264d_ctl_get_sei_ave_params_ip_t *)pv_api_ip;
|
||||
ps_op = (ih264d_ctl_get_sei_ave_params_op_t *)pv_api_op;
|
||||
UNUSED(ps_ip);
|
||||
|
||||
if(0 == ps_dec->s_sei_export.u1_sei_ave_params_present_flag)
|
||||
{
|
||||
ps_op->u4_error_code = ERROR_SEI_AVE_PARAMS_NOT_FOUND;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
ps_sei_ave = &ps_dec->s_sei_export.s_sei_ave_params;
|
||||
|
||||
ps_op->u4_ambient_illuminance = ps_sei_ave->u4_ambient_illuminance;
|
||||
ps_op->u2_ambient_light_x = ps_sei_ave->u2_ambient_light_x;
|
||||
ps_op->u2_ambient_light_y = ps_sei_ave->u2_ambient_light_y;
|
||||
|
||||
return IV_SUCCESS;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_get_sei_ccv_params */
|
||||
/* */
|
||||
/* Description : This function populates SEI mdcv message in */
|
||||
/* output structure */
|
||||
/* Inputs : iv_obj_t decoder handle */
|
||||
/* : pv_api_ip pointer to input structure */
|
||||
/* : pv_api_op pointer to output structure */
|
||||
/* Outputs : */
|
||||
/* Returns : returns 0; 1 with error code when CCV is not present */
|
||||
/* */
|
||||
/* Issues : none */
|
||||
/* */
|
||||
/* Revision History: */
|
||||
/* */
|
||||
/* DD MM YYYY Author(s) Changes (Describe the changes made) */
|
||||
/* */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
WORD32 ih264d_get_sei_ccv_params(iv_obj_t *dec_hdl,
|
||||
void *pv_api_ip,
|
||||
void *pv_api_op)
|
||||
{
|
||||
ih264d_ctl_get_sei_ccv_params_ip_t *ps_ip;
|
||||
ih264d_ctl_get_sei_ccv_params_op_t *ps_op;
|
||||
dec_struct_t *ps_dec = dec_hdl->pv_codec_handle;
|
||||
sei_ccv_params_t *ps_sei_ccv;
|
||||
WORD32 i4_count;
|
||||
|
||||
ps_ip = (ih264d_ctl_get_sei_ccv_params_ip_t *)pv_api_ip;
|
||||
ps_op = (ih264d_ctl_get_sei_ccv_params_op_t *)pv_api_op;
|
||||
UNUSED(ps_ip);
|
||||
|
||||
if(0 == ps_dec->s_sei_export.u1_sei_ccv_params_present_flag)
|
||||
{
|
||||
ps_op->u4_error_code = ERROR_SEI_CCV_PARAMS_NOT_FOUND;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
ps_sei_ccv = &ps_dec->s_sei_export.s_sei_ccv_params;
|
||||
|
||||
ps_op->u1_ccv_cancel_flag = ps_sei_ccv->u1_ccv_cancel_flag;
|
||||
|
||||
if(0 == ps_op->u1_ccv_cancel_flag)
|
||||
{
|
||||
ps_op->u1_ccv_persistence_flag = ps_sei_ccv->u1_ccv_persistence_flag;
|
||||
ps_op->u1_ccv_primaries_present_flag = ps_sei_ccv->u1_ccv_primaries_present_flag;
|
||||
ps_op->u1_ccv_min_luminance_value_present_flag =
|
||||
ps_sei_ccv->u1_ccv_min_luminance_value_present_flag;
|
||||
ps_op->u1_ccv_max_luminance_value_present_flag =
|
||||
ps_sei_ccv->u1_ccv_max_luminance_value_present_flag;
|
||||
ps_op->u1_ccv_avg_luminance_value_present_flag =
|
||||
ps_sei_ccv->u1_ccv_avg_luminance_value_present_flag;
|
||||
ps_op->u1_ccv_reserved_zero_2bits = ps_sei_ccv->u1_ccv_reserved_zero_2bits;
|
||||
|
||||
if(1 == ps_sei_ccv->u1_ccv_primaries_present_flag)
|
||||
{
|
||||
for(i4_count = 0; i4_count < NUM_SEI_CCV_PRIMARIES; i4_count++)
|
||||
{
|
||||
ps_op->ai4_ccv_primaries_x[i4_count] = ps_sei_ccv->ai4_ccv_primaries_x[i4_count];
|
||||
ps_op->ai4_ccv_primaries_y[i4_count] = ps_sei_ccv->ai4_ccv_primaries_y[i4_count];
|
||||
}
|
||||
}
|
||||
|
||||
if(1 == ps_sei_ccv->u1_ccv_min_luminance_value_present_flag)
|
||||
{
|
||||
ps_op->u4_ccv_min_luminance_value = ps_sei_ccv->u4_ccv_min_luminance_value;
|
||||
}
|
||||
if(1 == ps_sei_ccv->u1_ccv_max_luminance_value_present_flag)
|
||||
{
|
||||
ps_op->u4_ccv_max_luminance_value = ps_sei_ccv->u4_ccv_max_luminance_value;
|
||||
}
|
||||
if(1 == ps_sei_ccv->u1_ccv_avg_luminance_value_present_flag)
|
||||
{
|
||||
ps_op->u4_ccv_avg_luminance_value = ps_sei_ccv->u4_ccv_avg_luminance_value;
|
||||
}
|
||||
}
|
||||
|
||||
return IV_SUCCESS;
|
||||
}
|
||||
|
||||
WORD32 ih264d_set_num_cores(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
|
||||
{
|
||||
|
|
@ -3691,6 +4103,8 @@ void ih264d_fill_output_struct_from_context(dec_struct_t *ps_dec,
|
|||
ps_dec_op->e4_fld_type = ps_dec->s_disp_op.e4_fld_type;
|
||||
ps_dec_op->u4_ts = ps_dec->s_disp_op.u4_ts;
|
||||
ps_dec_op->u4_disp_buf_id = ps_dec->s_disp_op.u4_disp_buf_id;
|
||||
|
||||
ih264d_export_sei_params(&ps_dec_op->s_sei_decode_op, ps_dec);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -608,6 +608,38 @@ enum
|
|||
#define NUM_COEFFS_IN_4x4BLK 16
|
||||
#define CABAC_BITS_TO_READ 23
|
||||
|
||||
#define DISPLAY_PRIMARIES_X_UPPER_LIMIT 37000
|
||||
#define DISPLAY_PRIMARIES_X_LOWER_LIMIT 5
|
||||
#define DISPLAY_PRIMARIES_X_DIVISION_FACTOR 5
|
||||
|
||||
#define DISPLAY_PRIMARIES_Y_UPPER_LIMIT 42000
|
||||
#define DISPLAY_PRIMARIES_Y_LOWER_LIMIT 5
|
||||
#define DISPLAY_PRIMARIES_Y_DIVISION_FACTOR 5
|
||||
|
||||
#define WHITE_POINT_X_UPPER_LIMIT 37000
|
||||
#define WHITE_POINT_X_LOWER_LIMIT 5
|
||||
#define WHITE_POINT_X_DIVISION_FACTOR 5
|
||||
|
||||
#define WHITE_POINT_Y_UPPER_LIMIT 42000
|
||||
#define WHITE_POINT_Y_LOWER_LIMIT 5
|
||||
#define WHITE_POINT_Y_DIVISION_FACTOR 5
|
||||
|
||||
#define MAX_DISPLAY_MASTERING_LUMINANCE_UPPER_LIMIT 100000000
|
||||
#define MAX_DISPLAY_MASTERING_LUMINANCE_LOWER_LIMIT 50000
|
||||
#define MAX_DISPLAY_MASTERING_LUMINANCE_DIVISION_FACTOR 10000
|
||||
|
||||
#define MIN_DISPLAY_MASTERING_LUMINANCE_UPPER_LIMIT 50000
|
||||
#define MIN_DISPLAY_MASTERING_LUMINANCE_LOWER_LIMIT 1
|
||||
|
||||
#define AMBIENT_LIGHT_X_UPPER_LIMIT 50000
|
||||
#define AMBIENT_LIGHT_Y_UPPER_LIMIT 50000
|
||||
|
||||
#define CCV_PRIMARIES_X_UPPER_LIMIT 5000000
|
||||
#define CCV_PRIMARIES_X_LOWER_LIMIT -5000000
|
||||
#define CCV_PRIMARIES_Y_UPPER_LIMIT 5000000
|
||||
#define CCV_PRIMARIES_Y_LOWER_LIMIT -5000000
|
||||
|
||||
|
||||
#define MEMSET_16BYTES(pu4_start,value) \
|
||||
{ \
|
||||
memset(pu4_start,value,16); \
|
||||
|
|
|
|||
|
|
@ -114,7 +114,15 @@ typedef enum
|
|||
ERROR_NEW_FRAME_EXPECTED = 0x94,
|
||||
ERROR_INCOMPLETE_FRAME = 0x95,
|
||||
ERROR_VUI_PARAMS_NOT_FOUND = 0x96,
|
||||
ERROR_INV_POC = 0x97
|
||||
ERROR_INV_POC = 0x97,
|
||||
ERROR_SEI_MDCV_PARAMS_NOT_FOUND = 0x98,
|
||||
ERROR_SEI_CLL_PARAMS_NOT_FOUND = 0x99,
|
||||
ERROR_SEI_AVE_PARAMS_NOT_FOUND = 0x9A,
|
||||
ERROR_SEI_CCV_PARAMS_NOT_FOUND = 0x9B,
|
||||
ERROR_INV_SEI_MDCV_PARAMS = 0x9C,
|
||||
ERROR_INV_SEI_CLL_PARAMS = 0x9D,
|
||||
ERROR_INV_SEI_AVE_PARAMS = 0x9E,
|
||||
ERROR_INV_SEI_CCV_PARAMS = 0x9F
|
||||
|
||||
} h264_decoder_error_code_t;
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,83 @@
|
|||
#include "ivd.h"
|
||||
#include "ih264d.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_get_pre_sei_params */
|
||||
/* */
|
||||
/* Description : Gets valid pre-sei params in decoder struct from parse */
|
||||
/* struct. */
|
||||
/* Inputs : u1_nal_unit_type slice type */
|
||||
/* ps_dec Decoder parameters */
|
||||
/* Globals : None */
|
||||
/* Outputs : None */
|
||||
/* Returns : None */
|
||||
/* */
|
||||
/* Issues : None */
|
||||
/* */
|
||||
/* Revision History: */
|
||||
/* */
|
||||
/* DD MM YYYY Author(s) Changes (Describe the changes made) */
|
||||
/* Draft */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
void ih264d_get_pre_sei_params(dec_struct_t *ps_dec, UWORD8 u1_nal_unit_type)
|
||||
{
|
||||
if((NULL != ps_dec->ps_sei) &&
|
||||
((0 == ps_dec->ps_sei->s_sei_ccv_params.u1_ccv_cancel_flag) &&
|
||||
(0 == ps_dec->ps_sei->s_sei_ccv_params.u1_ccv_persistence_flag)))
|
||||
{
|
||||
ps_dec->ps_sei->u1_sei_ccv_params_present_flag = 0;
|
||||
memset(&ps_dec->ps_sei->s_sei_ccv_params, 0, sizeof(sei_ccv_params_t));
|
||||
}
|
||||
|
||||
if((NULL != ps_dec->ps_cur_sps) &&
|
||||
((1 == ps_dec->ps_cur_sps->u1_vui_parameters_present_flag) &&
|
||||
((2 != ps_dec->ps_cur_sps->s_vui.u1_colour_primaries) &&
|
||||
(2 != ps_dec->ps_cur_sps->s_vui.u1_matrix_coeffs) &&
|
||||
(2 != ps_dec->ps_cur_sps->s_vui.u1_tfr_chars) &&
|
||||
(4 != ps_dec->ps_cur_sps->s_vui.u1_tfr_chars) &&
|
||||
(5 != ps_dec->ps_cur_sps->s_vui.u1_tfr_chars))))
|
||||
{
|
||||
if((1 == ps_dec->ps_sei_parse->u1_sei_ccv_params_present_flag) ||
|
||||
(IDR_SLICE_NAL == u1_nal_unit_type))
|
||||
{
|
||||
ps_dec->ps_sei->u1_sei_ccv_params_present_flag =
|
||||
ps_dec->ps_sei_parse->u1_sei_ccv_params_present_flag;
|
||||
ps_dec->ps_sei->s_sei_ccv_params = ps_dec->ps_sei_parse->s_sei_ccv_params;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_dec->ps_sei->u1_sei_ccv_params_present_flag = 0;
|
||||
memset(&ps_dec->ps_sei->s_sei_ccv_params, 0, sizeof(sei_ccv_params_t));
|
||||
}
|
||||
|
||||
if(IDR_SLICE_NAL == u1_nal_unit_type)
|
||||
{
|
||||
ps_dec->ps_sei->u1_sei_mdcv_params_present_flag =
|
||||
ps_dec->ps_sei_parse->u1_sei_mdcv_params_present_flag;
|
||||
ps_dec->ps_sei->s_sei_mdcv_params = ps_dec->ps_sei_parse->s_sei_mdcv_params;
|
||||
ps_dec->ps_sei->u1_sei_cll_params_present_flag =
|
||||
ps_dec->ps_sei_parse->u1_sei_cll_params_present_flag;
|
||||
ps_dec->ps_sei->s_sei_cll_params = ps_dec->ps_sei_parse->s_sei_cll_params;
|
||||
ps_dec->ps_sei->u1_sei_ave_params_present_flag =
|
||||
ps_dec->ps_sei_parse->u1_sei_ave_params_present_flag;
|
||||
ps_dec->ps_sei->s_sei_ave_params = ps_dec->ps_sei_parse->s_sei_ave_params;
|
||||
}
|
||||
|
||||
ps_dec->ps_sei_parse->u1_sei_mdcv_params_present_flag = 0;
|
||||
memset(&ps_dec->ps_sei_parse->s_sei_mdcv_params, 0, sizeof(sei_mdcv_params_t));
|
||||
ps_dec->ps_sei_parse->u1_sei_cll_params_present_flag = 0;
|
||||
memset(&ps_dec->ps_sei_parse->s_sei_cll_params, 0, sizeof(sei_cll_params_t));
|
||||
ps_dec->ps_sei_parse->u1_sei_ave_params_present_flag = 0;
|
||||
memset(&ps_dec->ps_sei_parse->s_sei_ave_params, 0, sizeof(sei_ave_params_t));
|
||||
ps_dec->ps_sei_parse->u1_sei_ccv_params_present_flag = 0;
|
||||
memset(&ps_dec->ps_sei_parse->s_sei_ccv_params, 0, sizeof(sei_ccv_params_t));
|
||||
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_parse_slice_partition */
|
||||
|
|
@ -1169,6 +1246,7 @@ WORD32 ih264d_parse_nal_unit(iv_obj_t *dec_hdl,
|
|||
{
|
||||
if(ps_dec->i4_header_decoded == 3)
|
||||
{
|
||||
ih264d_get_pre_sei_params(ps_dec, u1_nal_unit_type);
|
||||
/* ! */
|
||||
ps_dec->u4_slice_start_code_found = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@ WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec,
|
|||
ps_dec->ps_cur_pic = ps_cur_pic;
|
||||
ps_dec->u1_pic_buf_id = cur_pic_buf_id;
|
||||
ps_cur_pic->u4_ts = ps_dec->u4_ts;
|
||||
|
||||
memcpy(&ps_cur_pic->s_sei_pic, ps_dec->ps_sei, sizeof(sei));
|
||||
|
||||
ps_cur_pic->u1_mv_buf_id = cur_mv_buf_id;
|
||||
ps_dec->au1_pic_buf_id_mv_buf_id_map[cur_pic_buf_id] = cur_mv_buf_id;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* File Name : ih264d_sei.c */
|
||||
/* File Name : ih264d_sei.c */
|
||||
/* */
|
||||
/* Description : This file contains routines to parse SEI NAL's */
|
||||
/* */
|
||||
|
|
@ -35,10 +35,11 @@
|
|||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "ih264_typedefs.h"
|
||||
#include "ih264_macros.h"
|
||||
#include "ih264_platform_macros.h"
|
||||
#include "ih264d_sei.h"
|
||||
#include "ih264d_bitstrm.h"
|
||||
#include "ih264d_structs.h"
|
||||
#include "ih264d_error_handler.h"
|
||||
|
|
@ -48,15 +49,15 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_parse_buffering_period */
|
||||
/* Function Name : ih264d_parse_buffering_period */
|
||||
/* */
|
||||
/* Description : This function parses SEI message buffering_period */
|
||||
/* Inputs : ps_buf_prd pointer to struct buf_period_t */
|
||||
/* ps_bitstrm Bitstream */
|
||||
/* Inputs : ps_buf_prd pointer to struct buf_period_t */
|
||||
/* ps_bitstrm Bitstream */
|
||||
/* Globals : None */
|
||||
/* Processing : Parses SEI payload buffering period. */
|
||||
/* Outputs : None */
|
||||
/* Returns : None */
|
||||
/* Return : 0 for successfull parsing, else error message */
|
||||
/* */
|
||||
/* Issues : Not implemented fully */
|
||||
/* */
|
||||
|
|
@ -84,7 +85,7 @@ WORD32 ih264d_parse_buffering_period(buf_period_t *ps_buf_prd,
|
|||
return ERROR_INVALID_SEQ_PARAM;
|
||||
ps_seq = &ps_dec->ps_sps[u1_seq_parameter_set_id];
|
||||
if(TRUE != ps_seq->u1_is_valid)
|
||||
return (-1);
|
||||
return ERROR_INVALID_SEQ_PARAM;
|
||||
|
||||
ps_dec->ps_sei->u1_seq_param_set_id = u1_seq_parameter_set_id;
|
||||
ps_dec->ps_cur_sps = ps_seq;
|
||||
|
|
@ -120,21 +121,21 @@ WORD32 ih264d_parse_buffering_period(buf_period_t *ps_buf_prd,
|
|||
}
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_parse_pic_timing */
|
||||
/* Function Name : ih264d_parse_pic_timing */
|
||||
/* */
|
||||
/* Description : This function parses SEI message pic_timing */
|
||||
/* Inputs : ps_bitstrm Bitstream */
|
||||
/* Inputs : ps_bitstrm Bitstream */
|
||||
/* ps_dec Poniter decoder context */
|
||||
/* ui4_payload_size pay load i4_size */
|
||||
/* ui4_payload_size pay load i4_size */
|
||||
/* Globals : None */
|
||||
/* Processing : Parses SEI payload picture timing */
|
||||
/* Outputs : None */
|
||||
/* Returns : None */
|
||||
/* Return : 0 */
|
||||
/* */
|
||||
/* Issues : Not implemented fully */
|
||||
/* */
|
||||
|
|
@ -204,21 +205,21 @@ WORD32 ih264d_parse_pic_timing(dec_bit_stream_t *ps_bitstrm,
|
|||
ih264d_flush_bits_h264(ps_bitstrm,
|
||||
(ui4_payload_size << 3) - u4_bits_consumed);
|
||||
|
||||
return (0);
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_parse_recovery_point */
|
||||
/* Function Name : ih264d_parse_recovery_point */
|
||||
/* */
|
||||
/* Description : This function parses SEI message recovery point */
|
||||
/* Inputs : ps_bitstrm Bitstream */
|
||||
/* Inputs : ps_bitstrm Bitstream */
|
||||
/* ps_dec Poniter decoder context */
|
||||
/* ui4_payload_size pay load i4_size */
|
||||
/* ui4_payload_size pay load i4_size */
|
||||
/* Globals : None */
|
||||
/* Processing : Parses SEI payload picture timing */
|
||||
/* Outputs : None */
|
||||
/* Returns : None */
|
||||
/* Return : 0 */
|
||||
/* */
|
||||
/* Issues : Not implemented fully */
|
||||
/* */
|
||||
|
|
@ -245,22 +246,415 @@ WORD32 ih264d_parse_recovery_point(dec_bit_stream_t *ps_bitstrm,
|
|||
ps_sei->u1_broken_link_flag = ih264d_get_bit_h264(ps_bitstrm);
|
||||
ps_sei->u1_changing_slice_grp_idc = ih264d_get_bits_h264(ps_bitstrm, 2);
|
||||
|
||||
return (0);
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_parse_sei_payload */
|
||||
/* Function Name : ih264d_parse_mdcv */
|
||||
/* */
|
||||
/* Description : This function parses SEI message mdcv */
|
||||
/* Inputs : ps_bitstrm Bitstream */
|
||||
/* ps_dec Poniter decoder context */
|
||||
/* ui4_payload_size pay load i4_size */
|
||||
/* Globals : None */
|
||||
/* Processing : */
|
||||
/* Outputs : None */
|
||||
/* Return : 0 for successfull parsing, else -1 */
|
||||
/* */
|
||||
/* Issues : */
|
||||
/* */
|
||||
/* Revision History: */
|
||||
/* */
|
||||
/* DD MM YYYY Author(s) Changes (Describe the changes made) */
|
||||
/* Draft */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
WORD32 ih264d_parse_mdcv(dec_bit_stream_t *ps_bitstrm,
|
||||
dec_struct_t *ps_dec,
|
||||
UWORD32 ui4_payload_size)
|
||||
{
|
||||
sei *ps_sei = ps_dec->ps_sei_parse;
|
||||
dec_err_status_t *ps_err = ps_dec->ps_dec_err_status;
|
||||
UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
|
||||
UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
|
||||
UWORD32 u4_count;
|
||||
UNUSED(ui4_payload_size);
|
||||
|
||||
if((ps_dec == NULL) || (ps_sei == NULL))
|
||||
{
|
||||
return NOT_OK;
|
||||
}
|
||||
|
||||
ps_sei->u1_sei_mdcv_params_present_flag = 1;
|
||||
|
||||
/* display primaries x */
|
||||
for(u4_count = 0; u4_count < NUM_SEI_MDCV_PRIMARIES; u4_count++)
|
||||
{
|
||||
ps_sei->s_sei_mdcv_params.au2_display_primaries_x[u4_count] =
|
||||
(UWORD16)ih264d_get_bits_h264(ps_bitstrm, 16);
|
||||
|
||||
if((ps_sei->s_sei_mdcv_params.au2_display_primaries_x[u4_count] >
|
||||
DISPLAY_PRIMARIES_X_UPPER_LIMIT) ||
|
||||
(ps_sei->s_sei_mdcv_params.au2_display_primaries_x[u4_count] <
|
||||
DISPLAY_PRIMARIES_X_LOWER_LIMIT) ||
|
||||
((ps_sei->s_sei_mdcv_params.au2_display_primaries_x[u4_count] %
|
||||
DISPLAY_PRIMARIES_X_DIVISION_FACTOR) != 0))
|
||||
{
|
||||
ps_sei->u1_sei_mdcv_params_present_flag = 0;
|
||||
return ERROR_INV_SEI_MDCV_PARAMS;
|
||||
}
|
||||
|
||||
ps_sei->s_sei_mdcv_params.au2_display_primaries_y[u4_count] =
|
||||
(UWORD16)ih264d_get_bits_h264(ps_bitstrm, 16);
|
||||
|
||||
if((ps_sei->s_sei_mdcv_params.au2_display_primaries_y[u4_count] >
|
||||
DISPLAY_PRIMARIES_Y_UPPER_LIMIT) ||
|
||||
(ps_sei->s_sei_mdcv_params.au2_display_primaries_y[u4_count] <
|
||||
DISPLAY_PRIMARIES_Y_LOWER_LIMIT) ||
|
||||
((ps_sei->s_sei_mdcv_params.au2_display_primaries_y[u4_count] %
|
||||
DISPLAY_PRIMARIES_Y_DIVISION_FACTOR) != 0))
|
||||
{
|
||||
ps_sei->u1_sei_mdcv_params_present_flag = 0;
|
||||
return ERROR_INV_SEI_MDCV_PARAMS;
|
||||
}
|
||||
}
|
||||
|
||||
/* white point x */
|
||||
ps_sei->s_sei_mdcv_params.u2_white_point_x = (UWORD16)ih264d_get_bits_h264(ps_bitstrm, 16);
|
||||
|
||||
if((ps_sei->s_sei_mdcv_params.u2_white_point_x > WHITE_POINT_X_UPPER_LIMIT) ||
|
||||
(ps_sei->s_sei_mdcv_params.u2_white_point_x < WHITE_POINT_X_LOWER_LIMIT) ||
|
||||
((ps_sei->s_sei_mdcv_params.u2_white_point_x % WHITE_POINT_X_DIVISION_FACTOR) != 0))
|
||||
{
|
||||
ps_sei->u1_sei_mdcv_params_present_flag = 0;
|
||||
return ERROR_INV_SEI_MDCV_PARAMS;
|
||||
}
|
||||
/* white point y */
|
||||
ps_sei->s_sei_mdcv_params.u2_white_point_y = (UWORD16)ih264d_get_bits_h264(ps_bitstrm, 16);
|
||||
|
||||
if((ps_sei->s_sei_mdcv_params.u2_white_point_y > WHITE_POINT_Y_UPPER_LIMIT) ||
|
||||
(ps_sei->s_sei_mdcv_params.u2_white_point_y < WHITE_POINT_Y_LOWER_LIMIT) ||
|
||||
((ps_sei->s_sei_mdcv_params.u2_white_point_y % WHITE_POINT_Y_DIVISION_FACTOR) != 0))
|
||||
{
|
||||
ps_sei->u1_sei_mdcv_params_present_flag = 0;
|
||||
return ERROR_INV_SEI_MDCV_PARAMS;
|
||||
}
|
||||
/* max display mastering luminance */
|
||||
ps_sei->s_sei_mdcv_params.u4_max_display_mastering_luminance =
|
||||
(UWORD32)ih264d_get_bits_h264(ps_bitstrm, 32);
|
||||
|
||||
if((ps_sei->s_sei_mdcv_params.u4_max_display_mastering_luminance >
|
||||
MAX_DISPLAY_MASTERING_LUMINANCE_UPPER_LIMIT) ||
|
||||
(ps_sei->s_sei_mdcv_params.u4_max_display_mastering_luminance <
|
||||
MAX_DISPLAY_MASTERING_LUMINANCE_LOWER_LIMIT) ||
|
||||
((ps_sei->s_sei_mdcv_params.u4_max_display_mastering_luminance %
|
||||
MAX_DISPLAY_MASTERING_LUMINANCE_DIVISION_FACTOR) != 0))
|
||||
{
|
||||
ps_sei->u1_sei_mdcv_params_present_flag = 0;
|
||||
return ERROR_INV_SEI_MDCV_PARAMS;
|
||||
}
|
||||
/* min display mastering luminance */
|
||||
ps_sei->s_sei_mdcv_params.u4_min_display_mastering_luminance =
|
||||
(UWORD32)ih264d_get_bits_h264(ps_bitstrm, 32);
|
||||
|
||||
if((ps_sei->s_sei_mdcv_params.u4_min_display_mastering_luminance >
|
||||
MIN_DISPLAY_MASTERING_LUMINANCE_UPPER_LIMIT) ||
|
||||
(ps_sei->s_sei_mdcv_params.u4_min_display_mastering_luminance <
|
||||
MIN_DISPLAY_MASTERING_LUMINANCE_LOWER_LIMIT))
|
||||
{
|
||||
ps_sei->u1_sei_mdcv_params_present_flag = 0;
|
||||
return ERROR_INV_SEI_MDCV_PARAMS;
|
||||
}
|
||||
if(ps_sei->s_sei_mdcv_params.u4_max_display_mastering_luminance <=
|
||||
ps_sei->s_sei_mdcv_params.u4_min_display_mastering_luminance)
|
||||
{
|
||||
ps_sei->u1_sei_mdcv_params_present_flag = 0;
|
||||
return ERROR_INV_SEI_MDCV_PARAMS;
|
||||
}
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_parse_cll */
|
||||
/* */
|
||||
/* Description : This function parses SEI message cll */
|
||||
/* Inputs : ps_bitstrm Bitstream */
|
||||
/* ps_dec Poniter decoder context */
|
||||
/* ui4_payload_size pay load i4_size */
|
||||
/* Globals : None */
|
||||
/* Processing : */
|
||||
/* Outputs : None */
|
||||
/* Return : 0 for successfull parsing, else -1 */
|
||||
/* */
|
||||
/* Issues : */
|
||||
/* */
|
||||
/* Revision History: */
|
||||
/* */
|
||||
/* DD MM YYYY Author(s) Changes (Describe the changes made) */
|
||||
/* Draft */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
WORD32 ih264d_parse_cll(dec_bit_stream_t *ps_bitstrm,
|
||||
dec_struct_t *ps_dec,
|
||||
UWORD32 ui4_payload_size)
|
||||
{
|
||||
sei *ps_sei = ps_dec->ps_sei_parse;
|
||||
dec_err_status_t *ps_err = ps_dec->ps_dec_err_status;
|
||||
UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
|
||||
UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
|
||||
UNUSED(ui4_payload_size);
|
||||
|
||||
if((ps_dec == NULL) || (ps_sei == NULL))
|
||||
{
|
||||
return NOT_OK;
|
||||
}
|
||||
|
||||
ps_sei->u1_sei_cll_params_present_flag = 1;
|
||||
|
||||
ps_sei->s_sei_cll_params.u2_max_content_light_level =
|
||||
(UWORD16)ih264d_get_bits_h264(ps_bitstrm, 16);
|
||||
ps_sei->s_sei_cll_params.u2_max_pic_average_light_level =
|
||||
(UWORD16)ih264d_get_bits_h264(ps_bitstrm, 16);
|
||||
/*No any sanity checks done for CLL params*/
|
||||
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_parse_ave */
|
||||
/* */
|
||||
/* Description : This function parses SEI message ave */
|
||||
/* Inputs : ps_bitstrm Bitstream */
|
||||
/* ps_dec Poniter decoder context */
|
||||
/* ui4_payload_size pay load i4_size */
|
||||
/* Globals : None */
|
||||
/* Processing : */
|
||||
/* Outputs : None */
|
||||
/* Return : 0 for successfull parsing, else -1 */
|
||||
/* */
|
||||
/* Issues : */
|
||||
/* */
|
||||
/* Revision History: */
|
||||
/* */
|
||||
/* DD MM YYYY Author(s) Changes (Describe the changes made) */
|
||||
/* Draft */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
WORD32 ih264d_parse_ave(dec_bit_stream_t *ps_bitstrm,
|
||||
dec_struct_t *ps_dec,
|
||||
UWORD32 ui4_payload_size)
|
||||
{
|
||||
sei *ps_sei = ps_dec->ps_sei_parse;
|
||||
dec_err_status_t *ps_err = ps_dec->ps_dec_err_status;
|
||||
UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
|
||||
UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
|
||||
UNUSED(ui4_payload_size);
|
||||
|
||||
if((ps_dec == NULL) || (ps_sei == NULL))
|
||||
{
|
||||
return NOT_OK;
|
||||
}
|
||||
|
||||
ps_sei->u1_sei_ave_params_present_flag = 1;
|
||||
|
||||
ps_sei->s_sei_ave_params.u4_ambient_illuminance = (UWORD32)ih264d_get_bits_h264(ps_bitstrm, 32);
|
||||
if(0 == ps_sei->s_sei_ave_params.u4_ambient_illuminance)
|
||||
{
|
||||
ps_sei->u1_sei_ave_params_present_flag = 0;
|
||||
return ERROR_INV_SEI_AVE_PARAMS;
|
||||
}
|
||||
|
||||
ps_sei->s_sei_ave_params.u2_ambient_light_x = (UWORD16)ih264d_get_bits_h264(ps_bitstrm, 16);
|
||||
if(ps_sei->s_sei_ave_params.u2_ambient_light_x > AMBIENT_LIGHT_X_UPPER_LIMIT)
|
||||
{
|
||||
ps_sei->u1_sei_ave_params_present_flag = 0;
|
||||
return ERROR_INV_SEI_AVE_PARAMS;
|
||||
}
|
||||
|
||||
ps_sei->s_sei_ave_params.u2_ambient_light_y = (UWORD16)ih264d_get_bits_h264(ps_bitstrm, 16);
|
||||
if(ps_sei->s_sei_ave_params.u2_ambient_light_y > AMBIENT_LIGHT_Y_UPPER_LIMIT)
|
||||
{
|
||||
ps_sei->u1_sei_ave_params_present_flag = 0;
|
||||
return ERROR_INV_SEI_AVE_PARAMS;
|
||||
}
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_parse_ccv */
|
||||
/* */
|
||||
/* Description : This function parses SEI message ccv */
|
||||
/* Inputs : ps_bitstrm Bitstream */
|
||||
/* ps_dec Poniter decoder context */
|
||||
/* ui4_payload_size pay load i4_size */
|
||||
/* Globals : None */
|
||||
/* Processing : */
|
||||
/* Outputs : None */
|
||||
/* Return : 0 for successfull parsing, else -1 */
|
||||
/* */
|
||||
/* Issues : */
|
||||
/* */
|
||||
/* Revision History: */
|
||||
/* */
|
||||
/* DD MM YYYY Author(s) Changes (Describe the changes made) */
|
||||
/* Draft */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
WORD32 ih264d_parse_ccv(dec_bit_stream_t *ps_bitstrm,
|
||||
dec_struct_t *ps_dec,
|
||||
UWORD32 ui4_payload_size)
|
||||
{
|
||||
sei *ps_sei = ps_dec->ps_sei_parse;
|
||||
dec_err_status_t *ps_err = ps_dec->ps_dec_err_status;
|
||||
UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
|
||||
UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
|
||||
UWORD32 u4_count;
|
||||
UNUSED(ui4_payload_size);
|
||||
|
||||
if((ps_dec == NULL) || (ps_sei == NULL))
|
||||
{
|
||||
return NOT_OK;
|
||||
}
|
||||
|
||||
ps_sei->u1_sei_ccv_params_present_flag = 0;
|
||||
|
||||
ps_sei->s_sei_ccv_params.u1_ccv_cancel_flag = (UWORD8)ih264d_get_bit_h264(ps_bitstrm);
|
||||
|
||||
if(ps_sei->s_sei_ccv_params.u1_ccv_cancel_flag > 1)
|
||||
{
|
||||
return ERROR_INV_SEI_CCV_PARAMS;
|
||||
}
|
||||
if(0 == ps_sei->s_sei_ccv_params.u1_ccv_cancel_flag)
|
||||
{
|
||||
ps_sei->s_sei_ccv_params.u1_ccv_persistence_flag =
|
||||
(UWORD8)ih264d_get_bit_h264(ps_bitstrm);
|
||||
if(ps_sei->s_sei_ccv_params.u1_ccv_persistence_flag > 1)
|
||||
{
|
||||
return ERROR_INV_SEI_CCV_PARAMS;
|
||||
}
|
||||
ps_sei->s_sei_ccv_params.u1_ccv_primaries_present_flag =
|
||||
(UWORD8)ih264d_get_bit_h264(ps_bitstrm);
|
||||
if(ps_sei->s_sei_ccv_params.u1_ccv_primaries_present_flag > 1)
|
||||
{
|
||||
return ERROR_INV_SEI_CCV_PARAMS;
|
||||
}
|
||||
ps_sei->s_sei_ccv_params.u1_ccv_min_luminance_value_present_flag =
|
||||
(UWORD8)ih264d_get_bit_h264(ps_bitstrm);
|
||||
if(ps_sei->s_sei_ccv_params.u1_ccv_min_luminance_value_present_flag > 1)
|
||||
{
|
||||
return ERROR_INV_SEI_CCV_PARAMS;
|
||||
}
|
||||
ps_sei->s_sei_ccv_params.u1_ccv_max_luminance_value_present_flag =
|
||||
(UWORD8)ih264d_get_bit_h264(ps_bitstrm);
|
||||
if(ps_sei->s_sei_ccv_params.u1_ccv_max_luminance_value_present_flag > 1)
|
||||
{
|
||||
return ERROR_INV_SEI_CCV_PARAMS;
|
||||
}
|
||||
ps_sei->s_sei_ccv_params.u1_ccv_avg_luminance_value_present_flag =
|
||||
(UWORD8)ih264d_get_bit_h264(ps_bitstrm);
|
||||
if(ps_sei->s_sei_ccv_params.u1_ccv_avg_luminance_value_present_flag > 1)
|
||||
{
|
||||
return ERROR_INV_SEI_CCV_PARAMS;
|
||||
}
|
||||
|
||||
if((ps_sei->s_sei_ccv_params.u1_ccv_primaries_present_flag == 0) &&
|
||||
(ps_sei->s_sei_ccv_params.u1_ccv_min_luminance_value_present_flag == 0) &&
|
||||
(ps_sei->s_sei_ccv_params.u1_ccv_max_luminance_value_present_flag == 0) &&
|
||||
(ps_sei->s_sei_ccv_params.u1_ccv_avg_luminance_value_present_flag == 0))
|
||||
{
|
||||
return ERROR_INV_SEI_CCV_PARAMS;
|
||||
}
|
||||
|
||||
ps_sei->s_sei_ccv_params.u1_ccv_reserved_zero_2bits =
|
||||
(UWORD8)ih264d_get_bits_h264(ps_bitstrm, 2);
|
||||
if((ps_sei->s_sei_ccv_params.u1_ccv_reserved_zero_2bits != 0))
|
||||
{
|
||||
return ERROR_INV_SEI_CCV_PARAMS;
|
||||
}
|
||||
|
||||
/* ccv primaries */
|
||||
if(1 == ps_sei->s_sei_ccv_params.u1_ccv_primaries_present_flag)
|
||||
{
|
||||
for(u4_count = 0; u4_count < NUM_SEI_CCV_PRIMARIES; u4_count++)
|
||||
{
|
||||
ps_sei->s_sei_ccv_params.ai4_ccv_primaries_x[u4_count] =
|
||||
(WORD32)ih264d_get_bits_h264(ps_bitstrm, 32);
|
||||
if((ps_sei->s_sei_ccv_params.ai4_ccv_primaries_x[u4_count] >
|
||||
CCV_PRIMARIES_X_UPPER_LIMIT) ||
|
||||
(ps_sei->s_sei_ccv_params.ai4_ccv_primaries_x[u4_count] <
|
||||
CCV_PRIMARIES_X_LOWER_LIMIT))
|
||||
{
|
||||
return ERROR_INV_SEI_CCV_PARAMS;
|
||||
}
|
||||
|
||||
ps_sei->s_sei_ccv_params.ai4_ccv_primaries_y[u4_count] =
|
||||
(WORD32)ih264d_get_bits_h264(ps_bitstrm, 32);
|
||||
if((ps_sei->s_sei_ccv_params.ai4_ccv_primaries_y[u4_count] >
|
||||
CCV_PRIMARIES_Y_UPPER_LIMIT) ||
|
||||
(ps_sei->s_sei_ccv_params.ai4_ccv_primaries_y[u4_count] <
|
||||
CCV_PRIMARIES_Y_LOWER_LIMIT))
|
||||
{
|
||||
return ERROR_INV_SEI_CCV_PARAMS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(1 == ps_sei->s_sei_ccv_params.u1_ccv_min_luminance_value_present_flag)
|
||||
{
|
||||
ps_sei->s_sei_ccv_params.u4_ccv_min_luminance_value =
|
||||
(UWORD32)ih264d_get_bits_h264(ps_bitstrm, 32);
|
||||
}
|
||||
|
||||
if(1 == ps_sei->s_sei_ccv_params.u1_ccv_max_luminance_value_present_flag)
|
||||
{
|
||||
ps_sei->s_sei_ccv_params.u4_ccv_max_luminance_value =
|
||||
(UWORD32)ih264d_get_bits_h264(ps_bitstrm, 32);
|
||||
if((1 == ps_sei->s_sei_ccv_params.u1_ccv_min_luminance_value_present_flag) &&
|
||||
(ps_sei->s_sei_ccv_params.u4_ccv_max_luminance_value <
|
||||
ps_sei->s_sei_ccv_params.u4_ccv_min_luminance_value))
|
||||
{
|
||||
return ERROR_INV_SEI_CCV_PARAMS;
|
||||
}
|
||||
}
|
||||
if(1 == ps_sei->s_sei_ccv_params.u1_ccv_avg_luminance_value_present_flag)
|
||||
{
|
||||
ps_sei->s_sei_ccv_params.u4_ccv_avg_luminance_value =
|
||||
(UWORD32)ih264d_get_bits_h264(ps_bitstrm, 32);
|
||||
if((1 == ps_sei->s_sei_ccv_params.u1_ccv_min_luminance_value_present_flag) &&
|
||||
(ps_sei->s_sei_ccv_params.u4_ccv_avg_luminance_value <
|
||||
ps_sei->s_sei_ccv_params.u4_ccv_min_luminance_value))
|
||||
{
|
||||
return ERROR_INV_SEI_CCV_PARAMS;
|
||||
}
|
||||
if((1 == ps_sei->s_sei_ccv_params.u1_ccv_max_luminance_value_present_flag) &&
|
||||
(ps_sei->s_sei_ccv_params.u4_ccv_max_luminance_value <
|
||||
ps_sei->s_sei_ccv_params.u4_ccv_avg_luminance_value))
|
||||
{
|
||||
return ERROR_INV_SEI_CCV_PARAMS;
|
||||
}
|
||||
}
|
||||
}
|
||||
ps_sei->u1_sei_ccv_params_present_flag = 1;
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_parse_sei_payload */
|
||||
/* */
|
||||
/* Description : This function parses SEI pay loads. Currently it's */
|
||||
/* implemented partially. */
|
||||
/* Inputs : ps_bitstrm Bitstream */
|
||||
/* Inputs : ps_bitstrm Bitstream */
|
||||
/* ui4_payload_type SEI payload type */
|
||||
/* ui4_payload_size SEI payload i4_size */
|
||||
/* ui4_payload_size SEI payload i4_size */
|
||||
/* Globals : None */
|
||||
/* Processing : Parses SEI payloads units and stores the info */
|
||||
/* Outputs : None */
|
||||
/* Returns : None */
|
||||
/* Return : status for successful parsing, else -1 */
|
||||
/* */
|
||||
/* Issues : Not implemented fully */
|
||||
/* */
|
||||
|
|
@ -278,10 +672,14 @@ WORD32 ih264d_parse_sei_payload(dec_bit_stream_t *ps_bitstrm,
|
|||
{
|
||||
sei *ps_sei;
|
||||
WORD32 i4_status = 0;
|
||||
ps_sei = (sei *)ps_dec->ps_sei;
|
||||
ps_sei = (sei *)ps_dec->ps_sei_parse;
|
||||
|
||||
if(ui4_payload_size == 0)
|
||||
return -1;
|
||||
if(NULL == ps_bitstrm)
|
||||
{
|
||||
return NOT_OK;
|
||||
}
|
||||
|
||||
switch(ui4_payload_type)
|
||||
{
|
||||
|
|
@ -301,6 +699,26 @@ WORD32 ih264d_parse_sei_payload(dec_bit_stream_t *ps_bitstrm,
|
|||
i4_status = ih264d_parse_recovery_point(ps_bitstrm, ps_dec,
|
||||
ui4_payload_size);
|
||||
break;
|
||||
case SEI_MASTERING_DISP_COL_VOL:
|
||||
|
||||
i4_status = ih264d_parse_mdcv(ps_bitstrm, ps_dec,
|
||||
ui4_payload_size);
|
||||
break;
|
||||
case SEI_CONTENT_LIGHT_LEVEL_DATA:
|
||||
|
||||
i4_status = ih264d_parse_cll(ps_bitstrm, ps_dec,
|
||||
ui4_payload_size);
|
||||
break;
|
||||
case SEI_AMBIENT_VIEWING_ENVIRONMENT:
|
||||
|
||||
i4_status = ih264d_parse_ave(ps_bitstrm, ps_dec,
|
||||
ui4_payload_size);
|
||||
break;
|
||||
case SEI_CONTENT_COLOR_VOLUME:
|
||||
|
||||
i4_status = ih264d_parse_ccv(ps_bitstrm, ps_dec,
|
||||
ui4_payload_size);
|
||||
break;
|
||||
default:
|
||||
i4_status = ih264d_flush_bits_h264(ps_bitstrm, (ui4_payload_size << 3));
|
||||
break;
|
||||
|
|
@ -385,3 +803,173 @@ WORD32 ih264d_parse_sei_message(dec_struct_t *ps_dec,
|
|||
return (i4_status);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_export_sei_mdcv_params */
|
||||
/* */
|
||||
/* Description : This function populates SEI mdcv message in */
|
||||
/* output structure */
|
||||
/* Inputs : ps_sei_mdcv_op pointer to sei mdcv o\p struct */
|
||||
/* : ps_sei pointer to decoded sei params */
|
||||
/* Outputs : */
|
||||
/* Returns : returns 0 for success; -1 for failure */
|
||||
/* */
|
||||
/* Issues : none */
|
||||
/* */
|
||||
/* Revision History: */
|
||||
/* */
|
||||
/* DD MM YYYY Author(s) Changes (Describe the changes made) */
|
||||
/* */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
WORD32 ih264d_export_sei_mdcv_params(ivd_sei_decode_op_t *ps_sei_decode_op,
|
||||
sei *ps_sei, sei *ps_sei_export)
|
||||
{
|
||||
if((ps_sei_export == NULL) || (ps_sei == NULL))
|
||||
{
|
||||
return NOT_OK;
|
||||
}
|
||||
|
||||
ps_sei_export->u1_sei_mdcv_params_present_flag = ps_sei->u1_sei_mdcv_params_present_flag;
|
||||
ps_sei_decode_op->u1_sei_mdcv_params_present_flag = ps_sei->u1_sei_mdcv_params_present_flag;
|
||||
|
||||
if(0 == ps_sei_export->u1_sei_mdcv_params_present_flag)
|
||||
{
|
||||
memset(&ps_sei_export->s_sei_mdcv_params, 0, sizeof(sei_mdcv_params_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&ps_sei_export->s_sei_mdcv_params, &ps_sei->s_sei_mdcv_params,
|
||||
sizeof(sei_mdcv_params_t));
|
||||
}
|
||||
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_export_sei_cll_params */
|
||||
/* */
|
||||
/* Description : This function populates SEI cll message in */
|
||||
/* output structure */
|
||||
/* Inputs : ps_sei_cll_op pointer to sei cll o\p struct */
|
||||
/* : ps_sei pointer to decoded sei params */
|
||||
/* Outputs : */
|
||||
/* Returns : returns 0 for success; -1 for failure */
|
||||
/* */
|
||||
/* Issues : none */
|
||||
/* */
|
||||
/* Revision History: */
|
||||
/* */
|
||||
/* DD MM YYYY Author(s) Changes (Describe the changes made) */
|
||||
/* */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
WORD32 ih264d_export_sei_cll_params(ivd_sei_decode_op_t *ps_sei_decode_op,
|
||||
sei *ps_sei, sei *ps_sei_export)
|
||||
{
|
||||
if((ps_sei_export == NULL) || (ps_sei == NULL))
|
||||
{
|
||||
return NOT_OK;
|
||||
}
|
||||
|
||||
ps_sei_export->u1_sei_cll_params_present_flag = ps_sei->u1_sei_cll_params_present_flag;
|
||||
ps_sei_decode_op->u1_sei_cll_params_present_flag = ps_sei->u1_sei_cll_params_present_flag;
|
||||
|
||||
if(0 == ps_sei_export->u1_sei_cll_params_present_flag)
|
||||
{
|
||||
memset(&ps_sei_export->s_sei_cll_params, 0, sizeof(sei_cll_params_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&ps_sei_export->s_sei_cll_params, &ps_sei->s_sei_cll_params,
|
||||
sizeof(sei_cll_params_t));
|
||||
}
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_export_sei_ave_params */
|
||||
/* */
|
||||
/* Description : This function populates SEI ave message in */
|
||||
/* output structure */
|
||||
/* Inputs : ps_sei_ave_op pointer to sei ave o\p struct */
|
||||
/* : ps_sei pointer to decoded sei params */
|
||||
/* Outputs : */
|
||||
/* Returns : returns 0 for success; -1 for failure */
|
||||
/* */
|
||||
/* Issues : none */
|
||||
/* */
|
||||
/* Revision History: */
|
||||
/* */
|
||||
/* DD MM YYYY Author(s) Changes (Describe the changes made) */
|
||||
/* */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
WORD32 ih264d_export_sei_ave_params(ivd_sei_decode_op_t *ps_sei_decode_op,
|
||||
sei *ps_sei, sei *ps_sei_export)
|
||||
{
|
||||
if((ps_sei_export == NULL) || (ps_sei == NULL))
|
||||
{
|
||||
return NOT_OK;
|
||||
}
|
||||
|
||||
ps_sei_export->u1_sei_ave_params_present_flag = ps_sei->u1_sei_ave_params_present_flag;
|
||||
ps_sei_decode_op->u1_sei_ave_params_present_flag = ps_sei->u1_sei_ave_params_present_flag;
|
||||
|
||||
if(0 == ps_sei_export->u1_sei_ave_params_present_flag)
|
||||
{
|
||||
memset(&ps_sei_export->s_sei_ave_params, 0, sizeof(sei_ave_params_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&ps_sei_export->s_sei_ave_params, &ps_sei->s_sei_ave_params,
|
||||
sizeof(sei_ave_params_t));
|
||||
}
|
||||
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Function Name : ih264d_export_sei_ccv_params */
|
||||
/* */
|
||||
/* Description : This function populates SEI ccv message in */
|
||||
/* output structure */
|
||||
/* Inputs : ps_sei_ccv_op pointer to sei ccv o\p struct */
|
||||
/* : ps_sei pointer to decoded sei params */
|
||||
/* Outputs : */
|
||||
/* Returns : returns 0 for success; -1 for failure */
|
||||
/* */
|
||||
/* Issues : none */
|
||||
/* */
|
||||
/* Revision History: */
|
||||
/* */
|
||||
/* DD MM YYYY Author(s) Changes (Describe the changes made) */
|
||||
/* */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
WORD32 ih264d_export_sei_ccv_params(ivd_sei_decode_op_t *ps_sei_decode_op,
|
||||
sei *ps_sei, sei *ps_sei_export)
|
||||
{
|
||||
if((ps_sei_export == NULL) || (ps_sei == NULL))
|
||||
{
|
||||
return NOT_OK;
|
||||
}
|
||||
|
||||
ps_sei_export->u1_sei_ccv_params_present_flag = ps_sei->u1_sei_ccv_params_present_flag;
|
||||
ps_sei_decode_op->u1_sei_ccv_params_present_flag = ps_sei->u1_sei_ccv_params_present_flag;
|
||||
|
||||
if(0 == ps_sei_export->u1_sei_ccv_params_present_flag)
|
||||
{
|
||||
memset(&ps_sei_export->s_sei_ccv_params, 0, sizeof(sei_ccv_params_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&ps_sei_export->s_sei_ccv_params, &ps_sei->s_sei_ccv_params,
|
||||
sizeof(sei_ccv_params_t));
|
||||
}
|
||||
return (OK);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#include "ih264_platform_macros.h"
|
||||
#include "ih264d_bitstrm.h"
|
||||
#include "ih264d_structs.h"
|
||||
#include "ih264d.h"
|
||||
|
||||
#define SEI_BUF_PERIOD 0
|
||||
#define SEI_PIC_TIMING 1
|
||||
|
|
@ -63,6 +64,11 @@
|
|||
#define SEI_PROG_REF_SEGMENT_START 16
|
||||
#define SEI_PROG_REF_SEGMENT_END 17
|
||||
#define SEI_MOT_CON_SLICE_GRP_SET 18
|
||||
#define SEI_MASTERING_DISP_COL_VOL 137
|
||||
#define SEI_CONTENT_LIGHT_LEVEL_DATA 144
|
||||
#define SEI_AMBIENT_VIEWING_ENVIRONMENT 148
|
||||
#define SEI_CONTENT_COLOR_VOLUME 149
|
||||
|
||||
/* Declaration of dec_struct_t to avoid CCS compilation Error */
|
||||
struct _DecStruct;
|
||||
WORD32 ih264d_parse_sei_message(struct _DecStruct *ps_dec,
|
||||
|
|
@ -75,6 +81,159 @@ typedef struct
|
|||
|
||||
} buf_period_t;
|
||||
|
||||
/**
|
||||
* Structure to hold Mastering Display Color Volume SEI
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* Array to store the display_primaries_x values
|
||||
*/
|
||||
UWORD16 au2_display_primaries_x[NUM_SEI_MDCV_PRIMARIES];
|
||||
|
||||
/**
|
||||
* Array to store the display_primaries_y values
|
||||
*/
|
||||
UWORD16 au2_display_primaries_y[NUM_SEI_MDCV_PRIMARIES];
|
||||
|
||||
/**
|
||||
* Variable to store the white point x value
|
||||
*/
|
||||
UWORD16 u2_white_point_x;
|
||||
|
||||
/**
|
||||
* Variable to store the white point y value
|
||||
*/
|
||||
UWORD16 u2_white_point_y;
|
||||
|
||||
/**
|
||||
* Variable to store the max display mastering luminance value
|
||||
*/
|
||||
UWORD32 u4_max_display_mastering_luminance;
|
||||
|
||||
/**
|
||||
* Variable to store the min display mastering luminance value
|
||||
*/
|
||||
UWORD32 u4_min_display_mastering_luminance;
|
||||
|
||||
}sei_mdcv_params_t;
|
||||
|
||||
|
||||
/**
|
||||
* Structure for Content Light Level Info
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* The maximum pixel intensity of all samples
|
||||
*/
|
||||
UWORD16 u2_max_content_light_level;
|
||||
|
||||
/**
|
||||
* The average pixel intensity of all samples
|
||||
*/
|
||||
UWORD16 u2_max_pic_average_light_level;
|
||||
|
||||
}sei_cll_params_t;
|
||||
|
||||
|
||||
/**
|
||||
* Structure to hold Ambient viewing environment SEI
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
|
||||
/**
|
||||
* specifies the environmental illuminance of the ambient viewing environment
|
||||
*/
|
||||
UWORD32 u4_ambient_illuminance;
|
||||
|
||||
/*
|
||||
* specify the normalized x chromaticity coordinates of the
|
||||
* environmental ambient light in the nominal viewing environment
|
||||
*/
|
||||
UWORD16 u2_ambient_light_x;
|
||||
|
||||
/*
|
||||
* specify the normalized y chromaticity coordinates of the
|
||||
* environmental ambient light in the nominal viewing environment
|
||||
*/
|
||||
UWORD16 u2_ambient_light_y;
|
||||
|
||||
}sei_ave_params_t;
|
||||
|
||||
|
||||
/**
|
||||
* Structure to hold Content color volume SEI
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/*
|
||||
* Flag used to control persistence of CCV SEI messages
|
||||
*/
|
||||
UWORD8 u1_ccv_cancel_flag;
|
||||
|
||||
/*
|
||||
* specifies the persistence of the CCV SEI message for the current layer
|
||||
*/
|
||||
UWORD8 u1_ccv_persistence_flag;
|
||||
|
||||
/*
|
||||
* specifies the presence of syntax elements ccv_primaries_x and ccv_primaries_y
|
||||
*/
|
||||
UWORD8 u1_ccv_primaries_present_flag;
|
||||
|
||||
/*
|
||||
* specifies that the syntax element ccv_min_luminance_value is present
|
||||
*/
|
||||
UWORD8 u1_ccv_min_luminance_value_present_flag;
|
||||
|
||||
/*
|
||||
* specifies that the syntax element ccv_max_luminance_value is present
|
||||
*/
|
||||
UWORD8 u1_ccv_max_luminance_value_present_flag;
|
||||
|
||||
/*
|
||||
* specifies that the syntax element ccv_avg_luminance_value is present
|
||||
*/
|
||||
UWORD8 u1_ccv_avg_luminance_value_present_flag;
|
||||
|
||||
/*
|
||||
* shall be equal to 0 in bitstreams conforming to this version. Other values
|
||||
* for reserved_zero_2bits are reserved for future use
|
||||
*/
|
||||
UWORD8 u1_ccv_reserved_zero_2bits;
|
||||
|
||||
/*
|
||||
* specify the normalized x chromaticity coordinates of the colour
|
||||
* primary component c of the nominal content colour volume
|
||||
*/
|
||||
WORD32 ai4_ccv_primaries_x[NUM_SEI_CCV_PRIMARIES];
|
||||
|
||||
/*
|
||||
* specify the normalized y chromaticity coordinates of the colour
|
||||
* primary component c of the nominal content colour volume
|
||||
*/
|
||||
WORD32 ai4_ccv_primaries_y[NUM_SEI_CCV_PRIMARIES];
|
||||
|
||||
/*
|
||||
* specifies the normalized minimum luminance value
|
||||
*/
|
||||
UWORD32 u4_ccv_min_luminance_value;
|
||||
|
||||
/*
|
||||
* specifies the normalized maximum luminance value
|
||||
*/
|
||||
UWORD32 u4_ccv_max_luminance_value;
|
||||
|
||||
/*
|
||||
* specifies the normalized average luminance value
|
||||
*/
|
||||
UWORD32 u4_ccv_avg_luminance_value;
|
||||
|
||||
}sei_ccv_params_t;
|
||||
|
||||
struct _sei
|
||||
{
|
||||
UWORD8 u1_seq_param_set_id;
|
||||
|
|
@ -85,7 +244,61 @@ struct _sei
|
|||
UWORD8 u1_broken_link_flag;
|
||||
UWORD8 u1_changing_slice_grp_idc;
|
||||
UWORD8 u1_is_valid;
|
||||
|
||||
/**
|
||||
* mastering display color volume info present flag
|
||||
*/
|
||||
UWORD8 u1_sei_mdcv_params_present_flag;
|
||||
|
||||
/*
|
||||
* MDCV parameters
|
||||
*/
|
||||
sei_mdcv_params_t s_sei_mdcv_params;
|
||||
|
||||
/**
|
||||
* content light level info present flag
|
||||
*/
|
||||
UWORD8 u1_sei_cll_params_present_flag;
|
||||
|
||||
/*
|
||||
* CLL parameters
|
||||
*/
|
||||
sei_cll_params_t s_sei_cll_params;
|
||||
|
||||
/**
|
||||
* ambient viewing environment info present flag
|
||||
*/
|
||||
UWORD8 u1_sei_ave_params_present_flag;
|
||||
|
||||
/*
|
||||
* AVE parameters
|
||||
*/
|
||||
sei_ave_params_t s_sei_ave_params;
|
||||
|
||||
/**
|
||||
* content color volume info present flag
|
||||
*/
|
||||
UWORD8 u1_sei_ccv_params_present_flag;
|
||||
|
||||
/*
|
||||
* CCV parameters
|
||||
*/
|
||||
sei_ccv_params_t s_sei_ccv_params;
|
||||
|
||||
};
|
||||
typedef struct _sei sei;
|
||||
|
||||
WORD32 ih264d_export_sei_mdcv_params(ivd_sei_decode_op_t *ps_sei_decode_op,
|
||||
sei *ps_sei, sei *ps_sei_export);
|
||||
|
||||
WORD32 ih264d_export_sei_cll_params(ivd_sei_decode_op_t *ps_sei_decode_op,
|
||||
sei *ps_sei, sei *ps_sei_export);
|
||||
|
||||
WORD32 ih264d_export_sei_ave_params(ivd_sei_decode_op_t *ps_sei_decode_op,
|
||||
sei *ps_sei, sei *ps_sei_export);
|
||||
|
||||
WORD32 ih264d_export_sei_ccv_params(ivd_sei_decode_op_t *ps_sei_decode_op,
|
||||
sei *ps_sei, sei *ps_sei_export);
|
||||
|
||||
#endif /* _IH264D_SEI_H_ */
|
||||
|
||||
|
|
|
|||
|
|
@ -190,6 +190,7 @@ typedef struct pic_buffer_t
|
|||
/* ! */
|
||||
UWORD32 u4_ts;
|
||||
UWORD8 u1_pic_struct;/* Refer to SEI table D-1 */
|
||||
sei s_sei_pic;
|
||||
|
||||
} pic_buffer_t;
|
||||
|
||||
|
|
@ -1005,6 +1006,11 @@ typedef struct _DecStruct
|
|||
UWORD8 *pu1_temp_mc_buffer;
|
||||
|
||||
struct _sei *ps_sei;
|
||||
struct _sei *ps_sei_parse;
|
||||
struct _sei s_sei_export;
|
||||
|
||||
void *pv_disp_sei_params;
|
||||
|
||||
UWORD8 u1_pic_struct_copy;
|
||||
/* Variables required for cropping */
|
||||
UWORD16 u2_disp_width;
|
||||
|
|
|
|||
|
|
@ -949,6 +949,7 @@ WORD32 ih264d_get_next_display_field(dec_struct_t * ps_dec,
|
|||
ps_dec->i4_display_index = DEFAULT_POC;
|
||||
if(pic_buf != NULL)
|
||||
{
|
||||
ps_dec->pv_disp_sei_params = &pic_buf->s_sei_pic;
|
||||
pv_disp_op->e4_fld_type = 0;
|
||||
pv_disp_op->u4_disp_buf_id = i4_disp_buf_id;
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,18 @@
|
|||
/* Constant Macros */
|
||||
/*****************************************************************************/
|
||||
#define IVD_VIDDEC_MAX_IO_BUFFERS 64
|
||||
|
||||
/** SEI macros */
|
||||
/*
|
||||
* @brief specifies the number of colour primary components of the mastering display
|
||||
*/
|
||||
#define NUM_SEI_MDCV_PRIMARIES 3
|
||||
|
||||
/*
|
||||
* @brief specifies the number of colour primary components of the nominal content colour volume
|
||||
*/
|
||||
#define NUM_SEI_CCV_PRIMARIES 3
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Typedefs */
|
||||
/*****************************************************************************/
|
||||
|
|
@ -368,6 +380,17 @@ typedef struct{
|
|||
/* Video Decode */
|
||||
/*****************************************************************************/
|
||||
|
||||
/* SEI params deocde */
|
||||
typedef struct {
|
||||
UWORD8 u1_sei_mdcv_params_present_flag;
|
||||
|
||||
UWORD8 u1_sei_cll_params_present_flag;
|
||||
|
||||
UWORD8 u1_sei_ave_params_present_flag;
|
||||
|
||||
UWORD8 u1_sei_ccv_params_present_flag;
|
||||
|
||||
}ivd_sei_decode_op_t;
|
||||
|
||||
/* IVD_API_COMMAND_TYPE_T::e_cmd = IVD_CMD_VIDEO_DECODE */
|
||||
|
||||
|
|
@ -472,6 +495,11 @@ typedef struct{
|
|||
*/
|
||||
iv_yuv_buf_t s_disp_frm_buf;
|
||||
|
||||
/**
|
||||
* sei params o/p struct
|
||||
*/
|
||||
ivd_sei_decode_op_t s_sei_decode_op;
|
||||
|
||||
/**
|
||||
* fld_type
|
||||
*/
|
||||
|
|
|
|||
233
encoder/ih264e.h
233
encoder/ih264e.h
|
|
@ -46,11 +46,6 @@ extern "C" {
|
|||
|
||||
#include "iv2.h"
|
||||
#include "ive2.h"
|
||||
/*****************************************************************************/
|
||||
/* Constant Macros */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* API Function Prototype */
|
||||
/*****************************************************************************/
|
||||
|
|
@ -614,6 +609,234 @@ typedef struct
|
|||
UWORD32 u4_error_code;
|
||||
}ih264e_vui_op_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Video control Set SEI MDCV params */
|
||||
/*****************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
/** size of the structure */
|
||||
UWORD32 u4_size;
|
||||
|
||||
/** Command type : IVE_CMD_VIDEO_CTL */
|
||||
IVE_API_COMMAND_TYPE_T e_cmd;
|
||||
|
||||
/** Sub command type : IVE_CMD_CTL_SET_SEI_MDCV_PARAMS */
|
||||
IVE_CONTROL_API_COMMAND_TYPE_T e_sub_cmd;
|
||||
|
||||
/** mastering display color volume info present flag */
|
||||
UWORD8 u1_sei_mdcv_params_present_flag;
|
||||
|
||||
/** Array to store the display_primaries_x values */
|
||||
UWORD16 au2_display_primaries_x[3];
|
||||
|
||||
/** Array to store the display_primaries_y values */
|
||||
UWORD16 au2_display_primaries_y[3];
|
||||
|
||||
/** Variable to store the white point x value */
|
||||
UWORD16 u2_white_point_x;
|
||||
|
||||
/** Variable to store the white point y value */
|
||||
UWORD16 u2_white_point_y;
|
||||
|
||||
/** Variable to store the max display mastering luminance value */
|
||||
UWORD32 u4_max_display_mastering_luminance;
|
||||
|
||||
/** Variable to store the min display mastering luminance value */
|
||||
UWORD32 u4_min_display_mastering_luminance;
|
||||
|
||||
/** Lower 32bits of time stamp corresponding to input buffer,
|
||||
* from which this command takes effect */
|
||||
UWORD32 u4_timestamp_low;
|
||||
|
||||
/** Upper 32bits of time stamp corresponding to input buffer,
|
||||
* from which this command takes effect */
|
||||
UWORD32 u4_timestamp_high;
|
||||
|
||||
}ih264e_ctl_set_sei_mdcv_params_ip_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/** size of the structure */
|
||||
UWORD32 u4_size;
|
||||
|
||||
/** Return error code */
|
||||
UWORD32 u4_error_code;
|
||||
|
||||
}ih264e_ctl_set_sei_mdcv_params_op_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Video control Set SEI CLL params */
|
||||
/*****************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
/** size of the structure */
|
||||
UWORD32 u4_size;
|
||||
|
||||
/** Command type : IVE_CMD_VIDEO_CTL */
|
||||
IVE_API_COMMAND_TYPE_T e_cmd;
|
||||
|
||||
/** Sub command type : IVE_CMD_CTL_SET_SEI_CLL_PARAMS */
|
||||
IVE_CONTROL_API_COMMAND_TYPE_T e_sub_cmd;
|
||||
|
||||
/** content light level info present flag */
|
||||
UWORD8 u1_sei_cll_params_present_flag;
|
||||
|
||||
/** The maximum pixel intensity of all samples */
|
||||
UWORD16 u2_max_content_light_level;
|
||||
|
||||
/** The average pixel intensity of all samples */
|
||||
UWORD16 u2_max_pic_average_light_level;
|
||||
|
||||
/** Lower 32bits of time stamp corresponding to input buffer,
|
||||
* from which this command takes effect */
|
||||
UWORD32 u4_timestamp_low;
|
||||
|
||||
/** Upper 32bits of time stamp corresponding to input buffer,
|
||||
* from which this command takes effect */
|
||||
UWORD32 u4_timestamp_high;
|
||||
|
||||
}ih264e_ctl_set_sei_cll_params_ip_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/** size of the structure */
|
||||
UWORD32 u4_size;
|
||||
|
||||
/** Return error code */
|
||||
UWORD32 u4_error_code;
|
||||
|
||||
}ih264e_ctl_set_sei_cll_params_op_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Video control Set SEI AVE params */
|
||||
/*****************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
/** size of the structure */
|
||||
UWORD32 u4_size;
|
||||
|
||||
/** Command type : IVE_CMD_VIDEO_CTL */
|
||||
IVE_API_COMMAND_TYPE_T e_cmd;
|
||||
|
||||
/** Sub command type : IVE_CMD_CTL_SET_SEI_AVE_PARAMS */
|
||||
IVE_CONTROL_API_COMMAND_TYPE_T e_sub_cmd;
|
||||
|
||||
/** ambient viewing environment info present flag */
|
||||
UWORD8 u1_sei_ave_params_present_flag;
|
||||
|
||||
/** specifies the environmental illluminance of the ambient viewing
|
||||
* environment */
|
||||
UWORD32 u4_ambient_illuminance;
|
||||
|
||||
/** specify the normalized x chromaticity coordinates of the
|
||||
* environmental ambient light in the nominal viewing environment */
|
||||
UWORD16 u2_ambient_light_x;
|
||||
|
||||
/** specify the normalized y chromaticity coordinates of the
|
||||
* environmental ambient light in the nominal viewing environment */
|
||||
UWORD16 u2_ambient_light_y;
|
||||
|
||||
/** Lower 32bits of time stamp corresponding to input buffer,
|
||||
* from which this command takes effect */
|
||||
UWORD32 u4_timestamp_low;
|
||||
|
||||
/** Upper 32bits of time stamp corresponding to input buffer,
|
||||
* from which this command takes effect */
|
||||
UWORD32 u4_timestamp_high;
|
||||
|
||||
}ih264e_ctl_set_sei_ave_params_ip_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/** size of the structure */
|
||||
UWORD32 u4_size;
|
||||
|
||||
/** Return error code */
|
||||
UWORD32 u4_error_code;
|
||||
|
||||
}ih264e_ctl_set_sei_ave_params_op_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Video control Set SEI CCV params */
|
||||
/*****************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
/** size of the structure */
|
||||
UWORD32 u4_size;
|
||||
|
||||
/** Command type : IVE_CMD_VIDEO_CTL */
|
||||
IVE_API_COMMAND_TYPE_T e_cmd;
|
||||
|
||||
/** Sub command type : IVE_CMD_CTL_SET_SEI_CCV_PARAMS */
|
||||
IVE_CONTROL_API_COMMAND_TYPE_T e_sub_cmd;
|
||||
|
||||
/** content color volume info present flag */
|
||||
UWORD8 u1_sei_ccv_params_present_flag;
|
||||
|
||||
/** Flag used to control persistence of CCV SEI messages */
|
||||
UWORD8 u1_ccv_cancel_flag;
|
||||
|
||||
/** specifies the persistence of the CCV SEI message for the
|
||||
* current layer */
|
||||
UWORD8 u1_ccv_persistence_flag;
|
||||
|
||||
/** specifies the presence of syntax elements ccv_primaries_x
|
||||
* and ccv_primaries_y */
|
||||
UWORD8 u1_ccv_primaries_present_flag;
|
||||
|
||||
/** specifies that the syntax element ccv_min_luminance_value
|
||||
* is present */
|
||||
UWORD8 u1_ccv_min_luminance_value_present_flag;
|
||||
|
||||
/** specifies that the syntax element ccv_max_luminance_value
|
||||
* is present */
|
||||
UWORD8 u1_ccv_max_luminance_value_present_flag;
|
||||
|
||||
/** specifies that the syntax element ccv_avg_luminance_value
|
||||
* is present */
|
||||
UWORD8 u1_ccv_avg_luminance_value_present_flag;
|
||||
|
||||
/** shall be equal to 0 in bitstreams conforming to this version.
|
||||
* Other values for reserved_zero_2bits are reserved for future use */
|
||||
UWORD8 u1_ccv_reserved_zero_2bits;
|
||||
|
||||
/** specify the normalized x chromaticity coordinates of the colour
|
||||
* primary component c of the nominal content colour volume */
|
||||
WORD32 ai4_ccv_primaries_x[3];
|
||||
|
||||
/** specify the normalized y chromaticity coordinates of the colour
|
||||
* primary component c of the nominal content colour volume */
|
||||
WORD32 ai4_ccv_primaries_y[3];
|
||||
|
||||
/** specifies the normalized minimum luminance value */
|
||||
UWORD32 u4_ccv_min_luminance_value;
|
||||
|
||||
/** specifies the normalized maximum luminance value */
|
||||
UWORD32 u4_ccv_max_luminance_value;
|
||||
|
||||
/** specifies the normalized average luminance value */
|
||||
UWORD32 u4_ccv_avg_luminance_value;
|
||||
|
||||
/** Lower 32bits of time stamp corresponding to input buffer,
|
||||
* from which this command takes effect */
|
||||
UWORD32 u4_timestamp_low;
|
||||
|
||||
/** Upper 32bits of time stamp corresponding to input buffer,
|
||||
* from which this command takes effect */
|
||||
UWORD32 u4_timestamp_high;
|
||||
|
||||
}ih264e_ctl_set_sei_ccv_params_ip_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/** size of the structure */
|
||||
UWORD32 u4_size;
|
||||
|
||||
/** Return error code */
|
||||
UWORD32 u4_error_code;
|
||||
|
||||
}ih264e_ctl_set_sei_ccv_params_op_t;
|
||||
|
||||
|
||||
/* The enum values should not have greater than 8 bits as this is assigned to WORD8 */
|
||||
typedef enum
|
||||
|
|
|
|||
|
|
@ -1651,6 +1651,388 @@ static IV_STATUS_T api_check_struct_sanity(iv_obj_t *ps_handle,
|
|||
break;
|
||||
}
|
||||
|
||||
case IVE_CMD_CTL_SET_SEI_MDCV_PARAMS:
|
||||
{
|
||||
ih264e_ctl_set_sei_mdcv_params_ip_t *ps_ip = pv_api_ip;
|
||||
ih264e_ctl_set_sei_mdcv_params_op_t *ps_op = pv_api_op;
|
||||
|
||||
if(ps_ip->u4_size != sizeof(ih264e_ctl_set_sei_mdcv_params_ip_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVE_ERR_IP_CTL_SET_SEI_MDCV_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(ps_op->u4_size != sizeof(ih264e_ctl_set_sei_mdcv_params_op_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVE_ERR_OP_CTL_SET_SEI_MDCV_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if((ps_ip->u1_sei_mdcv_params_present_flag != 0)
|
||||
&& (ps_ip->u1_sei_mdcv_params_present_flag) != 1)
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_MDCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(1 == ps_ip->u1_sei_mdcv_params_present_flag)
|
||||
{
|
||||
/* Check values for u2_display_primaries_x and u2_display_primaries_y */
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
if((ps_ip->au2_display_primaries_x[i] >
|
||||
DISPLAY_PRIMARIES_X_UPPER_LIMIT) ||
|
||||
(ps_ip->au2_display_primaries_x[i] <
|
||||
DISPLAY_PRIMARIES_X_LOWER_LIMIT) ||
|
||||
((ps_ip->au2_display_primaries_x[i] %
|
||||
DISPLAY_PRIMARIES_X_DIVISION_FACTOR) != 0))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_MDCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if((ps_ip->au2_display_primaries_y[i] >
|
||||
DISPLAY_PRIMARIES_Y_UPPER_LIMIT) ||
|
||||
(ps_ip->au2_display_primaries_y[i] <
|
||||
DISPLAY_PRIMARIES_Y_LOWER_LIMIT) ||
|
||||
((ps_ip->au2_display_primaries_y[i] %
|
||||
DISPLAY_PRIMARIES_Y_DIVISION_FACTOR) != 0))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_MDCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
if((ps_ip->u2_white_point_x > WHITE_POINT_X_UPPER_LIMIT) ||
|
||||
(ps_ip->u2_white_point_x < WHITE_POINT_X_LOWER_LIMIT) ||
|
||||
((ps_ip->u2_white_point_x % WHITE_POINT_X_DIVISION_FACTOR) != 0))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_MDCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if((ps_ip->u2_white_point_y > WHITE_POINT_Y_UPPER_LIMIT) ||
|
||||
(ps_ip->u2_white_point_y < WHITE_POINT_Y_LOWER_LIMIT) ||
|
||||
((ps_ip->u2_white_point_y % WHITE_POINT_Y_DIVISION_FACTOR) != 0))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_MDCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if((ps_ip->u4_max_display_mastering_luminance >
|
||||
MAX_DISPLAY_MASTERING_LUMINANCE_UPPER_LIMIT) ||
|
||||
(ps_ip->u4_max_display_mastering_luminance <
|
||||
MAX_DISPLAY_MASTERING_LUMINANCE_LOWER_LIMIT) ||
|
||||
((ps_ip->u4_max_display_mastering_luminance %
|
||||
MAX_DISPLAY_MASTERING_LUMINANCE_DIVISION_FACTOR) != 0))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_MDCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if((ps_ip->u4_min_display_mastering_luminance >
|
||||
MIN_DISPLAY_MASTERING_LUMINANCE_UPPER_LIMIT ) ||
|
||||
(ps_ip->u4_min_display_mastering_luminance <
|
||||
MIN_DISPLAY_MASTERING_LUMINANCE_LOWER_LIMIT))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_MDCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(ps_ip->u4_max_display_mastering_luminance <=
|
||||
ps_ip->u4_min_display_mastering_luminance)
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_MDCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IVE_CMD_CTL_SET_SEI_CLL_PARAMS:
|
||||
{
|
||||
ih264e_ctl_set_sei_cll_params_ip_t *ps_ip = pv_api_ip;
|
||||
ih264e_ctl_set_sei_cll_params_op_t *ps_op = pv_api_op;
|
||||
|
||||
if(ps_ip->u4_size != sizeof(ih264e_ctl_set_sei_cll_params_ip_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVE_ERR_IP_CTL_SET_SEI_CLL_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(ps_op->u4_size != sizeof(ih264e_ctl_set_sei_cll_params_op_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVE_ERR_OP_CTL_SET_SEI_CLL_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if((ps_ip->u1_sei_cll_params_present_flag != 0)
|
||||
&& (ps_ip->u1_sei_cll_params_present_flag != 1))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_CLL_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IVE_CMD_CTL_SET_SEI_AVE_PARAMS:
|
||||
{
|
||||
ih264e_ctl_set_sei_ave_params_ip_t *ps_ip = pv_api_ip;
|
||||
ih264e_ctl_set_sei_ave_params_op_t *ps_op = pv_api_op;
|
||||
|
||||
if(ps_ip->u4_size != sizeof(ih264e_ctl_set_sei_ave_params_ip_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVE_ERR_IP_CTL_SET_SEI_AVE_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(ps_op->u4_size != sizeof(ih264e_ctl_set_sei_ave_params_op_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVE_ERR_OP_CTL_SET_SEI_AVE_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if((ps_ip->u1_sei_ave_params_present_flag != 0)
|
||||
&& (ps_ip->u1_sei_ave_params_present_flag != 1))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_AVE_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(1 == ps_ip->u1_sei_ave_params_present_flag)
|
||||
{
|
||||
if((0 == ps_ip->u4_ambient_illuminance))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_AVE_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(ps_ip->u2_ambient_light_x > AMBIENT_LIGHT_X_UPPER_LIMIT)
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_AVE_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(ps_ip->u2_ambient_light_y > AMBIENT_LIGHT_Y_UPPER_LIMIT)
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_AVE_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IVE_CMD_CTL_SET_SEI_CCV_PARAMS:
|
||||
{
|
||||
ih264e_ctl_set_sei_ccv_params_ip_t *ps_ip = pv_api_ip;
|
||||
ih264e_ctl_set_sei_ccv_params_op_t *ps_op = pv_api_op;
|
||||
|
||||
if(ps_ip->u4_size != sizeof(ih264e_ctl_set_sei_ccv_params_ip_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVE_ERR_IP_CTL_SET_SEI_CCV_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(ps_op->u4_size != sizeof(ih264e_ctl_set_sei_ccv_params_op_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVE_ERR_OP_CTL_SET_SEI_CCV_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if((ps_ip->u1_sei_ccv_params_present_flag != 0)
|
||||
&& (ps_ip->u1_sei_ccv_params_present_flag != 1))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_CCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
|
||||
if(1 == ps_ip->u1_sei_ccv_params_present_flag)
|
||||
{
|
||||
if((ps_ip->u1_ccv_cancel_flag != 0)
|
||||
&& (ps_ip->u1_ccv_cancel_flag != 1))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_CCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(0 == ps_ip->u1_ccv_cancel_flag)
|
||||
{
|
||||
if((ps_ip->u1_ccv_persistence_flag != 0)
|
||||
&& (ps_ip->u1_ccv_persistence_flag != 1))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_CCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
if((ps_ip->u1_ccv_primaries_present_flag != 0)
|
||||
&& (ps_ip->u1_ccv_primaries_present_flag != 1))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_CCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
if((ps_ip->u1_ccv_min_luminance_value_present_flag != 0)
|
||||
&& (ps_ip->u1_ccv_min_luminance_value_present_flag != 1))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_CCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
if((ps_ip->u1_ccv_max_luminance_value_present_flag != 0)
|
||||
&& (ps_ip->u1_ccv_max_luminance_value_present_flag != 1))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_CCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
if((ps_ip->u1_ccv_avg_luminance_value_present_flag != 0)
|
||||
&& (ps_ip->u1_ccv_avg_luminance_value_present_flag != 1))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_CCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
if((ps_ip->u1_ccv_primaries_present_flag == 0)
|
||||
&& (ps_ip->u1_ccv_min_luminance_value_present_flag == 0)
|
||||
&& (ps_ip->u1_ccv_max_luminance_value_present_flag == 0)
|
||||
&& (ps_ip->u1_ccv_avg_luminance_value_present_flag == 0))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_CCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if((ps_ip->u1_ccv_reserved_zero_2bits != 0))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_CCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(1 == ps_ip->u1_ccv_primaries_present_flag)
|
||||
{
|
||||
for(i = 0; i < 3; i++)
|
||||
{
|
||||
if((ps_ip->ai4_ccv_primaries_x[i] >
|
||||
CCV_PRIMARIES_X_UPPER_LIMIT) ||
|
||||
(ps_ip->ai4_ccv_primaries_x[i] <
|
||||
CCV_PRIMARIES_X_LOWER_LIMIT))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_CCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if((ps_ip->ai4_ccv_primaries_y[i] >
|
||||
CCV_PRIMARIES_Y_UPPER_LIMIT) ||
|
||||
(ps_ip->ai4_ccv_primaries_y[i] <
|
||||
CCV_PRIMARIES_Y_LOWER_LIMIT))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_CCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((1 == ps_ip->u1_ccv_min_luminance_value_present_flag) &&
|
||||
(1 == ps_ip->u1_ccv_avg_luminance_value_present_flag))
|
||||
{
|
||||
if((ps_ip->u4_ccv_avg_luminance_value <
|
||||
ps_ip->u4_ccv_min_luminance_value))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_CCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
if((1 == ps_ip->u1_ccv_min_luminance_value_present_flag) &&
|
||||
(1 == ps_ip->u1_ccv_max_luminance_value_present_flag))
|
||||
{
|
||||
if((ps_ip->u4_ccv_max_luminance_value <
|
||||
ps_ip->u4_ccv_min_luminance_value))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_CCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
}
|
||||
if((1 == ps_ip->u1_ccv_avg_luminance_value_present_flag) &&
|
||||
(1 == ps_ip->u1_ccv_max_luminance_value_present_flag))
|
||||
{
|
||||
if((ps_ip->u4_ccv_max_luminance_value <
|
||||
ps_ip->u4_ccv_avg_luminance_value))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IH264E_INVALID_SEI_CCV_PARAMS;
|
||||
return IV_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IVE_CMD_CTL_SET_ENC_MODE:
|
||||
{
|
||||
ih264e_ctl_set_enc_mode_ip_t *ps_ip = pv_api_ip;
|
||||
|
|
@ -2256,6 +2638,32 @@ IH264E_ERROR_T ih264e_codec_update_config(codec_t *ps_codec,
|
|||
{
|
||||
ps_codec->s_cfg.s_vui = ps_cfg->s_vui;
|
||||
}
|
||||
|
||||
else if (ps_cfg->e_cmd == IVE_CMD_CTL_SET_SEI_MDCV_PARAMS)
|
||||
{
|
||||
ps_codec->s_cfg.s_sei.u1_sei_mdcv_params_present_flag =
|
||||
ps_cfg->s_sei.u1_sei_mdcv_params_present_flag;
|
||||
ps_codec->s_cfg.s_sei.s_sei_mdcv_params = ps_cfg->s_sei.s_sei_mdcv_params;
|
||||
}
|
||||
else if (ps_cfg->e_cmd == IVE_CMD_CTL_SET_SEI_CLL_PARAMS)
|
||||
{
|
||||
ps_codec->s_cfg.s_sei.u1_sei_cll_params_present_flag =
|
||||
ps_cfg->s_sei.u1_sei_cll_params_present_flag;
|
||||
ps_codec->s_cfg.s_sei.s_sei_cll_params = ps_cfg->s_sei.s_sei_cll_params;
|
||||
}
|
||||
else if (ps_cfg->e_cmd == IVE_CMD_CTL_SET_SEI_AVE_PARAMS)
|
||||
{
|
||||
ps_codec->s_cfg.s_sei.u1_sei_ave_params_present_flag =
|
||||
ps_cfg->s_sei.u1_sei_ave_params_present_flag;
|
||||
ps_codec->s_cfg.s_sei.s_sei_ave_params = ps_cfg->s_sei.s_sei_ave_params;
|
||||
}
|
||||
else if (ps_cfg->e_cmd == IVE_CMD_CTL_SET_SEI_CCV_PARAMS)
|
||||
{
|
||||
ps_codec->s_cfg.s_sei.u1_sei_ccv_params_present_flag =
|
||||
ps_cfg->s_sei.u1_sei_ccv_params_present_flag;
|
||||
ps_codec->s_cfg.s_sei.s_sei_ccv_params = ps_cfg->s_sei.s_sei_ccv_params;
|
||||
}
|
||||
|
||||
/* reset RC model */
|
||||
if (u4_init_rc)
|
||||
{
|
||||
|
|
@ -2425,6 +2833,8 @@ static WORD32 ih264e_set_default_params(cfg_params_t *ps_cfg)
|
|||
ps_cfg->u4_constrained_intra_pred = 0;
|
||||
ps_cfg->u4_pic_info_type = 0;
|
||||
ps_cfg->u4_mb_info_type = 0;
|
||||
ps_cfg->s_vui.u1_video_signal_type_present_flag = 1;
|
||||
ps_cfg->s_vui.u1_colour_description_present_flag = 1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -5346,6 +5756,228 @@ static WORD32 ih264e_set_vui_params(void *pv_api_ip,
|
|||
|
||||
return IV_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
*
|
||||
* @brief
|
||||
* Sets Mastering display color volume sei params
|
||||
*
|
||||
* @par Description:
|
||||
* Supplemental enhancement information
|
||||
*
|
||||
* @param[in] pv_api_ip
|
||||
* Pointer to input argument structure
|
||||
*
|
||||
* @param[out] pv_api_op
|
||||
* Pointer to output argument structure
|
||||
*
|
||||
* @param[out] ps_cfg
|
||||
* Pointer to config structure to be updated
|
||||
*
|
||||
* @return error status
|
||||
*
|
||||
* @remarks none
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
static WORD32 ih264e_set_sei_mdcv_params(void *pv_api_ip,
|
||||
void *pv_api_op,
|
||||
cfg_params_t *ps_cfg)
|
||||
{
|
||||
WORD32 i4_count;
|
||||
/* ctrl call I/O structures */
|
||||
ih264e_ctl_set_sei_mdcv_params_ip_t *ps_ip = pv_api_ip;
|
||||
ih264e_ctl_set_sei_mdcv_params_op_t *ps_op = pv_api_op;
|
||||
sei_params_t *ps_sei = &ps_cfg->s_sei;
|
||||
|
||||
ps_op->u4_error_code = 0;
|
||||
|
||||
ps_sei->u1_sei_mdcv_params_present_flag = ps_ip->u1_sei_mdcv_params_present_flag;
|
||||
for(i4_count = 0; i4_count < NUM_SEI_MDCV_PRIMARIES; i4_count++)
|
||||
{
|
||||
ps_sei->s_sei_mdcv_params.au2_display_primaries_x[i4_count] =
|
||||
ps_ip->au2_display_primaries_x[i4_count];
|
||||
ps_sei->s_sei_mdcv_params.au2_display_primaries_y[i4_count] =
|
||||
ps_ip->au2_display_primaries_y[i4_count];
|
||||
}
|
||||
|
||||
ps_sei->s_sei_mdcv_params.u2_white_point_x = ps_ip->u2_white_point_x;
|
||||
ps_sei->s_sei_mdcv_params.u2_white_point_y = ps_ip->u2_white_point_y;
|
||||
ps_sei->s_sei_mdcv_params.u4_max_display_mastering_luminance =
|
||||
ps_ip->u4_max_display_mastering_luminance;
|
||||
ps_sei->s_sei_mdcv_params.u4_min_display_mastering_luminance =
|
||||
ps_ip->u4_min_display_mastering_luminance;
|
||||
|
||||
ps_cfg->u4_timestamp_high = ps_ip->u4_timestamp_high;
|
||||
ps_cfg->u4_timestamp_low = ps_ip->u4_timestamp_low;
|
||||
|
||||
return IV_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
*
|
||||
* @brief
|
||||
* Sets content light level sei params
|
||||
*
|
||||
* @par Description:
|
||||
* Supplemental enhancement information
|
||||
*
|
||||
* @param[in] pv_api_ip
|
||||
* Pointer to input argument structure
|
||||
*
|
||||
* @param[out] pv_api_op
|
||||
* Pointer to output argument structure
|
||||
*
|
||||
* @param[out] ps_cfg
|
||||
* Pointer to config structure to be updated
|
||||
*
|
||||
* @return error status
|
||||
*
|
||||
* @remarks none
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
static WORD32 ih264e_set_sei_cll_params(void *pv_api_ip,
|
||||
void *pv_api_op,
|
||||
cfg_params_t *ps_cfg)
|
||||
{
|
||||
/* ctrl call I/O structures */
|
||||
ih264e_ctl_set_sei_cll_params_ip_t *ps_ip = pv_api_ip;
|
||||
ih264e_ctl_set_sei_cll_params_op_t *ps_op = pv_api_op;
|
||||
sei_params_t *ps_sei = &ps_cfg->s_sei;
|
||||
|
||||
ps_op->u4_error_code = 0;
|
||||
|
||||
ps_sei->u1_sei_cll_params_present_flag = ps_ip->u1_sei_cll_params_present_flag;
|
||||
|
||||
ps_sei->s_sei_cll_params.u2_max_content_light_level = ps_ip->u2_max_content_light_level;
|
||||
ps_sei->s_sei_cll_params.u2_max_pic_average_light_level =
|
||||
ps_ip->u2_max_pic_average_light_level;
|
||||
|
||||
ps_cfg->u4_timestamp_high = ps_ip->u4_timestamp_high;
|
||||
ps_cfg->u4_timestamp_low = ps_ip->u4_timestamp_low;
|
||||
|
||||
return IV_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
*
|
||||
* @brief
|
||||
* Sets ambient viewing environment sei params
|
||||
*
|
||||
* @par Description:
|
||||
* Supplemental enhancement information
|
||||
*
|
||||
* @param[in] pv_api_ip
|
||||
* Pointer to input argument structure
|
||||
*
|
||||
* @param[out] pv_api_op
|
||||
* Pointer to output argument structure
|
||||
*
|
||||
* @param[out] ps_cfg
|
||||
* Pointer to config structure to be updated
|
||||
*
|
||||
* @return error status
|
||||
*
|
||||
* @remarks none
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
static WORD32 ih264e_set_sei_ave_params(void *pv_api_ip,
|
||||
void *pv_api_op,
|
||||
cfg_params_t *ps_cfg)
|
||||
{
|
||||
/* ctrl call I/O structures */
|
||||
ih264e_ctl_set_sei_ave_params_ip_t *ps_ip = pv_api_ip;
|
||||
ih264e_ctl_set_sei_ave_params_op_t *ps_op = pv_api_op;
|
||||
sei_params_t *ps_sei = &ps_cfg->s_sei;
|
||||
|
||||
ps_op->u4_error_code = 0;
|
||||
|
||||
ps_sei->u1_sei_ave_params_present_flag = ps_ip->u1_sei_ave_params_present_flag;
|
||||
|
||||
ps_sei->s_sei_ave_params.u4_ambient_illuminance = ps_ip->u4_ambient_illuminance;
|
||||
ps_sei->s_sei_ave_params.u2_ambient_light_x = ps_ip->u2_ambient_light_x;
|
||||
ps_sei->s_sei_ave_params.u2_ambient_light_y = ps_ip->u2_ambient_light_y;
|
||||
|
||||
ps_cfg->u4_timestamp_high = ps_ip->u4_timestamp_high;
|
||||
ps_cfg->u4_timestamp_low = ps_ip->u4_timestamp_low;
|
||||
|
||||
return IV_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
*
|
||||
* @brief
|
||||
* Sets content color volume sei params
|
||||
*
|
||||
* @par Description:
|
||||
* Supplemental enhancement information
|
||||
*
|
||||
* @param[in] pv_api_ip
|
||||
* Pointer to input argument structure
|
||||
*
|
||||
* @param[out] pv_api_op
|
||||
* Pointer to output argument structure
|
||||
*
|
||||
* @param[out] ps_cfg
|
||||
* Pointer to config structure to be updated
|
||||
*
|
||||
* @return error status
|
||||
*
|
||||
* @remarks none
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
static WORD32 ih264e_set_sei_ccv_params(void *pv_api_ip,
|
||||
void *pv_api_op,
|
||||
cfg_params_t *ps_cfg)
|
||||
{
|
||||
WORD32 i4_count;
|
||||
/* ctrl call I/O structures */
|
||||
ih264e_ctl_set_sei_ccv_params_ip_t *ps_ip = pv_api_ip;
|
||||
ih264e_ctl_set_sei_ccv_params_op_t *ps_op = pv_api_op;
|
||||
sei_params_t *ps_sei = &ps_cfg->s_sei;
|
||||
|
||||
ps_op->u4_error_code = 0;
|
||||
|
||||
ps_sei->u1_sei_ccv_params_present_flag = ps_ip->u1_sei_ccv_params_present_flag;
|
||||
|
||||
ps_sei->s_sei_ccv_params.u1_ccv_cancel_flag = ps_ip->u1_ccv_cancel_flag;
|
||||
ps_sei->s_sei_ccv_params.u1_ccv_persistence_flag = ps_ip->u1_ccv_persistence_flag;
|
||||
ps_sei->s_sei_ccv_params.u1_ccv_primaries_present_flag =
|
||||
ps_ip->u1_ccv_primaries_present_flag;
|
||||
ps_sei->s_sei_ccv_params.u1_ccv_min_luminance_value_present_flag =
|
||||
ps_ip->u1_ccv_min_luminance_value_present_flag;
|
||||
ps_sei->s_sei_ccv_params.u1_ccv_max_luminance_value_present_flag =
|
||||
ps_ip->u1_ccv_max_luminance_value_present_flag;
|
||||
ps_sei->s_sei_ccv_params.u1_ccv_avg_luminance_value_present_flag =
|
||||
ps_ip->u1_ccv_avg_luminance_value_present_flag;
|
||||
ps_sei->s_sei_ccv_params.u1_ccv_reserved_zero_2bits =
|
||||
ps_ip->u1_ccv_reserved_zero_2bits;
|
||||
|
||||
for(i4_count = 0; i4_count < NUM_SEI_CCV_PRIMARIES; i4_count++)
|
||||
{
|
||||
ps_sei->s_sei_ccv_params.ai4_ccv_primaries_x[i4_count] =
|
||||
ps_ip->ai4_ccv_primaries_x[i4_count];
|
||||
ps_sei->s_sei_ccv_params.ai4_ccv_primaries_y[i4_count] =
|
||||
ps_ip->ai4_ccv_primaries_y[i4_count];
|
||||
}
|
||||
|
||||
ps_sei->s_sei_ccv_params.u4_ccv_min_luminance_value = ps_ip->u4_ccv_min_luminance_value;
|
||||
ps_sei->s_sei_ccv_params.u4_ccv_max_luminance_value = ps_ip->u4_ccv_max_luminance_value;
|
||||
ps_sei->s_sei_ccv_params.u4_ccv_avg_luminance_value = ps_ip->u4_ccv_avg_luminance_value;
|
||||
|
||||
ps_cfg->u4_timestamp_high = ps_ip->u4_timestamp_high;
|
||||
ps_cfg->u4_timestamp_low = ps_ip->u4_timestamp_low;
|
||||
|
||||
return IV_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
*
|
||||
|
|
@ -5573,6 +6205,22 @@ static WORD32 ih264e_ctl(iv_obj_t *ps_codec_obj,
|
|||
ret = ih264e_set_vui_params(pv_api_ip, pv_api_op, ps_cfg);
|
||||
break;
|
||||
|
||||
case IVE_CMD_CTL_SET_SEI_MDCV_PARAMS:
|
||||
ret = ih264e_set_sei_mdcv_params(pv_api_ip, pv_api_op, ps_cfg);
|
||||
break;
|
||||
|
||||
case IVE_CMD_CTL_SET_SEI_CLL_PARAMS:
|
||||
ret = ih264e_set_sei_cll_params(pv_api_ip, pv_api_op, ps_cfg);
|
||||
break;
|
||||
|
||||
case IVE_CMD_CTL_SET_SEI_AVE_PARAMS:
|
||||
ret = ih264e_set_sei_ave_params(pv_api_ip, pv_api_op, ps_cfg);
|
||||
break;
|
||||
|
||||
case IVE_CMD_CTL_SET_SEI_CCV_PARAMS:
|
||||
ret = ih264e_set_sei_ccv_params(pv_api_ip, pv_api_op, ps_cfg);
|
||||
break;
|
||||
|
||||
case IVE_CMD_CTL_RESET:
|
||||
|
||||
/* invalidate config param struct as it is being served right away */
|
||||
|
|
|
|||
|
|
@ -96,6 +96,9 @@
|
|||
#include "ih264e_ittiam_logo.h"
|
||||
#endif
|
||||
|
||||
|
||||
#define SEI_BASED_FORCE_IDR 1
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Function Definitions */
|
||||
/*****************************************************************************/
|
||||
|
|
@ -229,7 +232,7 @@ WORD32 ih264e_encode(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op)
|
|||
/* Check for output memory allocation size */
|
||||
if (ps_video_encode_ip->s_ive_ip.s_out_buf.u4_bufsize < MIN_STREAM_SIZE)
|
||||
{
|
||||
error_status |= IH264E_INSUFFICIENT_OUTPUT_BUFFER;
|
||||
error_status = IH264E_INSUFFICIENT_OUTPUT_BUFFER;
|
||||
SET_ERROR_ON_RETURN(error_status,
|
||||
IVE_UNSUPPORTEDPARAM,
|
||||
ps_video_encode_op->s_ive_op.u4_error_code,
|
||||
|
|
@ -274,7 +277,7 @@ WORD32 ih264e_encode(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op)
|
|||
((WORD32)ps_cfg->u4_timestamp_high == -1) ||
|
||||
((WORD32)ps_cfg->u4_timestamp_low == -1) )
|
||||
{
|
||||
error_status |= ih264e_codec_update_config(ps_codec, ps_cfg);
|
||||
error_status = ih264e_codec_update_config(ps_codec, ps_cfg);
|
||||
SET_ERROR_ON_RETURN(error_status,
|
||||
IVE_UNSUPPORTEDPARAM,
|
||||
ps_video_encode_op->s_ive_op.u4_error_code,
|
||||
|
|
@ -284,7 +287,84 @@ WORD32 ih264e_encode(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op)
|
|||
}
|
||||
}
|
||||
}
|
||||
/* Force IDR based on SEI params */
|
||||
#if SEI_BASED_FORCE_IDR
|
||||
{
|
||||
sei_mdcv_params_t *ps_sei_mdcv_params = &ps_codec->s_sei.s_sei_mdcv_params;
|
||||
sei_mdcv_params_t *ps_cfg_sei_mdcv_params =
|
||||
&ps_codec->s_cfg.s_sei.s_sei_mdcv_params;
|
||||
sei_cll_params_t *ps_sei_cll_params = &ps_codec->s_sei.s_sei_cll_params;
|
||||
sei_cll_params_t *ps_cfg_sei_cll_params =
|
||||
&ps_codec->s_cfg.s_sei.s_sei_cll_params;
|
||||
sei_ave_params_t *ps_sei_ave_params = &ps_codec->s_sei.s_sei_ave_params;
|
||||
sei_ave_params_t *ps_cfg_sei_ave_params =
|
||||
&ps_codec->s_cfg.s_sei.s_sei_ave_params;
|
||||
|
||||
if((ps_sei_mdcv_params->au2_display_primaries_x[0]!=
|
||||
ps_cfg_sei_mdcv_params->au2_display_primaries_x[0]) ||
|
||||
(ps_sei_mdcv_params->au2_display_primaries_x[1] !=
|
||||
ps_cfg_sei_mdcv_params->au2_display_primaries_x[1]) ||
|
||||
(ps_sei_mdcv_params->au2_display_primaries_x[2] !=
|
||||
ps_cfg_sei_mdcv_params->au2_display_primaries_x[2]) ||
|
||||
(ps_sei_mdcv_params->au2_display_primaries_y[0] !=
|
||||
ps_cfg_sei_mdcv_params->au2_display_primaries_y[0]) ||
|
||||
(ps_sei_mdcv_params->au2_display_primaries_y[1] !=
|
||||
ps_cfg_sei_mdcv_params->au2_display_primaries_y[1]) ||
|
||||
(ps_sei_mdcv_params->au2_display_primaries_y[2] !=
|
||||
ps_cfg_sei_mdcv_params->au2_display_primaries_y[2]) ||
|
||||
(ps_sei_mdcv_params->u2_white_point_x !=
|
||||
ps_cfg_sei_mdcv_params->u2_white_point_x) ||
|
||||
(ps_sei_mdcv_params->u2_white_point_y !=
|
||||
ps_cfg_sei_mdcv_params->u2_white_point_y) ||
|
||||
(ps_sei_mdcv_params->u4_max_display_mastering_luminance !=
|
||||
ps_cfg_sei_mdcv_params->u4_max_display_mastering_luminance) ||
|
||||
(ps_sei_mdcv_params->u4_min_display_mastering_luminance !=
|
||||
ps_cfg_sei_mdcv_params->u4_min_display_mastering_luminance))
|
||||
{
|
||||
ps_codec->s_sei.s_sei_mdcv_params = ps_codec->s_cfg.s_sei.s_sei_mdcv_params;
|
||||
ps_codec->s_sei.u1_sei_mdcv_params_present_flag = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_codec->s_sei.u1_sei_mdcv_params_present_flag = 0;
|
||||
}
|
||||
|
||||
if((ps_sei_cll_params->u2_max_content_light_level !=
|
||||
ps_cfg_sei_cll_params->u2_max_content_light_level) ||
|
||||
(ps_sei_cll_params->u2_max_pic_average_light_level !=
|
||||
ps_cfg_sei_cll_params->u2_max_pic_average_light_level))
|
||||
{
|
||||
ps_codec->s_sei.s_sei_cll_params = ps_codec->s_cfg.s_sei.s_sei_cll_params;
|
||||
ps_codec->s_sei.u1_sei_cll_params_present_flag = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_codec->s_sei.u1_sei_cll_params_present_flag = 0;
|
||||
}
|
||||
|
||||
if((ps_sei_ave_params->u4_ambient_illuminance !=
|
||||
ps_cfg_sei_ave_params->u4_ambient_illuminance) ||
|
||||
(ps_sei_ave_params->u2_ambient_light_x !=
|
||||
ps_cfg_sei_ave_params->u2_ambient_light_x) ||
|
||||
(ps_sei_ave_params->u2_ambient_light_y !=
|
||||
ps_cfg_sei_ave_params->u2_ambient_light_y))
|
||||
{
|
||||
ps_codec->s_sei.s_sei_ave_params = ps_codec->s_cfg.s_sei.s_sei_ave_params;
|
||||
ps_codec->s_sei.u1_sei_ave_params_present_flag = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ps_codec->s_sei.u1_sei_ave_params_present_flag = 0;
|
||||
}
|
||||
|
||||
if((1 == ps_codec->s_sei.u1_sei_mdcv_params_present_flag) ||
|
||||
(1 == ps_codec->s_sei.u1_sei_cll_params_present_flag) ||
|
||||
(1 == ps_codec->s_sei.u1_sei_ave_params_present_flag))
|
||||
{
|
||||
ps_codec->force_curr_frame_type = IV_IDR_FRAME;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/******************************************************************
|
||||
* INSERT LOGO
|
||||
*****************************************************************/
|
||||
|
|
@ -321,14 +401,14 @@ WORD32 ih264e_encode(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op)
|
|||
/********************************************************************/
|
||||
|
||||
/* initialize mv bank buffer manager */
|
||||
error_status |= ih264e_mv_buf_mgr_add_bufs(ps_codec);
|
||||
error_status = ih264e_mv_buf_mgr_add_bufs(ps_codec);
|
||||
SET_ERROR_ON_RETURN(error_status,
|
||||
IVE_FATALERROR,
|
||||
ps_video_encode_op->s_ive_op.u4_error_code,
|
||||
IV_FAIL);
|
||||
|
||||
/* initialize ref bank buffer manager */
|
||||
error_status |= ih264e_pic_buf_mgr_add_bufs(ps_codec);
|
||||
error_status = ih264e_pic_buf_mgr_add_bufs(ps_codec);
|
||||
SET_ERROR_ON_RETURN(error_status,
|
||||
IVE_FATALERROR,
|
||||
ps_video_encode_op->s_ive_op.u4_error_code,
|
||||
|
|
@ -351,14 +431,7 @@ WORD32 ih264e_encode(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op)
|
|||
ps_codec->force_curr_frame_type = IV_IDR_FRAME;
|
||||
|
||||
/* generate header */
|
||||
error_status |= ih264e_generate_sps_pps(ps_codec);
|
||||
|
||||
/* api call cnt */
|
||||
ps_codec->i4_encode_api_call_cnt --;
|
||||
|
||||
/* header mode tag is not sticky */
|
||||
ps_codec->i4_header_mode = 0;
|
||||
ps_codec->i4_gen_header = 0;
|
||||
error_status = ih264e_generate_sps_pps(ps_codec);
|
||||
|
||||
/* send the input to app */
|
||||
ps_video_encode_op->s_ive_op.s_inp_buf = ps_video_encode_ip->s_ive_ip.s_inp_buf;
|
||||
|
|
@ -381,6 +454,13 @@ WORD32 ih264e_encode(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op)
|
|||
/* indicates that header has been generated previously */
|
||||
ps_codec->u4_header_generated = 1;
|
||||
|
||||
/* api call cnt */
|
||||
ps_codec->i4_encode_api_call_cnt --;
|
||||
|
||||
/* header mode tag is not sticky */
|
||||
ps_codec->i4_header_mode = 0;
|
||||
ps_codec->i4_gen_header = 0;
|
||||
|
||||
return IV_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -412,7 +492,7 @@ WORD32 ih264e_encode(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op)
|
|||
ps_codec->ai4_pic_cnt[ctxt_sel] = ps_codec->i4_pic_cnt;
|
||||
|
||||
/* initialize all relevant process ctxts */
|
||||
error_status |= ih264e_pic_init(ps_codec, &s_inp_buf);
|
||||
error_status = ih264e_pic_init(ps_codec, &s_inp_buf);
|
||||
SET_ERROR_ON_RETURN(error_status,
|
||||
IVE_FATALERROR,
|
||||
ps_video_encode_op->s_ive_op.u4_error_code,
|
||||
|
|
@ -685,12 +765,12 @@ WORD32 ih264e_encode(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op)
|
|||
|
||||
for (i = 0; i < (WORD32)ps_codec->s_cfg.u4_num_cores; i++)
|
||||
{
|
||||
error_status |= ps_codec->as_process[ctxt_sel + i].i4_error_code;
|
||||
error_status = ps_codec->as_process[ctxt_sel + i].i4_error_code;
|
||||
SET_ERROR_ON_RETURN(error_status,
|
||||
IVE_FATALERROR,
|
||||
ps_video_encode_op->s_ive_op.u4_error_code,
|
||||
IV_FAIL);
|
||||
}
|
||||
SET_ERROR_ON_RETURN(error_status,
|
||||
IVE_FATALERROR,
|
||||
ps_video_encode_op->s_ive_op.u4_error_code,
|
||||
IV_FAIL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
* - ih264e_generate_nal_unit_header()
|
||||
* - ih264e_generate_sps()
|
||||
* - ih264e_generate_pps()
|
||||
* - ih264e_generate_sei()
|
||||
* - ih264e_generate_slice_header()
|
||||
* - ih264e_get_level()
|
||||
* - ih264e_populate_sps()
|
||||
|
|
@ -87,6 +88,7 @@
|
|||
#include "ih264e_rate_control.h"
|
||||
#include "ih264e_cabac_structs.h"
|
||||
#include "ih264e_structs.h"
|
||||
#include "ih264e_sei.h"
|
||||
#include "ih264e_encode_header.h"
|
||||
#include "ih264_common_tables.h"
|
||||
#include "ih264_macros.h"
|
||||
|
|
@ -443,11 +445,17 @@ WORD32 ih264e_generate_sps(bitstrm_t *ps_bitstrm, sps_t *ps_sps, vui_t *ps_vui)
|
|||
WORD8 i1_nal_ref_idc = 3;
|
||||
|
||||
/* Insert Start Code */
|
||||
return_status |= ih264e_put_nal_start_code_prefix(ps_bitstrm, 1);
|
||||
|
||||
return_status = ih264e_put_nal_start_code_prefix(ps_bitstrm, 1);
|
||||
if(return_status != IH264E_SUCCESS)
|
||||
{
|
||||
return return_status;
|
||||
}
|
||||
/* Insert Nal Unit Header */
|
||||
return_status |= ih264e_generate_nal_unit_header(ps_bitstrm, i1_nal_unit_type, i1_nal_ref_idc);
|
||||
|
||||
return_status = ih264e_generate_nal_unit_header(ps_bitstrm, i1_nal_unit_type, i1_nal_ref_idc);
|
||||
if(return_status != IH264E_SUCCESS)
|
||||
{
|
||||
return return_status;
|
||||
}
|
||||
/* profile_idc */
|
||||
PUT_BITS(ps_bitstrm, ps_sps->u1_profile_idc, 8, return_status, "profile_idc");
|
||||
|
||||
|
|
@ -577,11 +585,15 @@ WORD32 ih264e_generate_sps(bitstrm_t *ps_bitstrm, sps_t *ps_sps, vui_t *ps_vui)
|
|||
if (ps_sps->i1_vui_parameters_present_flag)
|
||||
{
|
||||
/* Add vui parameters to the bitstream */;
|
||||
return_status |= ih264e_generate_vui(ps_bitstrm, ps_vui);
|
||||
return_status = ih264e_generate_vui(ps_bitstrm, ps_vui);
|
||||
if(return_status != IH264E_SUCCESS)
|
||||
{
|
||||
return return_status;
|
||||
}
|
||||
}
|
||||
|
||||
/* rbsp trailing bits */
|
||||
return_status |= ih264e_put_rbsp_trailing_bits(ps_bitstrm);
|
||||
return_status = ih264e_put_rbsp_trailing_bits(ps_bitstrm);
|
||||
|
||||
return return_status;
|
||||
}
|
||||
|
|
@ -609,7 +621,11 @@ WORD32 ih264e_generate_pps(bitstrm_t *ps_bitstrm, pps_t *ps_pps, sps_t *ps_sps)
|
|||
WORD32 return_status = IH264E_SUCCESS;
|
||||
|
||||
/* Insert the NAL start code */
|
||||
return_status |= ih264e_put_nal_start_code_prefix(ps_bitstrm, 1);
|
||||
return_status = ih264e_put_nal_start_code_prefix(ps_bitstrm, 1);
|
||||
if(return_status != IH264E_SUCCESS)
|
||||
{
|
||||
return return_status;
|
||||
}
|
||||
|
||||
/* Insert Nal Unit Header */
|
||||
PUT_BITS(ps_bitstrm, NAL_PPS_FIRST_BYTE, 8, return_status, "pps_header");
|
||||
|
|
@ -682,7 +698,96 @@ WORD32 ih264e_generate_pps(bitstrm_t *ps_bitstrm, pps_t *ps_pps, sps_t *ps_sps)
|
|||
PUT_BITS_SEV(ps_bitstrm, ps_pps->i1_second_chroma_qp_index_offset, return_status, "Second chroma QP offset");
|
||||
}
|
||||
|
||||
return_status |= ih264e_put_rbsp_trailing_bits(ps_bitstrm);
|
||||
return_status = ih264e_put_rbsp_trailing_bits(ps_bitstrm);
|
||||
|
||||
return return_status;
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @brief Generates SEI (Supplemental Enhancement Information)
|
||||
*
|
||||
* @par Description
|
||||
* This function generates Supplemental Enhancement Information header as per the spec
|
||||
*
|
||||
* @param[in] ps_bitstrm
|
||||
* pointer to bitstream context (handle)
|
||||
*
|
||||
* @param[in] ps_sei
|
||||
* pointer to structure containing SEI data
|
||||
*
|
||||
* @return success or failure error code
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
IH264E_ERROR_T ih264e_generate_sei(bitstrm_t *ps_bitstrm, sei_params_t *ps_sei,
|
||||
UWORD32 u4_insert_per_idr)
|
||||
{
|
||||
WORD32 return_status = IH264E_SUCCESS;
|
||||
WORD8 i1_nal_unit_type = NAL_SEI;
|
||||
WORD8 i1_nal_ref_idc = 0;
|
||||
|
||||
/* Insert Start Code */
|
||||
return_status = ih264e_put_nal_start_code_prefix(ps_bitstrm, 1);
|
||||
if(return_status != IH264E_SUCCESS)
|
||||
{
|
||||
return return_status;
|
||||
}
|
||||
|
||||
/* Insert Nal Unit Header */
|
||||
return_status = ih264e_generate_nal_unit_header(ps_bitstrm,
|
||||
i1_nal_unit_type, i1_nal_ref_idc);
|
||||
if(return_status != IH264E_SUCCESS)
|
||||
{
|
||||
return return_status;
|
||||
}
|
||||
/* Mastering Display Color SEI */
|
||||
if(1 == ps_sei->u1_sei_mdcv_params_present_flag && u4_insert_per_idr)
|
||||
{
|
||||
return_status = ih264e_put_sei_msg(IH264_SEI_MASTERING_DISP_COL_VOL,
|
||||
ps_sei, ps_bitstrm);
|
||||
if(return_status != IH264E_SUCCESS)
|
||||
{
|
||||
return return_status;
|
||||
}
|
||||
}
|
||||
|
||||
/* Content Light Level Information*/
|
||||
if(1 == ps_sei->u1_sei_cll_params_present_flag && u4_insert_per_idr)
|
||||
{
|
||||
return_status = ih264e_put_sei_msg(IH264_SEI_CONTENT_LIGHT_LEVEL_DATA,
|
||||
ps_sei, ps_bitstrm);
|
||||
if(return_status != IH264E_SUCCESS)
|
||||
{
|
||||
return return_status;
|
||||
}
|
||||
}
|
||||
|
||||
/* Ambient viewing environment SEI */
|
||||
if(1 == ps_sei->u1_sei_ave_params_present_flag && u4_insert_per_idr)
|
||||
{
|
||||
return_status = ih264e_put_sei_msg(IH264_SEI_AMBIENT_VIEWING_ENVIRONMENT,
|
||||
ps_sei, ps_bitstrm);
|
||||
if(return_status != IH264E_SUCCESS)
|
||||
{
|
||||
return return_status;
|
||||
}
|
||||
}
|
||||
|
||||
/* Content color volume Information*/
|
||||
if(1 == ps_sei->u1_sei_ccv_params_present_flag)
|
||||
{
|
||||
return_status = ih264e_put_sei_msg(IH264_SEI_CONTENT_COLOR_VOLUME,
|
||||
ps_sei, ps_bitstrm);
|
||||
if(return_status != IH264E_SUCCESS)
|
||||
{
|
||||
return return_status;
|
||||
}
|
||||
}
|
||||
|
||||
/* rbsp trailing bits */
|
||||
return_status = ih264e_put_rbsp_trailing_bits(ps_bitstrm);
|
||||
|
||||
return return_status;
|
||||
}
|
||||
|
|
@ -726,11 +831,17 @@ WORD32 ih264e_generate_slice_header(bitstrm_t *ps_bitstrm,
|
|||
WORD32 return_status = IH264E_SUCCESS;
|
||||
|
||||
/* Insert start code */
|
||||
return_status |= ih264e_put_nal_start_code_prefix(ps_bitstrm, 1);
|
||||
|
||||
return_status = ih264e_put_nal_start_code_prefix(ps_bitstrm, 1);
|
||||
if(return_status != IH264E_SUCCESS)
|
||||
{
|
||||
return return_status;
|
||||
}
|
||||
/* Insert Nal Unit Header */
|
||||
return_status |= ih264e_generate_nal_unit_header(ps_bitstrm, ps_slice_hdr->i1_nal_unit_type, ps_slice_hdr->i1_nal_unit_idc);
|
||||
|
||||
return_status = ih264e_generate_nal_unit_header(ps_bitstrm, ps_slice_hdr->i1_nal_unit_type, ps_slice_hdr->i1_nal_unit_idc);
|
||||
if(return_status != IH264E_SUCCESS)
|
||||
{
|
||||
return return_status;
|
||||
}
|
||||
/* first_mb_in_slice */
|
||||
PUT_BITS_UEV(ps_bitstrm, ps_slice_hdr->u2_first_mb_in_slice, return_status, "first_mb_in_slice");
|
||||
|
||||
|
|
@ -1507,7 +1618,11 @@ IH264E_ERROR_T ih264e_add_filler_nal_unit(bitstrm_t *ps_bitstrm,
|
|||
IH264E_ERROR_T return_status = IH264E_SUCCESS;
|
||||
|
||||
/* Insert the NAL start code */
|
||||
return_status |= ih264e_put_nal_start_code_prefix(ps_bitstrm, 1);
|
||||
return_status = ih264e_put_nal_start_code_prefix(ps_bitstrm, 1);
|
||||
if(return_status != IH264E_SUCCESS)
|
||||
{
|
||||
return return_status;
|
||||
}
|
||||
|
||||
if (ps_bitstrm->u4_strm_buf_offset + insert_fill_bytes >= ps_bitstrm->u4_max_strm_size)
|
||||
{
|
||||
|
|
@ -1543,7 +1658,7 @@ IH264E_ERROR_T ih264e_add_filler_nal_unit(bitstrm_t *ps_bitstrm,
|
|||
i4_num_words_to_fill-- ;
|
||||
}
|
||||
|
||||
return_status |= ih264e_put_rbsp_trailing_bits(ps_bitstrm);
|
||||
return_status = ih264e_put_rbsp_trailing_bits(ps_bitstrm);
|
||||
|
||||
return return_status;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,9 +49,15 @@
|
|||
* bitstream
|
||||
******************************************************************************
|
||||
*/
|
||||
#define PUT_BITS(ps_bitstrm, code_val, code_len, ret_val, syntax_string) \
|
||||
ENTROPY_TRACE(syntax_string, code_val);\
|
||||
ret_val |= ih264e_put_bits((ps_bitstrm), (code_val), (code_len))
|
||||
#define PUT_BITS(ps_bitstrm, code_val, code_len, ret_val, syntax_string) \
|
||||
{ \
|
||||
ENTROPY_TRACE(syntax_string, code_val); \
|
||||
ret_val = ih264e_put_bits((ps_bitstrm), (code_val), (code_len)); \
|
||||
if(ret_val != IH264E_SUCCESS) \
|
||||
{ \
|
||||
return ret_val; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
|
|
@ -60,10 +66,15 @@
|
|||
* signed numbers
|
||||
******************************************************************************
|
||||
*/
|
||||
#define PUT_BITS_UEV(ps_bitstrm, code_val, ret_val, syntax_string) \
|
||||
ENTROPY_TRACE(syntax_string, code_val);\
|
||||
ret_val |= ih264e_put_uev((ps_bitstrm), (code_val))
|
||||
|
||||
#define PUT_BITS_UEV(ps_bitstrm, code_val, ret_val, syntax_string) \
|
||||
{ \
|
||||
ENTROPY_TRACE(syntax_string, code_val); \
|
||||
ret_val = ih264e_put_uev((ps_bitstrm), (code_val)); \
|
||||
if(ret_val != IH264E_SUCCESS) \
|
||||
{ \
|
||||
return ret_val; \
|
||||
} \
|
||||
}
|
||||
/**
|
||||
******************************************************************************
|
||||
* @brief Macro to put a code with specified number of bits into the
|
||||
|
|
@ -71,10 +82,15 @@
|
|||
* signed numbers
|
||||
******************************************************************************
|
||||
*/
|
||||
#define PUT_BITS_SEV(ps_bitstrm, code_val, ret_val, syntax_string) \
|
||||
ENTROPY_TRACE(syntax_string, code_val);\
|
||||
ret_val |= ih264e_put_sev((ps_bitstrm), (code_val))
|
||||
|
||||
#define PUT_BITS_SEV(ps_bitstrm, code_val, ret_val, syntax_string) \
|
||||
{ \
|
||||
ENTROPY_TRACE(syntax_string, code_val); \
|
||||
ret_val = ih264e_put_sev((ps_bitstrm), (code_val)); \
|
||||
if(ret_val != IH264E_SUCCESS) \
|
||||
{ \
|
||||
return ret_val; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Extern Function Declarations */
|
||||
|
|
@ -130,6 +146,31 @@ WORD32 ih264e_generate_pps
|
|||
sps_t *ps_sps
|
||||
);
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @brief Generates SEI (Supplemental Enhancement Information)
|
||||
*
|
||||
* @par Description
|
||||
* This function generates Supplemental Enhancement Information header as per the spec
|
||||
*
|
||||
* @param[in] ps_bitstrm
|
||||
* pointer to bitstream context (handle)
|
||||
*
|
||||
* @param[in] ps_sei
|
||||
* pointer to structure containing SEI data
|
||||
*
|
||||
* @return success or failure error code
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
IH264E_ERROR_T ih264e_generate_sei
|
||||
(
|
||||
bitstrm_t *ps_bitstrm,
|
||||
sei_params_t *ps_sei,
|
||||
UWORD32 u4_insert_per_idr
|
||||
);
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
|
|
|
|||
|
|
@ -229,6 +229,18 @@ typedef enum
|
|||
/**Invalid Constrained Intra prediction mode */
|
||||
IH264E_INVALID_CONSTRAINED_INTRA_PREDICTION_MODE = IH264E_CODEC_ERROR_START + 0x32,
|
||||
|
||||
/**Invalid mastering display color volume sei params */
|
||||
IH264E_INVALID_SEI_MDCV_PARAMS = IH264E_CODEC_ERROR_START + 0x33,
|
||||
|
||||
/**Invalid content light level sei params */
|
||||
IH264E_INVALID_SEI_CLL_PARAMS = IH264E_CODEC_ERROR_START + 0x34,
|
||||
|
||||
/**Invalid ambient viewing environment sei params */
|
||||
IH264E_INVALID_SEI_AVE_PARAMS = IH264E_CODEC_ERROR_START + 0x35,
|
||||
|
||||
/**Invalid content color volume sei params */
|
||||
IH264E_INVALID_SEI_CCV_PARAMS = IH264E_CODEC_ERROR_START + 0x36,
|
||||
|
||||
/**max failure error code to ensure enum is 32 bits wide */
|
||||
IH264E_FAIL = -1,
|
||||
|
||||
|
|
|
|||
|
|
@ -181,11 +181,14 @@ IH264E_ERROR_T ih264e_generate_sps_pps(codec_t *ps_codec)
|
|||
ps_entropy->i4_error_code = IH264E_SUCCESS;
|
||||
|
||||
/* generate sps */
|
||||
ps_entropy->i4_error_code |= ih264e_generate_sps(ps_bitstrm, ps_sps,
|
||||
ps_entropy->i4_error_code = ih264e_generate_sps(ps_bitstrm, ps_sps,
|
||||
&ps_codec->s_cfg.s_vui);
|
||||
|
||||
if(ps_entropy->i4_error_code != IH264E_SUCCESS)
|
||||
{
|
||||
return ps_entropy->i4_error_code;
|
||||
}
|
||||
/* generate pps */
|
||||
ps_entropy->i4_error_code |= ih264e_generate_pps(ps_bitstrm, ps_pps, ps_sps);
|
||||
ps_entropy->i4_error_code = ih264e_generate_pps(ps_bitstrm, ps_pps, ps_sps);
|
||||
|
||||
/* queue output buffer */
|
||||
ps_out_buf->s_bits_buf.u4_bytes = ps_bitstrm->u4_strm_buf_offset;
|
||||
|
|
@ -302,6 +305,9 @@ IH264E_ERROR_T ih264e_entropy(process_ctxt_t *ps_proc)
|
|||
/* output buff */
|
||||
out_buf_t s_out_buf;
|
||||
|
||||
/* sei params */
|
||||
sei_params_t s_sei;
|
||||
|
||||
/* proc map */
|
||||
UWORD8 *pu1_proc_map;
|
||||
|
||||
|
|
@ -313,7 +319,7 @@ IH264E_ERROR_T ih264e_entropy(process_ctxt_t *ps_proc)
|
|||
|
||||
/* temp var */
|
||||
WORD32 i4_wd_mbs, i4_ht_mbs;
|
||||
UWORD32 u4_mb_cnt, u4_mb_idx, u4_mb_end_idx;
|
||||
UWORD32 u4_mb_cnt, u4_mb_idx, u4_mb_end_idx, u4_insert_per_idr;
|
||||
WORD32 bitstream_start_offset, bitstream_end_offset;
|
||||
/********************************************************************/
|
||||
/* BEGIN INIT */
|
||||
|
|
@ -372,11 +378,18 @@ IH264E_ERROR_T ih264e_entropy(process_ctxt_t *ps_proc)
|
|||
if (1 == ps_entropy->i4_gen_header)
|
||||
{
|
||||
/* generate sps */
|
||||
ps_entropy->i4_error_code |= ih264e_generate_sps(ps_bitstrm, ps_sps,
|
||||
ps_entropy->i4_error_code = ih264e_generate_sps(ps_bitstrm, ps_sps,
|
||||
&ps_codec->s_cfg.s_vui);
|
||||
if(ps_entropy->i4_error_code != IH264E_SUCCESS)
|
||||
{
|
||||
return ps_entropy->i4_error_code;
|
||||
}
|
||||
/* generate pps */
|
||||
ps_entropy->i4_error_code |= ih264e_generate_pps(ps_bitstrm, ps_pps, ps_sps);
|
||||
|
||||
ps_entropy->i4_error_code = ih264e_generate_pps(ps_bitstrm, ps_pps, ps_sps);
|
||||
if(ps_entropy->i4_error_code != IH264E_SUCCESS)
|
||||
{
|
||||
return ps_entropy->i4_error_code;
|
||||
}
|
||||
/* reset i4_gen_header */
|
||||
ps_entropy->i4_gen_header = 0;
|
||||
}
|
||||
|
|
@ -384,10 +397,57 @@ IH264E_ERROR_T ih264e_entropy(process_ctxt_t *ps_proc)
|
|||
/* populate slice header */
|
||||
ih264e_populate_slice_header(ps_proc, ps_slice_hdr, ps_pps, ps_sps);
|
||||
|
||||
/* generate slice header */
|
||||
ps_entropy->i4_error_code |= ih264e_generate_slice_header(ps_bitstrm, ps_slice_hdr,
|
||||
ps_pps, ps_sps);
|
||||
/* generate sei */
|
||||
u4_insert_per_idr = (NAL_SLICE_IDR == ps_slice_hdr->i1_nal_unit_type);
|
||||
|
||||
memset(&s_sei, 0, sizeof(sei_params_t));
|
||||
s_sei.u1_sei_mdcv_params_present_flag =
|
||||
ps_codec->s_cfg.s_sei.u1_sei_mdcv_params_present_flag;
|
||||
s_sei.s_sei_mdcv_params = ps_codec->s_cfg.s_sei.s_sei_mdcv_params;
|
||||
s_sei.u1_sei_cll_params_present_flag =
|
||||
ps_codec->s_cfg.s_sei.u1_sei_cll_params_present_flag;
|
||||
s_sei.s_sei_cll_params = ps_codec->s_cfg.s_sei.s_sei_cll_params;
|
||||
s_sei.u1_sei_ave_params_present_flag =
|
||||
ps_codec->s_cfg.s_sei.u1_sei_ave_params_present_flag;
|
||||
s_sei.s_sei_ave_params = ps_codec->s_cfg.s_sei.s_sei_ave_params;
|
||||
s_sei.u1_sei_ccv_params_present_flag = 0;
|
||||
s_sei.s_sei_ccv_params =
|
||||
ps_codec->as_inp_list[ps_codec->i4_poc % MAX_NUM_BFRAMES].s_sei_ccv;
|
||||
|
||||
if((1 == ps_sps->i1_vui_parameters_present_flag) &&
|
||||
(1 == ps_codec->s_cfg.s_vui.u1_video_signal_type_present_flag) &&
|
||||
(1 == ps_codec->s_cfg.s_vui.u1_colour_description_present_flag) &&
|
||||
(2 != ps_codec->s_cfg.s_vui.u1_colour_primaries) &&
|
||||
(2 != ps_codec->s_cfg.s_vui.u1_matrix_coefficients) &&
|
||||
(2 != ps_codec->s_cfg.s_vui.u1_transfer_characteristics) &&
|
||||
(4 != ps_codec->s_cfg.s_vui.u1_transfer_characteristics) &&
|
||||
(5 != ps_codec->s_cfg.s_vui.u1_transfer_characteristics))
|
||||
{
|
||||
s_sei.u1_sei_ccv_params_present_flag =
|
||||
ps_codec->as_inp_list[ps_codec->i4_poc % MAX_NUM_BFRAMES].u1_sei_ccv_params_present_flag;
|
||||
}
|
||||
|
||||
if((1 == s_sei.u1_sei_mdcv_params_present_flag && u4_insert_per_idr) ||
|
||||
(1 == s_sei.u1_sei_cll_params_present_flag && u4_insert_per_idr) ||
|
||||
(1 == s_sei.u1_sei_ave_params_present_flag && u4_insert_per_idr) ||
|
||||
(1 == s_sei.u1_sei_ccv_params_present_flag))
|
||||
{
|
||||
ps_entropy->i4_error_code =
|
||||
ih264e_generate_sei(ps_bitstrm, &s_sei, u4_insert_per_idr);
|
||||
if(ps_entropy->i4_error_code != IH264E_SUCCESS)
|
||||
{
|
||||
return ps_entropy->i4_error_code;
|
||||
}
|
||||
}
|
||||
ps_codec->as_inp_list[ps_codec->i4_poc % MAX_NUM_BFRAMES].u1_sei_ccv_params_present_flag = 0;
|
||||
|
||||
/* generate slice header */
|
||||
ps_entropy->i4_error_code = ih264e_generate_slice_header(ps_bitstrm, ps_slice_hdr,
|
||||
ps_pps, ps_sps);
|
||||
if(ps_entropy->i4_error_code != IH264E_SUCCESS)
|
||||
{
|
||||
return ps_entropy->i4_error_code;
|
||||
}
|
||||
/* once start of frame / slice is done, you can reset it */
|
||||
/* it is the responsibility of the caller to set this flag */
|
||||
ps_entropy->i4_sof = 0;
|
||||
|
|
@ -445,7 +505,13 @@ IH264E_ERROR_T ih264e_entropy(process_ctxt_t *ps_proc)
|
|||
|
||||
|
||||
/* write mb layer */
|
||||
ps_entropy->i4_error_code |= ps_codec->pf_write_mb_syntax_layer[ps_entropy->u1_entropy_coding_mode_flag][i4_slice_type](ps_entropy);
|
||||
ps_entropy->i4_error_code = ps_codec->pf_write_mb_syntax_layer
|
||||
[ps_entropy->u1_entropy_coding_mode_flag][i4_slice_type](ps_entropy);
|
||||
if(ps_entropy->i4_error_code != IH264E_SUCCESS)
|
||||
{
|
||||
return ps_entropy->i4_error_code;
|
||||
}
|
||||
|
||||
/* Starting bitstream offset for header in bits */
|
||||
bitstream_start_offset = GET_NUM_BITS(ps_bitstrm);
|
||||
|
||||
|
|
@ -492,7 +558,11 @@ IH264E_ERROR_T ih264e_entropy(process_ctxt_t *ps_proc)
|
|||
}
|
||||
}
|
||||
/* put rbsp trailing bits for the previous slice */
|
||||
ps_entropy->i4_error_code |= ih264e_put_rbsp_trailing_bits(ps_bitstrm);
|
||||
ps_entropy->i4_error_code = ih264e_put_rbsp_trailing_bits(ps_bitstrm);
|
||||
if(ps_entropy->i4_error_code != IH264E_SUCCESS)
|
||||
{
|
||||
return ps_entropy->i4_error_code;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -510,8 +580,12 @@ IH264E_ERROR_T ih264e_entropy(process_ctxt_t *ps_proc)
|
|||
ps_sps);
|
||||
|
||||
/* generate slice header */
|
||||
ps_entropy->i4_error_code |= ih264e_generate_slice_header(
|
||||
ps_entropy->i4_error_code = ih264e_generate_slice_header(
|
||||
ps_bitstrm, ps_slice_hdr, ps_pps, ps_sps);
|
||||
if(ps_entropy->i4_error_code != IH264E_SUCCESS)
|
||||
{
|
||||
return ps_entropy->i4_error_code;
|
||||
}
|
||||
if (CABAC == ps_entropy->u1_entropy_coding_mode_flag)
|
||||
{
|
||||
BITSTREAM_BYTE_ALIGN(ps_bitstrm);
|
||||
|
|
@ -569,7 +643,11 @@ IH264E_ERROR_T ih264e_entropy(process_ctxt_t *ps_proc)
|
|||
}
|
||||
}
|
||||
/* put rbsp trailing bits */
|
||||
ps_entropy->i4_error_code |= ih264e_put_rbsp_trailing_bits(ps_bitstrm);
|
||||
ps_entropy->i4_error_code = ih264e_put_rbsp_trailing_bits(ps_bitstrm);
|
||||
if(ps_entropy->i4_error_code != IH264E_SUCCESS)
|
||||
{
|
||||
return ps_entropy->i4_error_code;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -589,12 +667,16 @@ IH264E_ERROR_T ih264e_entropy(process_ctxt_t *ps_proc)
|
|||
/* cbr rc - house keeping */
|
||||
if (ps_codec->s_rate_control.post_encode_skip[ctxt_sel])
|
||||
{
|
||||
ps_entropy->ps_bitstrm->u4_strm_buf_offset = 0;
|
||||
ps_entropy->ps_bitstrm->u4_strm_buf_offset = 0;
|
||||
}
|
||||
else if (i4_stuff_bytes)
|
||||
{
|
||||
/* add filler nal units */
|
||||
ps_entropy->i4_error_code |= ih264e_add_filler_nal_unit(ps_bitstrm, i4_stuff_bytes);
|
||||
ps_entropy->i4_error_code = ih264e_add_filler_nal_unit(ps_bitstrm, i4_stuff_bytes);
|
||||
if(ps_entropy->i4_error_code != IH264E_SUCCESS)
|
||||
{
|
||||
return ps_entropy->i4_error_code;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1048,8 +1130,11 @@ WORD32 ih264e_update_proc_ctxt(process_ctxt_t *ps_proc)
|
|||
s_job.i2_proc_base_idx = (ps_codec->i4_encode_api_call_cnt % MAX_CTXT_SETS) ? (MAX_PROCESS_CTXT / 2) : 0;
|
||||
|
||||
/* queue the job */
|
||||
error_status |= ih264_list_queue(ps_proc->pv_entropy_jobq, &s_job, 1);
|
||||
|
||||
error_status = ih264_list_queue(ps_proc->pv_entropy_jobq, &s_job, 1);
|
||||
if(error_status != IH264_SUCCESS)
|
||||
{
|
||||
return error_status;
|
||||
}
|
||||
if(ps_proc->i4_mb_y == (i4_ht_mbs - 1))
|
||||
ih264_list_terminate(ps_codec->pv_entropy_jobq);
|
||||
}
|
||||
|
|
@ -2249,8 +2334,11 @@ UPDATE_MB_INFO:
|
|||
}
|
||||
|
||||
/* update the context after for coding next mb */
|
||||
error_status |= ih264e_update_proc_ctxt(ps_proc);
|
||||
|
||||
error_status = ih264e_update_proc_ctxt(ps_proc);
|
||||
if(error_status != IH264E_SUCCESS)
|
||||
{
|
||||
return error_status;
|
||||
}
|
||||
/* Once the last row is processed, mark the buffer status appropriately */
|
||||
if (ps_proc->i4_ht_mbs == ps_proc->i4_mb_y)
|
||||
{
|
||||
|
|
@ -2273,10 +2361,18 @@ UPDATE_MB_INFO:
|
|||
/* hence the slice map should be of no significance to perform debloc */
|
||||
/* king */
|
||||
/**********************************************************************/
|
||||
error_status |= ih264_buf_mgr_release(ps_codec->pv_mv_buf_mgr, ps_cur_mv_buf->i4_buf_id , BUF_MGR_CODEC);
|
||||
|
||||
error_status |= ih264_buf_mgr_release(ps_codec->pv_ref_buf_mgr, ps_cur_pic->i4_buf_id , BUF_MGR_CODEC);
|
||||
|
||||
error_status = ih264_buf_mgr_release(ps_codec->pv_mv_buf_mgr,
|
||||
ps_cur_mv_buf->i4_buf_id , BUF_MGR_CODEC);
|
||||
if(error_status != IH264E_SUCCESS)
|
||||
{
|
||||
return error_status;
|
||||
}
|
||||
error_status = ih264_buf_mgr_release(ps_codec->pv_ref_buf_mgr,
|
||||
ps_cur_pic->i4_buf_id , BUF_MGR_CODEC);
|
||||
if(error_status != IH264E_SUCCESS)
|
||||
{
|
||||
return error_status;
|
||||
}
|
||||
if (ps_codec->s_cfg.u4_enable_recon)
|
||||
{
|
||||
/* pic cnt */
|
||||
|
|
@ -2459,6 +2555,7 @@ WORD32 ih264e_process_thread(void *pv_proc)
|
|||
/* set affinity */
|
||||
ithread_set_affinity(ps_proc->i4_id);
|
||||
|
||||
ps_proc->i4_error_code = IH264_SUCCESS;
|
||||
while(1)
|
||||
{
|
||||
/* dequeue a job from the entropy queue */
|
||||
|
|
@ -2521,7 +2618,12 @@ WORKER:
|
|||
ih264e_init_proc_ctxt(ps_proc);
|
||||
|
||||
/* core code all mbs enlisted under the current job */
|
||||
error_status |= ih264e_process(ps_proc);
|
||||
error_status = ih264e_process(ps_proc);
|
||||
if(error_status !=IH264_SUCCESS)
|
||||
{
|
||||
ps_proc->i4_error_code = error_status;
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
|
||||
case CMD_ENTROPY:
|
||||
|
|
@ -2533,16 +2635,19 @@ WORKER:
|
|||
ih264e_init_entropy_ctxt(ps_proc);
|
||||
|
||||
/* entropy code all mbs enlisted under the current job */
|
||||
error_status |= ih264e_entropy(ps_proc);
|
||||
error_status = ih264e_entropy(ps_proc);
|
||||
if(error_status !=IH264_SUCCESS)
|
||||
{
|
||||
ps_proc->i4_error_code = error_status;
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
error_status |= IH264_FAIL;
|
||||
break;
|
||||
ps_proc->i4_error_code = IH264_FAIL;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* send error code */
|
||||
ps_proc->i4_error_code = error_status;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
447
encoder/ih264e_sei.c
Normal file
447
encoder/ih264e_sei.c
Normal file
|
|
@ -0,0 +1,447 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*****************************************************************************
|
||||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file
|
||||
* ih264e_sei.c
|
||||
*
|
||||
* @brief
|
||||
* This file contains function definitions related to SEI NAL's header encoding
|
||||
*
|
||||
* @author
|
||||
* ittiam
|
||||
*
|
||||
* @par List of Functions:
|
||||
* - ih264e_put_sei_mdcv_params
|
||||
* - ih264e_put_sei_cll_params
|
||||
* - ih264e_put_sei_ave_params
|
||||
* - ih264e_put_sei_ccv_params
|
||||
* - ih264e_put_sei_msg
|
||||
*
|
||||
* @remarks
|
||||
* None
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/* File Includes */
|
||||
/*****************************************************************************/
|
||||
|
||||
/* System include files */
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
/* User include files */
|
||||
#include "ih264_typedefs.h"
|
||||
#include "iv2.h"
|
||||
#include "ive2.h"
|
||||
#include "ih264_macros.h"
|
||||
#include "ih264_platform_macros.h"
|
||||
#include "ih264e_trace.h"
|
||||
#include "ih264e_error.h"
|
||||
#include "ih264e_bitstream.h"
|
||||
#include "ih264_defs.h"
|
||||
#include "ih264_structs.h"
|
||||
#include "ih264_cabac_tables.h"
|
||||
#include "ih264e_cabac_structs.h"
|
||||
#include "irc_cntrl_param.h"
|
||||
#include "ime_distortion_metrics.h"
|
||||
#include "ime_defs.h"
|
||||
#include "ime_structs.h"
|
||||
#include "ih264e_defs.h"
|
||||
#include "irc_cntrl_param.h"
|
||||
#include "irc_frame_info_collector.h"
|
||||
#include "ih264_trans_quant_itrans_iquant.h"
|
||||
#include "ih264_inter_pred_filters.h"
|
||||
#include "ih264_deblk_edge_filters.h"
|
||||
#include "ih264e_structs.h"
|
||||
#include "ih264e_encode_header.h"
|
||||
#include "ih264e_sei.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Function Definitions */
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @brief Generates Mastering Display Color Volume (Supplemental Enhancement Information )
|
||||
*
|
||||
* @par Description
|
||||
* Parse Supplemental Enhancement Information
|
||||
*
|
||||
* @param[in] ps_bitstrm
|
||||
* pointer to bitstream context (handle)
|
||||
*
|
||||
* @param[in] ps_sei_mdcv
|
||||
* pointer to structure containing mdcv SEI data
|
||||
*
|
||||
* @return success or failure error code
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
IH264E_ERROR_T ih264e_put_sei_mdcv_params(sei_mdcv_params_t *ps_sei_mdcv,
|
||||
bitstrm_t *ps_bitstrm)
|
||||
{
|
||||
WORD32 return_status = IH264E_SUCCESS;
|
||||
UWORD8 u1_payload_size = 0;
|
||||
UWORD32 u4_count;
|
||||
|
||||
if(ps_sei_mdcv == NULL)
|
||||
{
|
||||
return IH264E_FAIL;
|
||||
}
|
||||
|
||||
u1_payload_size += (NUM_SEI_MDCV_PRIMARIES * 2); /* display primaries x */
|
||||
u1_payload_size += (NUM_SEI_MDCV_PRIMARIES * 2); /* display primaries y */
|
||||
u1_payload_size += 2; /* white point x */
|
||||
u1_payload_size += 2; /* white point y */
|
||||
u1_payload_size += 4; /* max display mastering luminance */
|
||||
u1_payload_size += 4; /* min display mastering luminance */
|
||||
|
||||
/************************************************************************/
|
||||
/* PayloadSize : This is the size of the payload in bytes */
|
||||
/************************************************************************/
|
||||
PUT_BITS(ps_bitstrm, u1_payload_size, 8, return_status, "u1_payload_size");
|
||||
|
||||
/*******************************************************************************/
|
||||
/* Put the mastering display color volume SEI parameters into the bitstream. */
|
||||
/*******************************************************************************/
|
||||
|
||||
/* display primaries x */
|
||||
for(u4_count = 0; u4_count < NUM_SEI_MDCV_PRIMARIES; u4_count++)
|
||||
{
|
||||
PUT_BITS(ps_bitstrm, ps_sei_mdcv->au2_display_primaries_x[u4_count], 16,
|
||||
return_status, "u2_display_primaries_x");
|
||||
|
||||
PUT_BITS(ps_bitstrm, ps_sei_mdcv->au2_display_primaries_y[u4_count], 16,
|
||||
return_status, "u2_display_primaries_y");
|
||||
}
|
||||
|
||||
/* white point x */
|
||||
PUT_BITS(ps_bitstrm, ps_sei_mdcv->u2_white_point_x, 16, return_status, "u2_white point x");
|
||||
|
||||
/* white point y */
|
||||
PUT_BITS(ps_bitstrm, ps_sei_mdcv->u2_white_point_y, 16, return_status, "u2_white point y");
|
||||
|
||||
/* max display mastering luminance */
|
||||
PUT_BITS(ps_bitstrm, ps_sei_mdcv->u4_max_display_mastering_luminance, 32,
|
||||
return_status, "u4_max_display_mastering_luminance");
|
||||
|
||||
/* min display mastering luminance */
|
||||
PUT_BITS(ps_bitstrm, ps_sei_mdcv->u4_min_display_mastering_luminance, 32,
|
||||
return_status, "u4_max_display_mastering_luminance");
|
||||
|
||||
return (return_status);
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @brief Stores content light level info in bitstream
|
||||
*
|
||||
* @par Description
|
||||
* Parse Supplemental Enhancement Information
|
||||
*
|
||||
* @param[in] ps_bitstrm
|
||||
* pointer to bitstream context (handle)
|
||||
*
|
||||
* @param[in] ps_sei_cll
|
||||
* Pinter to structure containing cll sei params
|
||||
*
|
||||
* @return success or failure error code
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
IH264E_ERROR_T ih264e_put_sei_cll_params(sei_cll_params_t *ps_sei_cll,
|
||||
bitstrm_t *ps_bitstrm)
|
||||
{
|
||||
WORD32 return_status = IH264E_SUCCESS;
|
||||
UWORD8 u1_payload_size = 0;
|
||||
|
||||
if(ps_sei_cll == NULL)
|
||||
{
|
||||
return IH264E_FAIL;
|
||||
}
|
||||
|
||||
u1_payload_size += 2; /* max pic average light level */
|
||||
u1_payload_size += 2; /* max content light level */
|
||||
|
||||
/************************************************************************/
|
||||
/* PayloadSize : This is the size of the payload in bytes */
|
||||
/************************************************************************/
|
||||
PUT_BITS(ps_bitstrm, u1_payload_size, 8, return_status, "u1_payload_size");
|
||||
|
||||
PUT_BITS(ps_bitstrm, ps_sei_cll->u2_max_content_light_level, 16,
|
||||
return_status, "u2_max_content_light_level");
|
||||
PUT_BITS(ps_bitstrm, ps_sei_cll->u2_max_pic_average_light_level, 16,
|
||||
return_status, "u2_max_pic_average_light_level");
|
||||
|
||||
return (return_status);
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @brief Stores ambient viewing environment info in bitstream
|
||||
*
|
||||
* @par Description
|
||||
* Parse Supplemental Enhancement Information
|
||||
*
|
||||
* @param[in] ps_bitstrm
|
||||
* pointer to bitstream context (handle)
|
||||
*
|
||||
* @param[in] ps_sei_ave
|
||||
* pointer to ambient viewing environment info
|
||||
*
|
||||
* @return success or failure error code
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
IH264E_ERROR_T ih264e_put_sei_ave_params(sei_ave_params_t *ps_sei_ave,
|
||||
bitstrm_t *ps_bitstrm)
|
||||
{
|
||||
WORD32 return_status = IH264E_SUCCESS;
|
||||
UWORD8 u1_payload_size = 0;
|
||||
|
||||
if(ps_sei_ave == NULL)
|
||||
{
|
||||
return IH264E_FAIL;
|
||||
}
|
||||
|
||||
u1_payload_size += 4; /* ambient illuminance */
|
||||
u1_payload_size += 2; /* ambient light x */
|
||||
u1_payload_size += 2; /* ambient light y */
|
||||
|
||||
/************************************************************************/
|
||||
/* PayloadSize : This is the size of the payload in bytes */
|
||||
/************************************************************************/
|
||||
PUT_BITS(ps_bitstrm, u1_payload_size, 8, return_status, "u1_payload_size");
|
||||
|
||||
PUT_BITS(ps_bitstrm, ps_sei_ave->u4_ambient_illuminance, 32,
|
||||
return_status, "u4_ambient_illuminance");
|
||||
PUT_BITS(ps_bitstrm, ps_sei_ave->u2_ambient_light_x, 16,
|
||||
return_status, "u2_ambient_light_x");
|
||||
PUT_BITS(ps_bitstrm, ps_sei_ave->u2_ambient_light_y, 16,
|
||||
return_status, "u2_ambient_light_y");
|
||||
|
||||
return (return_status);
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @brief Generates Content Color Volume info (Supplemental Enhancement Information )
|
||||
*
|
||||
* @par Description
|
||||
* Parse Supplemental Enhancement Information
|
||||
*
|
||||
* @param[in] ps_bitstrm
|
||||
* pointer to bitstream context (handle)
|
||||
*
|
||||
* @param[in] ps_sei_ccv
|
||||
* pointer to structure containing CCV SEI data
|
||||
*
|
||||
* @return success or failure error code
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
IH264E_ERROR_T ih264e_put_sei_ccv_params(sei_ccv_params_t *ps_sei_ccv,
|
||||
bitstrm_t *ps_bitstrm)
|
||||
{
|
||||
WORD32 return_status = IH264E_SUCCESS;
|
||||
UWORD16 u2_payload_bits = 0;
|
||||
UWORD8 u1_payload_bytes = 0;
|
||||
UWORD32 u4_count;
|
||||
|
||||
if(ps_sei_ccv == NULL)
|
||||
{
|
||||
return IH264E_FAIL;
|
||||
}
|
||||
|
||||
u2_payload_bits += 1; /* ccv cancel flag */
|
||||
if(0 == (UWORD32)ps_sei_ccv->u1_ccv_cancel_flag)
|
||||
{
|
||||
u2_payload_bits += 1; /* ccv persistence flag */
|
||||
u2_payload_bits += 1; /* ccv primaries present flag */
|
||||
u2_payload_bits += 1; /* ccv min luminance value present flag */
|
||||
u2_payload_bits += 1; /* ccv max luminance value present flag */
|
||||
u2_payload_bits += 1; /* ccv avg luminance value present flag */
|
||||
u2_payload_bits += 2; /* ccv reserved zero 2bits */
|
||||
if(1 == ps_sei_ccv->u1_ccv_primaries_present_flag)
|
||||
{
|
||||
u2_payload_bits += (NUM_SEI_CCV_PRIMARIES * 32); /* ccv primaries x[ c ] */
|
||||
u2_payload_bits += (NUM_SEI_CCV_PRIMARIES * 32); /* ccv primaries y[ c ] */
|
||||
}
|
||||
if(1 == ps_sei_ccv->u1_ccv_min_luminance_value_present_flag)
|
||||
{
|
||||
u2_payload_bits += 32; /* ccv min luminance value */
|
||||
}
|
||||
if(1 == ps_sei_ccv->u1_ccv_max_luminance_value_present_flag)
|
||||
{
|
||||
u2_payload_bits += 32; /* ccv max luminance value */
|
||||
}
|
||||
if(1 == ps_sei_ccv->u1_ccv_avg_luminance_value_present_flag)
|
||||
{
|
||||
u2_payload_bits += 32; /* ccv avg luminance value */
|
||||
}
|
||||
}
|
||||
|
||||
u1_payload_bytes = (UWORD8)((u2_payload_bits + 7) >> 3);
|
||||
/************************************************************************/
|
||||
/* PayloadSize : This is the size of the payload in bytes */
|
||||
/************************************************************************/
|
||||
PUT_BITS(ps_bitstrm, u1_payload_bytes, 8, return_status, "u1_payload_bytes");
|
||||
|
||||
/*******************************************************************************/
|
||||
/* Put the Content Color Volume SEI parameters into the bitstream. */
|
||||
/*******************************************************************************/
|
||||
|
||||
PUT_BITS(ps_bitstrm, ps_sei_ccv->u1_ccv_cancel_flag, 1,
|
||||
return_status, "u1_ccv_cancel_flag");
|
||||
|
||||
if(0 == ps_sei_ccv->u1_ccv_cancel_flag)
|
||||
{
|
||||
PUT_BITS(ps_bitstrm, ps_sei_ccv->u1_ccv_persistence_flag, 1,
|
||||
return_status, "u1_ccv_persistence_flag");
|
||||
PUT_BITS(ps_bitstrm, ps_sei_ccv->u1_ccv_primaries_present_flag, 1,
|
||||
return_status, "u1_ccv_primaries_present_flag");
|
||||
PUT_BITS(ps_bitstrm, ps_sei_ccv->u1_ccv_min_luminance_value_present_flag, 1,
|
||||
return_status, "u1_ccv_min_luminance_value_present_flag");
|
||||
PUT_BITS(ps_bitstrm, ps_sei_ccv->u1_ccv_max_luminance_value_present_flag, 1,
|
||||
return_status, "u1_ccv_max_luminance_value_present_flag");
|
||||
PUT_BITS(ps_bitstrm, ps_sei_ccv->u1_ccv_avg_luminance_value_present_flag, 1,
|
||||
return_status, "u1_ccv_avg_luminance_value_present_flag");
|
||||
PUT_BITS(ps_bitstrm, ps_sei_ccv->u1_ccv_reserved_zero_2bits, 2,
|
||||
return_status, "u1_ccv_reserved_zero_2bits");
|
||||
|
||||
/* ccv primaries */
|
||||
if(1 == ps_sei_ccv->u1_ccv_primaries_present_flag)
|
||||
{
|
||||
for(u4_count = 0; u4_count < NUM_SEI_CCV_PRIMARIES; u4_count++)
|
||||
{
|
||||
PUT_BITS(ps_bitstrm, ps_sei_ccv->ai4_ccv_primaries_x[u4_count], 32,
|
||||
return_status, "i4_ccv_primaries_x");
|
||||
PUT_BITS(ps_bitstrm, ps_sei_ccv->ai4_ccv_primaries_y[u4_count], 32,
|
||||
return_status, "i4_ccv_primaries_y");
|
||||
}
|
||||
}
|
||||
|
||||
if(1 == ps_sei_ccv->u1_ccv_min_luminance_value_present_flag)
|
||||
{
|
||||
PUT_BITS(ps_bitstrm, ps_sei_ccv->u4_ccv_min_luminance_value, 32,
|
||||
return_status, "u4_ccv_min_luminance_value");
|
||||
}
|
||||
if(1 == ps_sei_ccv->u1_ccv_max_luminance_value_present_flag)
|
||||
{
|
||||
PUT_BITS(ps_bitstrm, ps_sei_ccv->u4_ccv_max_luminance_value, 32,
|
||||
return_status, "u4_ccv_max_luminance_value");
|
||||
}
|
||||
if(1 == ps_sei_ccv->u1_ccv_avg_luminance_value_present_flag)
|
||||
{
|
||||
PUT_BITS(ps_bitstrm, ps_sei_ccv->u4_ccv_avg_luminance_value, 32,
|
||||
return_status, "u4_ccv_avg_luminance_value");
|
||||
}
|
||||
}
|
||||
|
||||
return (return_status);
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @brief Generates SEI (Supplemental Enhancement Information )
|
||||
*
|
||||
* @par Description
|
||||
* Parse Supplemental Enhancement Information
|
||||
*
|
||||
* @param[in] e_payload_type
|
||||
* Determines the type of SEI msg
|
||||
*
|
||||
* @param[in] ps_bitstrm
|
||||
* pointer to bitstream context (handle)
|
||||
*
|
||||
* @param[in] ps_sei_params
|
||||
* pointer to structure containing SEI data
|
||||
* buffer period, recovery point, picture timing
|
||||
*
|
||||
* @return success or failure error code
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
IH264E_ERROR_T ih264e_put_sei_msg(IH264_SEI_TYPE e_payload_type,
|
||||
sei_params_t *ps_sei_params,
|
||||
bitstrm_t *ps_bitstrm)
|
||||
{
|
||||
WORD32 return_status = IH264E_SUCCESS;
|
||||
|
||||
/************************************************************************/
|
||||
/* PayloadType : Send in the SEI type in the stream */
|
||||
/************************************************************************/
|
||||
|
||||
UWORD32 u4_payload_type = e_payload_type;
|
||||
|
||||
while(u4_payload_type > 0xFF)
|
||||
{
|
||||
PUT_BITS(ps_bitstrm, 0xFF, 8, return_status, "payload");
|
||||
u4_payload_type -= 0xFF;
|
||||
}
|
||||
|
||||
PUT_BITS(ps_bitstrm, (UWORD32)u4_payload_type, 8, return_status, "e_payload_type");
|
||||
|
||||
switch(e_payload_type)
|
||||
{
|
||||
case IH264_SEI_MASTERING_DISP_COL_VOL :
|
||||
return_status = ih264e_put_sei_mdcv_params(&(ps_sei_params->s_sei_mdcv_params),
|
||||
ps_bitstrm);
|
||||
break;
|
||||
|
||||
case IH264_SEI_CONTENT_LIGHT_LEVEL_DATA :
|
||||
return_status = ih264e_put_sei_cll_params(&(ps_sei_params->s_sei_cll_params),
|
||||
ps_bitstrm);
|
||||
break;
|
||||
|
||||
case IH264_SEI_AMBIENT_VIEWING_ENVIRONMENT :
|
||||
return_status = ih264e_put_sei_ave_params(&(ps_sei_params->s_sei_ave_params),
|
||||
ps_bitstrm);
|
||||
break;
|
||||
|
||||
case IH264_SEI_CONTENT_COLOR_VOLUME :
|
||||
return_status = ih264e_put_sei_ccv_params(&(ps_sei_params->s_sei_ccv_params),
|
||||
ps_bitstrm);
|
||||
break;
|
||||
|
||||
default :
|
||||
return_status = IH264E_FAIL;
|
||||
}
|
||||
|
||||
/* rbsp trailing bits */
|
||||
if((IH264E_SUCCESS == return_status) && (ps_bitstrm->i4_bits_left_in_cw & 0x7))
|
||||
return_status = ih264e_put_rbsp_trailing_bits(ps_bitstrm);
|
||||
|
||||
return(return_status);
|
||||
}
|
||||
|
||||
|
||||
170
encoder/ih264e_sei.h
Normal file
170
encoder/ih264e_sei.h
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*****************************************************************************
|
||||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file
|
||||
* ih264e_sei.h
|
||||
*
|
||||
* @brief
|
||||
* This file contains function declarations for sei message encoding
|
||||
*
|
||||
* @author
|
||||
*
|
||||
*
|
||||
* @remarks
|
||||
* None
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef ENCODER_IH264E_SEI_H_
|
||||
#define ENCODER_IH264E_SEI_H_
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* INTERFACE STRUCTURE DEFINITIONS */
|
||||
/*****************************************************************************/
|
||||
typedef enum
|
||||
{
|
||||
/* SEI PREFIX */
|
||||
|
||||
IH264_SEI_MASTERING_DISP_COL_VOL = 137,
|
||||
IH264_SEI_CONTENT_LIGHT_LEVEL_DATA = 144,
|
||||
IH264_SEI_AMBIENT_VIEWING_ENVIRONMENT = 148,
|
||||
IH264_SEI_CONTENT_COLOR_VOLUME = 149
|
||||
|
||||
}IH264_SEI_TYPE;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Function Declarations */
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @brief Generates Mastering Display Color Volume (Supplemental Enhancement Information )
|
||||
*
|
||||
* @par Description
|
||||
* Parse Supplemental Enhancement Information
|
||||
*
|
||||
* @param[in] ps_sei_mdcl
|
||||
* pointer to structure containing mdcv SEI data
|
||||
*
|
||||
* @param[in] ps_bitstrm
|
||||
* pointer to bitstream context (handle)
|
||||
*
|
||||
* @return success or failure error code
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
IH264E_ERROR_T ih264e_put_sei_mdcv_params(sei_mdcv_params_t *ps_sei_mdcv,
|
||||
bitstrm_t *ps_bitstrm);
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @brief Stores content light level info in bitstream
|
||||
*
|
||||
* @par Description
|
||||
* Parse Supplemental Enhancement Information
|
||||
*
|
||||
* @param[in] ps_sei_cll
|
||||
* pointer to structure containing cll sei data
|
||||
*
|
||||
* @param[in] ps_bitstrm
|
||||
* pointer to bitstream context (handle)
|
||||
*
|
||||
* @return success or failure error code
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
IH264E_ERROR_T ih264e_put_sei_cll_params(sei_cll_params_t *ps_sei_cll,
|
||||
bitstrm_t *ps_bitstrm);
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @brief Stores ambient viewing environment info in bitstream
|
||||
*
|
||||
* @par Description
|
||||
* Parse Supplemental Enhancement Information
|
||||
*
|
||||
* @param[in] ps_bitstrm
|
||||
* pointer to bitstream context (handle)
|
||||
*
|
||||
* @param[in] ps_sei_ave
|
||||
* pointer to ambient viewing environment info
|
||||
*
|
||||
* @return success or failure error code
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
IH264E_ERROR_T ih264e_put_sei_ave_params(sei_ave_params_t *ps_sei_ave,
|
||||
bitstrm_t *ps_bitstrm);
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @brief Generates Content Color Volume info (Supplemental Enhancement Information )
|
||||
*
|
||||
* @par Description
|
||||
* Parse Supplemental Enhancement Information
|
||||
*
|
||||
* @param[in] ps_bitstrm
|
||||
* pointer to bitstream context (handle)
|
||||
*
|
||||
* @param[in] ps_sei_ccv
|
||||
* pointer to structure containing ccv SEI data
|
||||
*
|
||||
* @return success or failure error code
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
IH264E_ERROR_T ih264e_put_sei_ccv_params(sei_ccv_params_t *ps_sei_ccv,
|
||||
bitstrm_t *ps_bitstrm);
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @brief Generates SEI (Supplemental Enhancement Information )
|
||||
*
|
||||
* @par Description
|
||||
* Parse Supplemental Enhancement Information
|
||||
*
|
||||
* @param[in] e_payload_type
|
||||
* Determines the type of SEI msg
|
||||
*
|
||||
* @param[in] ps_bitstrm
|
||||
* pointer to bitstream context (handle)
|
||||
*
|
||||
* @param[in] ps_sei
|
||||
* pointer to structure containing SEI data
|
||||
*
|
||||
* @return success or failure error code
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
IH264E_ERROR_T ih264e_put_sei_msg(IH264_SEI_TYPE e_payload_type,
|
||||
sei_params_t *ps_sei_params,
|
||||
bitstrm_t *ps_bitstrm);
|
||||
|
||||
|
||||
#endif /* ENCODER_IH264E_SEI_H_ */
|
||||
|
|
@ -306,6 +306,12 @@ typedef struct
|
|||
/** Buffer containing pic info if mb_info_type is non-zero */
|
||||
void *pv_pic_info;
|
||||
|
||||
/** SEI CCV params flag */
|
||||
UWORD8 u1_sei_ccv_params_present_flag;
|
||||
|
||||
/** SEI CCV params info */
|
||||
sei_ccv_params_t s_sei_ccv;
|
||||
|
||||
}inp_buf_t;
|
||||
|
||||
typedef struct
|
||||
|
|
@ -566,6 +572,9 @@ typedef struct
|
|||
/** VUI structure */
|
||||
vui_t s_vui;
|
||||
|
||||
/** SEI structure */
|
||||
sei_params_t s_sei;
|
||||
|
||||
}cfg_params_t;
|
||||
|
||||
|
||||
|
|
@ -2768,13 +2777,13 @@ struct _codec_t
|
|||
pf_sixtap_filter_2dvh_vert pf_ih264e_sixtap_filter_2dvh_vert;
|
||||
|
||||
/**
|
||||
* color space conversion form YUV 420P to YUV 420Sp
|
||||
* color space conversion from YUV 420P to YUV 420Sp
|
||||
*/
|
||||
pf_fmt_conv_420p_to_420sp pf_ih264e_conv_420p_to_420sp;
|
||||
|
||||
|
||||
/**
|
||||
* color space conversion form YUV 420P to YUV 420Sp
|
||||
* color space conversion from YUV 420P to YUV 420Sp
|
||||
*/
|
||||
pf_fmt_conv_422ile_to_420sp pf_ih264e_fmt_conv_422i_to_420sp;
|
||||
|
||||
|
|
@ -2808,11 +2817,16 @@ struct _codec_t
|
|||
*/
|
||||
WORD32 i4_pending_idr_flag;
|
||||
|
||||
/*
|
||||
/**
|
||||
*Flag to indicate if we have recived the last input frame
|
||||
*/
|
||||
WORD32 i4_last_inp_buff_received;
|
||||
|
||||
/**
|
||||
* backup sei params for comparison
|
||||
*/
|
||||
sei_params_t s_sei;
|
||||
|
||||
};
|
||||
|
||||
#endif /* IH264E_STRUCTS_H_ */
|
||||
|
|
|
|||
|
|
@ -247,6 +247,10 @@ WORD32 ih264e_input_queue_update(codec_t *ps_codec,
|
|||
ps_inp_buf->pv_pic_info = ps_ive_ip->pv_pic_info;
|
||||
ps_inp_buf->u4_pic_info_type = ps_ive_ip->u4_pic_info_type;
|
||||
|
||||
ps_inp_buf->u1_sei_ccv_params_present_flag =
|
||||
ps_codec->s_cfg.s_sei.u1_sei_ccv_params_present_flag;
|
||||
ps_inp_buf->s_sei_ccv = ps_codec->s_cfg.s_sei.s_sei_ccv_params;
|
||||
|
||||
/***************************************************************************
|
||||
* Now we should add the picture to RC stack here
|
||||
**************************************************************************/
|
||||
|
|
@ -354,6 +358,9 @@ WORD32 ih264e_input_queue_update(codec_t *ps_codec,
|
|||
ps_enc_buff->pv_pic_info = ps_inp_buf->pv_pic_info;
|
||||
ps_enc_buff->u4_pic_info_type = ps_inp_buf->u4_pic_info_type;
|
||||
|
||||
ps_enc_buff->u1_sei_ccv_params_present_flag = ps_inp_buf->u1_sei_ccv_params_present_flag;
|
||||
ps_enc_buff->s_sei_ccv = ps_inp_buf->s_sei_ccv;
|
||||
|
||||
/* Special case for encoding trailing B frames
|
||||
*
|
||||
* In encoding streams with B frames it may happen that we have a B frame
|
||||
|
|
|
|||
|
|
@ -145,6 +145,10 @@ typedef enum
|
|||
IVE_CMD_CTL_FLUSH = 0xB0,
|
||||
IVE_CMD_CTL_GETBUFINFO = 0xC0,
|
||||
IVE_CMD_CTL_GETVERSION = 0xC1,
|
||||
IVE_CMD_CTL_SET_SEI_MDCV_PARAMS = 0xD0,
|
||||
IVE_CMD_CTL_SET_SEI_CLL_PARAMS = 0xD1,
|
||||
IVE_CMD_CTL_SET_SEI_AVE_PARAMS = 0xD2,
|
||||
IVE_CMD_CTL_SET_SEI_CCV_PARAMS = 0xD3,
|
||||
IVE_CMD_CTL_CODEC_SUBCMD_START = 0x100,
|
||||
}IVE_CONTROL_API_COMMAND_TYPE_T;
|
||||
|
||||
|
|
@ -238,6 +242,14 @@ typedef enum
|
|||
IVE_ERR_OP_CTL_SETPROFILE_API_STRUCT_SIZE_INCORRECT = 0x3F,
|
||||
IVE_ERR_IP_CTL_SET_VUI_STRUCT_SIZE_INCORRECT = 0x40,
|
||||
IVE_ERR_OP_CTL_SET_VUI_STRUCT_SIZE_INCORRECT = 0x41,
|
||||
IVE_ERR_IP_CTL_SET_SEI_MDCV_STRUCT_SIZE_INCORRECT = 0x42,
|
||||
IVE_ERR_OP_CTL_SET_SEI_MDCV_STRUCT_SIZE_INCORRECT = 0x43,
|
||||
IVE_ERR_IP_CTL_SET_SEI_CLL_STRUCT_SIZE_INCORRECT = 0x44,
|
||||
IVE_ERR_OP_CTL_SET_SEI_CLL_STRUCT_SIZE_INCORRECT = 0x45,
|
||||
IVE_ERR_IP_CTL_SET_SEI_AVE_STRUCT_SIZE_INCORRECT = 0x46,
|
||||
IVE_ERR_OP_CTL_SET_SEI_AVE_STRUCT_SIZE_INCORRECT = 0x47,
|
||||
IVE_ERR_IP_CTL_SET_SEI_CCV_STRUCT_SIZE_INCORRECT = 0x48,
|
||||
IVE_ERR_OP_CTL_SET_SEI_CCV_STRUCT_SIZE_INCORRECT = 0x49,
|
||||
}IVE_ERROR_CODES_T;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1697,6 +1697,132 @@ void flush_output(iv_obj_t *codec_obj,
|
|||
* dumping all the frames in one common file. Also, the number of dumped frames
|
||||
* at any given instance of time cannot exceed 'frame_memory'
|
||||
*/
|
||||
|
||||
/*************************************************************************/
|
||||
/* Get SEI MDCV parameters */
|
||||
/*************************************************************************/
|
||||
if(1 == s_video_decode_op.s_sei_decode_op.u1_sei_mdcv_params_present_flag)
|
||||
{
|
||||
ih264d_ctl_get_sei_mdcv_params_ip_t s_ctl_get_sei_mdcv_params_ip;
|
||||
ih264d_ctl_get_sei_mdcv_params_op_t s_ctl_get_sei_mdcv_params_op;
|
||||
|
||||
memset(&s_ctl_get_sei_mdcv_params_ip, 0,
|
||||
sizeof(ih264d_ctl_get_sei_mdcv_params_ip_t));
|
||||
memset(&s_ctl_get_sei_mdcv_params_op, 0,
|
||||
sizeof(ih264d_ctl_get_sei_mdcv_params_op_t));
|
||||
|
||||
s_ctl_get_sei_mdcv_params_ip.e_cmd = IVD_CMD_VIDEO_CTL;
|
||||
s_ctl_get_sei_mdcv_params_ip.e_sub_cmd =
|
||||
(IVD_CONTROL_API_COMMAND_TYPE_T)IH264D_CMD_CTL_GET_SEI_MDCV_PARAMS;
|
||||
s_ctl_get_sei_mdcv_params_ip.u4_size =
|
||||
sizeof(ih264d_ctl_get_sei_mdcv_params_ip_t);
|
||||
s_ctl_get_sei_mdcv_params_op.u4_size =
|
||||
sizeof(ih264d_ctl_get_sei_mdcv_params_op_t);
|
||||
|
||||
ret = ivd_api_function((iv_obj_t *)codec_obj,
|
||||
(void *)&s_ctl_get_sei_mdcv_params_ip,
|
||||
(void *)&s_ctl_get_sei_mdcv_params_op);
|
||||
|
||||
if(IV_SUCCESS != ret)
|
||||
{
|
||||
printf("MDCV SEI params not present : Error %x\n",
|
||||
s_ctl_get_sei_mdcv_params_op.u4_error_code);
|
||||
}
|
||||
}
|
||||
/*************************************************************************/
|
||||
/* Get SEI CLL parameters */
|
||||
/*************************************************************************/
|
||||
if(1 == s_video_decode_op.s_sei_decode_op.u1_sei_cll_params_present_flag)
|
||||
{
|
||||
ih264d_ctl_get_sei_cll_params_ip_t s_ctl_get_sei_cll_params_ip;
|
||||
ih264d_ctl_get_sei_cll_params_op_t s_ctl_get_sei_cll_params_op;
|
||||
|
||||
memset(&s_ctl_get_sei_cll_params_ip, 0,
|
||||
sizeof(ih264d_ctl_get_sei_cll_params_ip_t));
|
||||
memset(&s_ctl_get_sei_cll_params_op, 0,
|
||||
sizeof(ih264d_ctl_get_sei_cll_params_op_t));
|
||||
|
||||
s_ctl_get_sei_cll_params_ip.e_cmd = IVD_CMD_VIDEO_CTL;
|
||||
s_ctl_get_sei_cll_params_ip.e_sub_cmd =
|
||||
(IVD_CONTROL_API_COMMAND_TYPE_T)IH264D_CMD_CTL_GET_SEI_CLL_PARAMS;
|
||||
s_ctl_get_sei_cll_params_ip.u4_size =
|
||||
sizeof(ih264d_ctl_get_sei_cll_params_ip_t);
|
||||
s_ctl_get_sei_cll_params_op.u4_size =
|
||||
sizeof(ih264d_ctl_get_sei_cll_params_op_t);
|
||||
|
||||
ret = ivd_api_function((iv_obj_t *)codec_obj,
|
||||
(void *)&s_ctl_get_sei_cll_params_ip,
|
||||
(void *)&s_ctl_get_sei_cll_params_op);
|
||||
|
||||
if(IV_SUCCESS != ret)
|
||||
{
|
||||
printf("CLL SEI params not present : Error %x\n",
|
||||
s_ctl_get_sei_cll_params_op.u4_error_code);
|
||||
}
|
||||
}
|
||||
/*************************************************************************/
|
||||
/* Get SEI AVE parameters */
|
||||
/*************************************************************************/
|
||||
if(1 == s_video_decode_op.s_sei_decode_op.u1_sei_ave_params_present_flag)
|
||||
{
|
||||
ih264d_ctl_get_sei_ave_params_ip_t s_ctl_get_sei_ave_params_ip;
|
||||
ih264d_ctl_get_sei_ave_params_op_t s_ctl_get_sei_ave_params_op;
|
||||
|
||||
memset(&s_ctl_get_sei_ave_params_ip, 0,
|
||||
sizeof(ih264d_ctl_get_sei_ave_params_ip_t));
|
||||
memset(&s_ctl_get_sei_ave_params_op, 0,
|
||||
sizeof(ih264d_ctl_get_sei_ave_params_op_t));
|
||||
|
||||
s_ctl_get_sei_ave_params_ip.e_cmd = IVD_CMD_VIDEO_CTL;
|
||||
s_ctl_get_sei_ave_params_ip.e_sub_cmd =
|
||||
(IVD_CONTROL_API_COMMAND_TYPE_T)IH264D_CMD_CTL_GET_SEI_AVE_PARAMS;
|
||||
s_ctl_get_sei_ave_params_ip.u4_size =
|
||||
sizeof(ih264d_ctl_get_sei_ave_params_ip_t);
|
||||
s_ctl_get_sei_ave_params_op.u4_size =
|
||||
sizeof(ih264d_ctl_get_sei_ave_params_op_t);
|
||||
|
||||
ret = ivd_api_function((iv_obj_t *)codec_obj,
|
||||
(void *)&s_ctl_get_sei_ave_params_ip,
|
||||
(void *)&s_ctl_get_sei_ave_params_op);
|
||||
|
||||
if(IV_SUCCESS != ret)
|
||||
{
|
||||
printf("AVE SEI params not present : Error %x\n",
|
||||
s_ctl_get_sei_ave_params_op.u4_error_code);
|
||||
}
|
||||
}
|
||||
/*************************************************************************/
|
||||
/* Get SEI CCV parameters */
|
||||
/*************************************************************************/
|
||||
if(1 == s_video_decode_op.s_sei_decode_op.u1_sei_ccv_params_present_flag)
|
||||
{
|
||||
ih264d_ctl_get_sei_ccv_params_ip_t s_ctl_get_sei_ccv_params_ip;
|
||||
ih264d_ctl_get_sei_ccv_params_op_t s_ctl_get_sei_ccv_params_op;
|
||||
|
||||
memset(&s_ctl_get_sei_ccv_params_ip, 0,
|
||||
sizeof(ih264d_ctl_get_sei_ccv_params_ip_t));
|
||||
memset(&s_ctl_get_sei_ccv_params_op, 0,
|
||||
sizeof(ih264d_ctl_get_sei_ccv_params_op_t));
|
||||
|
||||
s_ctl_get_sei_ccv_params_ip.e_cmd = IVD_CMD_VIDEO_CTL;
|
||||
s_ctl_get_sei_ccv_params_ip.e_sub_cmd =
|
||||
(IVD_CONTROL_API_COMMAND_TYPE_T)IH264D_CMD_CTL_GET_SEI_CCV_PARAMS;
|
||||
s_ctl_get_sei_ccv_params_ip.u4_size =
|
||||
sizeof(ih264d_ctl_get_sei_ccv_params_ip_t);
|
||||
s_ctl_get_sei_ccv_params_op.u4_size =
|
||||
sizeof(ih264d_ctl_get_sei_ccv_params_op_t);
|
||||
|
||||
ret = ivd_api_function((iv_obj_t *)codec_obj,
|
||||
(void *)&s_ctl_get_sei_ccv_params_ip,
|
||||
(void *)&s_ctl_get_sei_ccv_params_op);
|
||||
|
||||
if(IV_SUCCESS != ret)
|
||||
{
|
||||
printf("CCV SEI params not present : Error %x\n",
|
||||
s_ctl_get_sei_ccv_params_op.u4_error_code);
|
||||
}
|
||||
}
|
||||
|
||||
if(ps_app_ctx->u4_file_save_flag)
|
||||
{
|
||||
/* Locate the position of extension yuv */
|
||||
|
|
@ -1900,6 +2026,7 @@ int main(WORD32 argc, CHAR *argv[])
|
|||
s_app_ctx.quit = 0;
|
||||
s_app_ctx.paused = 0;
|
||||
//s_app_ctx.u4_output_present = 0;
|
||||
s_app_ctx.u4_chksum_save_flag = 0;
|
||||
|
||||
s_app_ctx.get_stride = &default_get_stride;
|
||||
|
||||
|
|
@ -2999,6 +3126,131 @@ int main(WORD32 argc, CHAR *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/* Get SEI MDCV parameters */
|
||||
/*************************************************************************/
|
||||
if(1 == s_video_decode_op.s_sei_decode_op.u1_sei_mdcv_params_present_flag)
|
||||
{
|
||||
ih264d_ctl_get_sei_mdcv_params_ip_t s_ctl_get_sei_mdcv_params_ip;
|
||||
ih264d_ctl_get_sei_mdcv_params_op_t s_ctl_get_sei_mdcv_params_op;
|
||||
|
||||
memset(&s_ctl_get_sei_mdcv_params_ip, 0,
|
||||
sizeof(ih264d_ctl_get_sei_mdcv_params_ip_t));
|
||||
memset(&s_ctl_get_sei_mdcv_params_op, 0,
|
||||
sizeof(ih264d_ctl_get_sei_mdcv_params_op_t));
|
||||
|
||||
s_ctl_get_sei_mdcv_params_ip.e_cmd = IVD_CMD_VIDEO_CTL;
|
||||
s_ctl_get_sei_mdcv_params_ip.e_sub_cmd =
|
||||
(IVD_CONTROL_API_COMMAND_TYPE_T)IH264D_CMD_CTL_GET_SEI_MDCV_PARAMS;
|
||||
s_ctl_get_sei_mdcv_params_ip.u4_size =
|
||||
sizeof(ih264d_ctl_get_sei_mdcv_params_ip_t);
|
||||
s_ctl_get_sei_mdcv_params_op.u4_size =
|
||||
sizeof(ih264d_ctl_get_sei_mdcv_params_op_t);
|
||||
|
||||
ret = ivd_api_function((iv_obj_t *)codec_obj,
|
||||
(void *)&s_ctl_get_sei_mdcv_params_ip,
|
||||
(void *)&s_ctl_get_sei_mdcv_params_op);
|
||||
|
||||
if(IV_SUCCESS != ret)
|
||||
{
|
||||
printf("MDCV SEI params not present : Error %x\n",
|
||||
s_ctl_get_sei_mdcv_params_op.u4_error_code);
|
||||
}
|
||||
}
|
||||
/*************************************************************************/
|
||||
/* Get SEI CLL parameters */
|
||||
/*************************************************************************/
|
||||
if(1 == s_video_decode_op.s_sei_decode_op.u1_sei_cll_params_present_flag)
|
||||
{
|
||||
|
||||
ih264d_ctl_get_sei_cll_params_ip_t s_ctl_get_sei_cll_params_ip;
|
||||
ih264d_ctl_get_sei_cll_params_op_t s_ctl_get_sei_cll_params_op;
|
||||
|
||||
memset(&s_ctl_get_sei_cll_params_ip, 0,
|
||||
sizeof(ih264d_ctl_get_sei_cll_params_ip_t));
|
||||
memset(&s_ctl_get_sei_cll_params_op, 0,
|
||||
sizeof(ih264d_ctl_get_sei_cll_params_op_t));
|
||||
|
||||
s_ctl_get_sei_cll_params_ip.e_cmd = IVD_CMD_VIDEO_CTL;
|
||||
s_ctl_get_sei_cll_params_ip.e_sub_cmd =
|
||||
(IVD_CONTROL_API_COMMAND_TYPE_T)IH264D_CMD_CTL_GET_SEI_CLL_PARAMS;
|
||||
s_ctl_get_sei_cll_params_ip.u4_size =
|
||||
sizeof(ih264d_ctl_get_sei_cll_params_ip_t);
|
||||
s_ctl_get_sei_cll_params_op.u4_size =
|
||||
sizeof(ih264d_ctl_get_sei_cll_params_op_t);
|
||||
|
||||
ret = ivd_api_function((iv_obj_t *)codec_obj,
|
||||
(void *)&s_ctl_get_sei_cll_params_ip,
|
||||
(void *)&s_ctl_get_sei_cll_params_op);
|
||||
|
||||
if(IV_SUCCESS != ret)
|
||||
{
|
||||
printf("CLL SEI params not present : Error %x\n",
|
||||
s_ctl_get_sei_cll_params_op.u4_error_code);
|
||||
}
|
||||
}
|
||||
/*************************************************************************/
|
||||
/* Get SEI AVE parameters */
|
||||
/*************************************************************************/
|
||||
if(1 == s_video_decode_op.s_sei_decode_op.u1_sei_ave_params_present_flag)
|
||||
{
|
||||
ih264d_ctl_get_sei_ave_params_ip_t s_ctl_get_sei_ave_params_ip;
|
||||
ih264d_ctl_get_sei_ave_params_op_t s_ctl_get_sei_ave_params_op;
|
||||
|
||||
memset(&s_ctl_get_sei_ave_params_ip, 0,
|
||||
sizeof(ih264d_ctl_get_sei_ave_params_ip_t));
|
||||
memset(&s_ctl_get_sei_ave_params_op, 0,
|
||||
sizeof(ih264d_ctl_get_sei_ave_params_op_t));
|
||||
|
||||
s_ctl_get_sei_ave_params_ip.e_cmd = IVD_CMD_VIDEO_CTL;
|
||||
s_ctl_get_sei_ave_params_ip.e_sub_cmd =
|
||||
(IVD_CONTROL_API_COMMAND_TYPE_T)IH264D_CMD_CTL_GET_SEI_AVE_PARAMS;
|
||||
s_ctl_get_sei_ave_params_ip.u4_size =
|
||||
sizeof(ih264d_ctl_get_sei_ave_params_ip_t);
|
||||
s_ctl_get_sei_ave_params_op.u4_size =
|
||||
sizeof(ih264d_ctl_get_sei_ave_params_op_t);
|
||||
|
||||
ret = ivd_api_function((iv_obj_t *)codec_obj,
|
||||
(void *)&s_ctl_get_sei_ave_params_ip,
|
||||
(void *)&s_ctl_get_sei_ave_params_op);
|
||||
|
||||
if(IV_SUCCESS != ret)
|
||||
{
|
||||
printf("AVE SEI params not present : Error %x\n",
|
||||
s_ctl_get_sei_ave_params_op.u4_error_code);
|
||||
}
|
||||
}
|
||||
/*************************************************************************/
|
||||
/* Get SEI CCV parameters */
|
||||
/*************************************************************************/
|
||||
if(1 == s_video_decode_op.s_sei_decode_op.u1_sei_ccv_params_present_flag)
|
||||
{
|
||||
ih264d_ctl_get_sei_ccv_params_ip_t s_ctl_get_sei_ccv_params_ip;
|
||||
ih264d_ctl_get_sei_ccv_params_op_t s_ctl_get_sei_ccv_params_op;
|
||||
|
||||
memset(&s_ctl_get_sei_ccv_params_ip, 0,
|
||||
sizeof(ih264d_ctl_get_sei_ccv_params_ip_t));
|
||||
memset(&s_ctl_get_sei_ccv_params_op, 0,
|
||||
sizeof(ih264d_ctl_get_sei_ccv_params_op_t));
|
||||
|
||||
s_ctl_get_sei_ccv_params_ip.e_cmd = IVD_CMD_VIDEO_CTL;
|
||||
s_ctl_get_sei_ccv_params_ip.e_sub_cmd =
|
||||
(IVD_CONTROL_API_COMMAND_TYPE_T)IH264D_CMD_CTL_GET_SEI_CCV_PARAMS;
|
||||
s_ctl_get_sei_ccv_params_ip.u4_size =
|
||||
sizeof(ih264d_ctl_get_sei_ccv_params_ip_t);
|
||||
s_ctl_get_sei_ccv_params_op.u4_size =
|
||||
sizeof(ih264d_ctl_get_sei_ccv_params_op_t);
|
||||
|
||||
ret = ivd_api_function((iv_obj_t *)codec_obj,
|
||||
(void *)&s_ctl_get_sei_ccv_params_ip,
|
||||
(void *)&s_ctl_get_sei_ccv_params_op);
|
||||
|
||||
if(IV_SUCCESS != ret)
|
||||
{
|
||||
printf("CCV SEI params not present : Error %x\n",
|
||||
s_ctl_get_sei_ccv_params_op.u4_error_code);
|
||||
}
|
||||
}
|
||||
|
||||
if((1 == s_app_ctx.display) &&
|
||||
(1 == s_video_decode_op.u4_output_present))
|
||||
|
|
|
|||
|
|
@ -133,6 +133,9 @@
|
|||
#define DEFAULT_SLICE_PARAM 256
|
||||
#define DEFAULT_ENTROPY_CODING_MODE 0
|
||||
|
||||
#define DEFAULT_MAX_DISPLAY_MASTERING_LUMINANCE 50000
|
||||
#define DEFAULT_MIN_DISPLAY_MASTERING_LUMINANCE 1
|
||||
|
||||
#define STRLENGTH 500
|
||||
|
||||
|
||||
|
|
@ -320,6 +323,40 @@ typedef struct
|
|||
TIMER enc_last_time;
|
||||
WORD32 avg_time;
|
||||
|
||||
UWORD32 u4_sei_mdcv_params_present_flag;
|
||||
UWORD32 au4_display_primaries_x[NUM_SEI_MDCV_PRIMARIES];
|
||||
UWORD32 au4_display_primaries_y[NUM_SEI_MDCV_PRIMARIES];
|
||||
UWORD32 u4_white_point_x;
|
||||
UWORD32 u4_white_point_y;
|
||||
UWORD32 u4_max_display_mastering_luminance;
|
||||
UWORD32 u4_min_display_mastering_luminance;
|
||||
|
||||
UWORD32 u4_sei_cll_params_present_flag;
|
||||
UWORD32 u4_max_content_light_level;
|
||||
UWORD32 u4_max_pic_average_light_level;
|
||||
|
||||
UWORD32 u4_sei_ave_params_present_flag;
|
||||
UWORD32 u4_ambient_illuminance;
|
||||
UWORD32 u4_ambient_light_x;
|
||||
UWORD32 u4_ambient_light_y;
|
||||
|
||||
UWORD32 u4_sei_ccv_params_present_flag;
|
||||
UWORD32 u4_ccv_cancel_flag;
|
||||
UWORD32 u4_ccv_persistence_flag;
|
||||
UWORD32 u4_ccv_primaries_present_flag;
|
||||
UWORD32 u4_ccv_min_luminance_value_present_flag;
|
||||
UWORD32 u4_ccv_max_luminance_value_present_flag;
|
||||
UWORD32 u4_ccv_avg_luminance_value_present_flag;
|
||||
UWORD32 u4_ccv_reserved_zero_2bits;
|
||||
WORD32 ai4_ccv_primaries_x[NUM_SEI_CCV_PRIMARIES];
|
||||
WORD32 ai4_ccv_primaries_y[NUM_SEI_CCV_PRIMARIES];
|
||||
UWORD32 u4_ccv_min_luminance_value;
|
||||
UWORD32 u4_ccv_max_luminance_value;
|
||||
UWORD32 u4_ccv_avg_luminance_value;
|
||||
|
||||
ih264e_ctl_set_sei_mdcv_params_ip_t s_sei_mdcv_params;
|
||||
ih264e_ctl_set_sei_cll_params_ip_t s_sei_cll_params;
|
||||
ih264e_ctl_set_sei_ave_params_ip_t s_sei_ave_params;
|
||||
|
||||
} app_ctxt_t;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
/* User include files */
|
||||
#include "ih264_typedefs.h"
|
||||
#include "ih264_defs.h"
|
||||
#include "iv2.h"
|
||||
#include "ive2.h"
|
||||
#include "ih264e.h"
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#endif
|
||||
/* User include files */
|
||||
#include "ih264_typedefs.h"
|
||||
#include "ih264_defs.h"
|
||||
#include "iv2.h"
|
||||
#include "ive2.h"
|
||||
#include "ih264e.h"
|
||||
|
|
@ -1465,10 +1466,10 @@ void set_vui_params(app_ctxt_t *ps_app_ctxt)
|
|||
s_vui_params_ip.u2_sar_height = 0;
|
||||
s_vui_params_ip.u1_overscan_info_present_flag = 0;
|
||||
s_vui_params_ip.u1_overscan_appropriate_flag = 0;
|
||||
s_vui_params_ip.u1_video_signal_type_present_flag = 0;
|
||||
s_vui_params_ip.u1_video_signal_type_present_flag = 1;
|
||||
s_vui_params_ip.u1_video_format = 0;
|
||||
s_vui_params_ip.u1_video_full_range_flag = 0;
|
||||
s_vui_params_ip.u1_colour_description_present_flag = 0;
|
||||
s_vui_params_ip.u1_colour_description_present_flag = 1;
|
||||
s_vui_params_ip.u1_colour_primaries = 0;
|
||||
s_vui_params_ip.u1_transfer_characteristics = 0;
|
||||
s_vui_params_ip.u1_matrix_coefficients = 0;
|
||||
|
|
@ -1507,6 +1508,222 @@ void set_vui_params(app_ctxt_t *ps_app_ctxt)
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void set_sei_mdcv_params(app_ctxt_t *ps_app_ctxt,
|
||||
UWORD32 u4_timestamp_low,
|
||||
UWORD32 u4_timestamp_high)
|
||||
{
|
||||
WORD32 i4_count;
|
||||
IV_STATUS_T status;
|
||||
|
||||
ih264e_ctl_set_sei_mdcv_params_ip_t s_sei_mdcv_params_ip;
|
||||
ih264e_ctl_set_sei_mdcv_params_op_t s_sei_mdcv_params_op;
|
||||
|
||||
s_sei_mdcv_params_ip.e_cmd = IVE_CMD_VIDEO_CTL;
|
||||
s_sei_mdcv_params_ip.e_sub_cmd = IVE_CMD_CTL_SET_SEI_MDCV_PARAMS;
|
||||
|
||||
s_sei_mdcv_params_ip.u1_sei_mdcv_params_present_flag =
|
||||
(UWORD8)ps_app_ctxt->u4_sei_mdcv_params_present_flag;
|
||||
|
||||
for(i4_count = 0; i4_count < NUM_SEI_MDCV_PRIMARIES; i4_count++)
|
||||
{
|
||||
s_sei_mdcv_params_ip.au2_display_primaries_x[i4_count] =
|
||||
(UWORD16)ps_app_ctxt->au4_display_primaries_x[i4_count];
|
||||
s_sei_mdcv_params_ip.au2_display_primaries_y[i4_count] =
|
||||
(UWORD16)ps_app_ctxt->au4_display_primaries_y[i4_count];
|
||||
}
|
||||
|
||||
s_sei_mdcv_params_ip.u2_white_point_x = (UWORD16)ps_app_ctxt->u4_white_point_x;
|
||||
s_sei_mdcv_params_ip.u2_white_point_y = (UWORD16)ps_app_ctxt->u4_white_point_y;
|
||||
s_sei_mdcv_params_ip.u4_max_display_mastering_luminance =
|
||||
ps_app_ctxt->u4_max_display_mastering_luminance;
|
||||
s_sei_mdcv_params_ip.u4_min_display_mastering_luminance =
|
||||
ps_app_ctxt->u4_min_display_mastering_luminance;
|
||||
|
||||
s_sei_mdcv_params_ip.u4_timestamp_high = u4_timestamp_high;
|
||||
s_sei_mdcv_params_ip.u4_timestamp_low = u4_timestamp_low;
|
||||
|
||||
s_sei_mdcv_params_ip.u4_size = sizeof(ih264e_ctl_set_sei_mdcv_params_ip_t);
|
||||
s_sei_mdcv_params_op.u4_size = sizeof(ih264e_ctl_set_sei_mdcv_params_op_t);
|
||||
|
||||
if((ps_app_ctxt->s_sei_mdcv_params.au2_display_primaries_x[0] !=
|
||||
s_sei_mdcv_params_ip.au2_display_primaries_x[0]) ||
|
||||
(ps_app_ctxt->s_sei_mdcv_params.au2_display_primaries_x[1] !=
|
||||
s_sei_mdcv_params_ip.au2_display_primaries_x[1]) ||
|
||||
(ps_app_ctxt->s_sei_mdcv_params.au2_display_primaries_x[2] !=
|
||||
s_sei_mdcv_params_ip.au2_display_primaries_x[2]) ||
|
||||
(ps_app_ctxt->s_sei_mdcv_params.au2_display_primaries_y[0] !=
|
||||
s_sei_mdcv_params_ip.au2_display_primaries_y[0]) ||
|
||||
(ps_app_ctxt->s_sei_mdcv_params.au2_display_primaries_y[1] !=
|
||||
s_sei_mdcv_params_ip.au2_display_primaries_y[1]) ||
|
||||
(ps_app_ctxt->s_sei_mdcv_params.au2_display_primaries_y[2] !=
|
||||
s_sei_mdcv_params_ip.au2_display_primaries_y[2]) ||
|
||||
(ps_app_ctxt->s_sei_mdcv_params.u2_white_point_x !=
|
||||
s_sei_mdcv_params_ip.u2_white_point_x) ||
|
||||
(ps_app_ctxt->s_sei_mdcv_params.u2_white_point_y !=
|
||||
s_sei_mdcv_params_ip.u2_white_point_x) ||
|
||||
(ps_app_ctxt->s_sei_mdcv_params.u4_max_display_mastering_luminance !=
|
||||
s_sei_mdcv_params_ip.u4_max_display_mastering_luminance) ||
|
||||
(ps_app_ctxt->s_sei_mdcv_params.u4_min_display_mastering_luminance !=
|
||||
s_sei_mdcv_params_ip.u4_min_display_mastering_luminance))
|
||||
{
|
||||
status = ih264e_api_function(ps_app_ctxt->ps_enc, &s_sei_mdcv_params_ip,
|
||||
&s_sei_mdcv_params_op);
|
||||
if(status != IV_SUCCESS)
|
||||
{
|
||||
printf("Unable to set sei mdcv params = 0x%x\n",
|
||||
s_sei_mdcv_params_op.u4_error_code);
|
||||
}
|
||||
ps_app_ctxt->s_sei_mdcv_params = s_sei_mdcv_params_ip;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void set_sei_cll_params(app_ctxt_t *ps_app_ctxt,
|
||||
UWORD32 u4_timestamp_low,
|
||||
UWORD32 u4_timestamp_high)
|
||||
{
|
||||
IV_STATUS_T status;
|
||||
|
||||
ih264e_ctl_set_sei_cll_params_ip_t s_sei_cll_params_ip;
|
||||
ih264e_ctl_set_sei_cll_params_op_t s_sei_cll_params_op;
|
||||
|
||||
s_sei_cll_params_ip.e_cmd = IVE_CMD_VIDEO_CTL;
|
||||
s_sei_cll_params_ip.e_sub_cmd = IVE_CMD_CTL_SET_SEI_CLL_PARAMS;
|
||||
|
||||
s_sei_cll_params_ip.u1_sei_cll_params_present_flag =
|
||||
(UWORD8)ps_app_ctxt->u4_sei_cll_params_present_flag;
|
||||
|
||||
s_sei_cll_params_ip.u2_max_content_light_level =
|
||||
(UWORD16)ps_app_ctxt->u4_max_content_light_level;
|
||||
s_sei_cll_params_ip.u2_max_pic_average_light_level =
|
||||
(UWORD16)ps_app_ctxt->u4_max_pic_average_light_level;
|
||||
|
||||
s_sei_cll_params_ip.u4_timestamp_high = u4_timestamp_high;
|
||||
s_sei_cll_params_ip.u4_timestamp_low = u4_timestamp_low;
|
||||
|
||||
s_sei_cll_params_ip.u4_size = sizeof(ih264e_ctl_set_sei_cll_params_ip_t);
|
||||
s_sei_cll_params_op.u4_size = sizeof(ih264e_ctl_set_sei_cll_params_op_t);
|
||||
|
||||
if((ps_app_ctxt->s_sei_cll_params.u2_max_content_light_level !=
|
||||
s_sei_cll_params_ip.u2_max_content_light_level) ||
|
||||
(ps_app_ctxt->s_sei_cll_params.u2_max_pic_average_light_level !=
|
||||
s_sei_cll_params_ip.u2_max_pic_average_light_level))
|
||||
{
|
||||
status = ih264e_api_function(ps_app_ctxt->ps_enc, &s_sei_cll_params_ip,
|
||||
&s_sei_cll_params_op);
|
||||
if(status != IV_SUCCESS)
|
||||
{
|
||||
printf("Unable to set sei cll params = 0x%x\n",
|
||||
s_sei_cll_params_op.u4_error_code);
|
||||
}
|
||||
ps_app_ctxt->s_sei_cll_params = s_sei_cll_params_ip;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void set_sei_ave_params(app_ctxt_t *ps_app_ctxt,
|
||||
UWORD32 u4_timestamp_low,
|
||||
UWORD32 u4_timestamp_high)
|
||||
{
|
||||
IV_STATUS_T status;
|
||||
|
||||
ih264e_ctl_set_sei_ave_params_ip_t s_sei_ave_params_ip;
|
||||
ih264e_ctl_set_sei_ave_params_op_t s_sei_ave_params_op;
|
||||
|
||||
s_sei_ave_params_ip.e_cmd = IVE_CMD_VIDEO_CTL;
|
||||
s_sei_ave_params_ip.e_sub_cmd = IVE_CMD_CTL_SET_SEI_AVE_PARAMS;
|
||||
|
||||
s_sei_ave_params_ip.u1_sei_ave_params_present_flag =
|
||||
(UWORD8)ps_app_ctxt->u4_sei_ave_params_present_flag;
|
||||
|
||||
s_sei_ave_params_ip.u4_ambient_illuminance = ps_app_ctxt->u4_ambient_illuminance;
|
||||
s_sei_ave_params_ip.u2_ambient_light_x = (UWORD16)ps_app_ctxt->u4_ambient_light_x;
|
||||
s_sei_ave_params_ip.u2_ambient_light_y = (UWORD16)ps_app_ctxt->u4_ambient_light_y;
|
||||
|
||||
s_sei_ave_params_ip.u4_timestamp_high = u4_timestamp_high;
|
||||
s_sei_ave_params_ip.u4_timestamp_low = u4_timestamp_low;
|
||||
|
||||
s_sei_ave_params_ip.u4_size = sizeof(ih264e_ctl_set_sei_ave_params_ip_t);
|
||||
s_sei_ave_params_op.u4_size = sizeof(ih264e_ctl_set_sei_ave_params_op_t);
|
||||
|
||||
if((ps_app_ctxt->s_sei_ave_params.u4_ambient_illuminance !=
|
||||
s_sei_ave_params_ip.u4_ambient_illuminance) ||
|
||||
(ps_app_ctxt->s_sei_ave_params.u2_ambient_light_x !=
|
||||
s_sei_ave_params_ip.u2_ambient_light_x) ||
|
||||
(ps_app_ctxt->s_sei_ave_params.u2_ambient_light_y !=
|
||||
s_sei_ave_params_ip.u2_ambient_light_y))
|
||||
{
|
||||
status = ih264e_api_function(ps_app_ctxt->ps_enc, &s_sei_ave_params_ip,
|
||||
&s_sei_ave_params_op);
|
||||
if(status != IV_SUCCESS)
|
||||
{
|
||||
printf("Unable to set sei ave params = 0x%x\n",
|
||||
s_sei_ave_params_op.u4_error_code);
|
||||
}
|
||||
ps_app_ctxt->s_sei_ave_params = s_sei_ave_params_ip;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void set_sei_ccv_params(app_ctxt_t *ps_app_ctxt,
|
||||
UWORD32 u4_timestamp_low,
|
||||
UWORD32 u4_timestamp_high)
|
||||
{
|
||||
WORD32 i4_count;
|
||||
IV_STATUS_T status;
|
||||
|
||||
ih264e_ctl_set_sei_ccv_params_ip_t s_sei_ccv_params_ip;
|
||||
ih264e_ctl_set_sei_ccv_params_op_t s_sei_ccv_params_op;
|
||||
|
||||
s_sei_ccv_params_ip.e_cmd = IVE_CMD_VIDEO_CTL;
|
||||
s_sei_ccv_params_ip.e_sub_cmd = IVE_CMD_CTL_SET_SEI_CCV_PARAMS;
|
||||
|
||||
s_sei_ccv_params_ip.u1_sei_ccv_params_present_flag =
|
||||
(UWORD8)ps_app_ctxt->u4_sei_ccv_params_present_flag;
|
||||
|
||||
s_sei_ccv_params_ip.u1_ccv_cancel_flag = (UWORD8)ps_app_ctxt->u4_ccv_cancel_flag;
|
||||
s_sei_ccv_params_ip.u1_ccv_persistence_flag =
|
||||
(UWORD8)ps_app_ctxt->u4_ccv_persistence_flag;
|
||||
s_sei_ccv_params_ip.u1_ccv_primaries_present_flag =
|
||||
(UWORD8)ps_app_ctxt->u4_ccv_primaries_present_flag;
|
||||
s_sei_ccv_params_ip.u1_ccv_min_luminance_value_present_flag =
|
||||
(UWORD8)ps_app_ctxt->u4_ccv_min_luminance_value_present_flag;
|
||||
s_sei_ccv_params_ip.u1_ccv_max_luminance_value_present_flag =
|
||||
(UWORD8)ps_app_ctxt->u4_ccv_max_luminance_value_present_flag;
|
||||
s_sei_ccv_params_ip.u1_ccv_avg_luminance_value_present_flag =
|
||||
(UWORD8)ps_app_ctxt->u4_ccv_avg_luminance_value_present_flag;
|
||||
s_sei_ccv_params_ip.u1_ccv_reserved_zero_2bits =
|
||||
(UWORD8)ps_app_ctxt->u4_ccv_reserved_zero_2bits;
|
||||
|
||||
for(i4_count = 0; i4_count < NUM_SEI_CCV_PRIMARIES; i4_count++)
|
||||
{
|
||||
s_sei_ccv_params_ip.ai4_ccv_primaries_x[i4_count] =
|
||||
ps_app_ctxt->ai4_ccv_primaries_x[i4_count];
|
||||
s_sei_ccv_params_ip.ai4_ccv_primaries_y[i4_count] =
|
||||
ps_app_ctxt->ai4_ccv_primaries_y[i4_count];
|
||||
}
|
||||
|
||||
s_sei_ccv_params_ip.u4_ccv_min_luminance_value = ps_app_ctxt->u4_ccv_min_luminance_value;
|
||||
s_sei_ccv_params_ip.u4_ccv_max_luminance_value = ps_app_ctxt->u4_ccv_max_luminance_value;
|
||||
s_sei_ccv_params_ip.u4_ccv_avg_luminance_value = ps_app_ctxt->u4_ccv_avg_luminance_value;
|
||||
|
||||
s_sei_ccv_params_ip.u4_timestamp_high = u4_timestamp_high;
|
||||
s_sei_ccv_params_ip.u4_timestamp_low = u4_timestamp_low;
|
||||
|
||||
s_sei_ccv_params_ip.u4_size = sizeof(ih264e_ctl_set_sei_ccv_params_ip_t);
|
||||
s_sei_ccv_params_op.u4_size = sizeof(ih264e_ctl_set_sei_ccv_params_op_t);
|
||||
|
||||
status = ih264e_api_function(ps_app_ctxt->ps_enc, &s_sei_ccv_params_ip,
|
||||
&s_sei_ccv_params_op);
|
||||
if(status != IV_SUCCESS)
|
||||
{
|
||||
printf("Unable to set sei ccv params = 0x%x\n",
|
||||
s_sei_ccv_params_op.u4_error_code);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#define PEAK_WINDOW_SIZE 8
|
||||
|
||||
void synchronous_encode(iv_obj_t *ps_enc, app_ctxt_t *ps_app_ctxt)
|
||||
|
|
@ -1624,6 +1841,62 @@ void synchronous_encode(iv_obj_t *ps_enc, app_ctxt_t *ps_app_ctxt)
|
|||
|
||||
while(1)
|
||||
{
|
||||
IV_PICTURE_CODING_TYPE_T e_frame_type;
|
||||
WORD32 i4_count;
|
||||
|
||||
/* Default sei params values*/
|
||||
ps_app_ctxt->u4_sei_mdcv_params_present_flag = 1;
|
||||
if(1 == ps_app_ctxt->u4_sei_mdcv_params_present_flag)
|
||||
{
|
||||
for(i4_count = 0; i4_count < NUM_SEI_MDCV_PRIMARIES; i4_count++)
|
||||
{
|
||||
ps_app_ctxt->au4_display_primaries_x[i4_count] = 0;
|
||||
ps_app_ctxt->au4_display_primaries_y[i4_count] = 0;
|
||||
}
|
||||
ps_app_ctxt->u4_white_point_x = 0;
|
||||
ps_app_ctxt->u4_white_point_y = 0;
|
||||
ps_app_ctxt->u4_max_display_mastering_luminance = DEFAULT_MAX_DISPLAY_MASTERING_LUMINANCE;
|
||||
ps_app_ctxt->u4_min_display_mastering_luminance = DEFAULT_MIN_DISPLAY_MASTERING_LUMINANCE;
|
||||
set_sei_mdcv_params(ps_app_ctxt, u4_timestamp_low, u4_timestamp_high);
|
||||
}
|
||||
|
||||
ps_app_ctxt->u4_sei_cll_params_present_flag = 1;
|
||||
if(1 == ps_app_ctxt->u4_sei_cll_params_present_flag)
|
||||
{
|
||||
ps_app_ctxt->u4_max_content_light_level = 0;
|
||||
ps_app_ctxt->u4_max_pic_average_light_level = 0;
|
||||
set_sei_cll_params(ps_app_ctxt, u4_timestamp_low, u4_timestamp_high);
|
||||
}
|
||||
|
||||
ps_app_ctxt->u4_sei_ave_params_present_flag = 1;
|
||||
if(1 == ps_app_ctxt->u4_sei_ave_params_present_flag)
|
||||
{
|
||||
ps_app_ctxt->u4_ambient_illuminance = 1;
|
||||
ps_app_ctxt->u4_ambient_light_x = 0;
|
||||
ps_app_ctxt->u4_ambient_light_y = 0;
|
||||
set_sei_ave_params(ps_app_ctxt, u4_timestamp_low, u4_timestamp_high);
|
||||
}
|
||||
|
||||
ps_app_ctxt->u4_sei_ccv_params_present_flag = 1;
|
||||
if(1 == ps_app_ctxt->u4_sei_ccv_params_present_flag)
|
||||
{
|
||||
ps_app_ctxt->u4_ccv_cancel_flag = 0;
|
||||
ps_app_ctxt->u4_ccv_persistence_flag = 1;
|
||||
ps_app_ctxt->u4_ccv_primaries_present_flag = 1;
|
||||
ps_app_ctxt->u4_ccv_min_luminance_value_present_flag = 1;
|
||||
ps_app_ctxt->u4_ccv_max_luminance_value_present_flag = 1;
|
||||
ps_app_ctxt->u4_ccv_avg_luminance_value_present_flag = 1;
|
||||
ps_app_ctxt->u4_ccv_reserved_zero_2bits = 0;
|
||||
for(i4_count = 0; i4_count < NUM_SEI_CCV_PRIMARIES; i4_count++)
|
||||
{
|
||||
ps_app_ctxt->ai4_ccv_primaries_x[i4_count] = 1;
|
||||
ps_app_ctxt->ai4_ccv_primaries_y[i4_count] = 1;
|
||||
}
|
||||
ps_app_ctxt->u4_ccv_min_luminance_value = 1;
|
||||
ps_app_ctxt->u4_ccv_max_luminance_value = 1;
|
||||
ps_app_ctxt->u4_ccv_avg_luminance_value = 1;
|
||||
set_sei_ccv_params(ps_app_ctxt, u4_timestamp_low, u4_timestamp_high);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/****************** Input Initialization **************************************/
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
/* User include files */
|
||||
|
||||
#include "ih264_typedefs.h"
|
||||
#include "ih264_defs.h"
|
||||
#include "iv2.h"
|
||||
#include "ive2.h"
|
||||
#include "ih264e.h"
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
/* User include files */
|
||||
#include "ih264_typedefs.h"
|
||||
#include "ih264_defs.h"
|
||||
#include "iv2.h"
|
||||
#include "ive2.h"
|
||||
#include "ih264e.h"
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
/* User include files */
|
||||
|
||||
#include "ih264_typedefs.h"
|
||||
#include "ih264_defs.h"
|
||||
#include "iv2.h"
|
||||
#include "ive2.h"
|
||||
#include "ih264e.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue