Skip to content

Commit

Permalink
Fix playback issue, support adts extension for AAC, and add '--dv-bl-…
Browse files Browse the repository at this point in the history
…compatible-id' parameter
  • Loading branch information
ShaoWeiguo committed Feb 12, 2020
1 parent 98fc2f5 commit 70a2e1d
Show file tree
Hide file tree
Showing 21 changed files with 12,816 additions and 12,246 deletions.
Binary file added bin/mp4muxer
Binary file not shown.
Binary file added bin/mp4muxer.exe
Binary file not shown.
Binary file removed bin/mp4muxer_32bits
Binary file not shown.
Binary file removed bin/mp4muxer_32bits.exe
Binary file not shown.
Binary file removed bin/mp4muxer_64bits
Binary file not shown.
Binary file removed bin/mp4muxer_64bits.exe
Binary file not shown.
Binary file modified bin/mp4muxer_mac
Binary file not shown.
9 changes: 9 additions & 0 deletions frontend/ema_mp4_ifc.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,15 @@ uint32_t ema_mp4_mux_set_dv_es_mode(ema_mp4_ctrl_handle_t handle, const int8_t *
*/
uint32_t ema_mp4_mux_set_dv_profile(ema_mp4_ctrl_handle_t handle, int32_t profile);

/** \brief Sets the DoVi compatible id value
*
* \param handle: the multiplexer handle returned by the ema_mp4_mux_create()
* \param compatid: A value of 0-9. Refer to the Dolby Vision Profiles Levels
* specification for detailed information.
* \return EMA_MP4_MUXED_...
*/
uint32_t ema_mp4_mux_set_dv_compatible_id(ema_mp4_ctrl_handle_t handle, int32_t compatible_id);

#ifdef __cplusplus
}
#endif
Expand Down
26 changes: 24 additions & 2 deletions frontend/ema_mp4_mux_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,12 @@ ema_mp4_mux_start(ema_mp4_ctrl_handle_t handle)
handle->usr_cfg_mux.dv_bl_non_comp_flag = 1;
}

if((handle->usr_cfg_mux.ext_timing_info.ext_dv_profile == 8 ) && (handle->usr_cfg_mux.ext_timing_info.ext_dv_bl_compatible_id == 0))
{
msglog(NULL, MSGLOG_ERR, "Error: For Dolby vision profile 8, dv-bl-compatible-id should be set, value can be 1 or 2.\n");
return EMA_MP4_MUXED_PARAM_ERR;
}

if ( (handle->usr_cfg_mux.output_format == OUTPUT_FORMAT_DASH) ||
(handle->usr_cfg_mux.output_format == OUTPUT_FORMAT_FRAG_MP4) )
{
Expand Down Expand Up @@ -620,6 +626,8 @@ ema_mp4_mux_create(ema_mp4_ctrl_handle_t *handle)
usr_cfg_mux_ptr->ext_timing_info.time_scale = 30000;
usr_cfg_mux_ptr->ext_timing_info.num_units_in_tick = 1000; /** default time_scale/num_units_in_tick for video frame-rate: 30 fps */
usr_cfg_mux_ptr->ext_timing_info.ext_dv_profile = 0xff;
usr_cfg_mux_ptr->ext_timing_info.ac4_bitrate = 0;
usr_cfg_mux_ptr->ext_timing_info.ac4_bitrate_precision = 0xffffffff;
usr_cfg_mux_ptr->fix_cm_time = 0;
usr_cfg_mux_ptr->chunk_span_time = 250; /** default 250ms */
usr_cfg_mux_ptr->frag_cfg_flags = ISOM_FRAGCFG_DEFAULT;
Expand Down Expand Up @@ -1032,9 +1040,23 @@ ema_mp4_mux_set_dv_es_mode(ema_mp4_ctrl_handle_t handle, const int8_t *mode)
uint32_t
ema_mp4_mux_set_dv_profile(ema_mp4_ctrl_handle_t handle, int32_t profile)
{
if ((profile >= 0) && (profile < 10))
if ((profile == 4) || (profile == 5) || (profile >= 7) && (profile <= 9))
{
handle->usr_cfg_mux.ext_timing_info.ext_dv_profile = (uint8_t)profile;
return EMA_MP4_MUXED_OK;
}
else
{
return EMA_MP4_MUXED_PARAM_ERR;
}
}

uint32_t
ema_mp4_mux_set_dv_bl_compatible_id(ema_mp4_ctrl_handle_t handle, int32_t compatible_id)
{
if ((compatible_id >= 0) && (compatible_id <= 6))
{
handle->usr_cfg_mux.ext_timing_info.ext_dv_profile = (uint8_t)profile;
handle->usr_cfg_mux.ext_timing_info.ext_dv_bl_compatible_id = (uint8_t)compatible_id;
return EMA_MP4_MUXED_OK;
}
else
Expand Down
769 changes: 379 additions & 390 deletions frontend/mp4_muxer_app.c

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions include/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,12 @@ typedef struct ext_timing_info_t_
unsigned override_timing; /** if over ride timing info in sps */
/** externally time_scale/num_units_in_tick define frame rate in overiding */
uint32_t time_scale, num_units_in_tick;
uint8_t ext_dv_profile; /** dolby vision profile, overriding set by user */
uint8_t ext_dv_bl_compatible_id; /** dolby vision profile, must provided by user if profile ID is 8 */
uint8_t ext_dv_profile; /* dolby vision profile, overriding set by user */
uint8_t ext_dv_bl_compatible_id; /* dolby vision profile, must provided by user if profile ID is 8 */
uint8_t ps_present_flag; /* the indicator of dsi info (H264: SPS/PPS; H265: VPS/SPS/PPS) in sample entry box */
uint32_t ac4_bitrate;
uint32_t ac4_bitrate_precision;
uint32_t hls_flag;
} ext_timing_info_t;

#ifdef WANT_GET_SAMPLE_PUSH
Expand Down Expand Up @@ -455,6 +459,9 @@ typedef struct codec_config_t_
uint32_t dv_el_dsi_size; /** dolby vision el dsi buff size */ \
uint8_t * dv_el_dsi_buf; /** dolby vision el dsi buff */ \
uint8_t dv_level; /** dolby vision level */ \
uint32_t ac4_bitstream_version; /* ac-4 bitstream version */ \
uint32_t ac4_presentation_version; /* ac-4 main presentation version */ \
uint32_t ac4_mdcompat; /* ac-4 decoder compatibility indication */ \
/** decoder only */ \
list_handle_t codec_config_lst; /** handle to codec config list */ \
codec_config_t* curr_codec_config; /** handle to current codec config in codec_config_lst */ \
Expand All @@ -469,6 +476,8 @@ typedef struct codec_config_t_
uint32_t bit_rate; \
uint32_t buferSizeDB; \
uint32_t minBitrate, maxBitrate; \
uint32_t isJoC; /* 1: if it's ddp joc */ \
uint32_t isReferencedEs; \
\
/**** for the convenience */ \
uint32_t frame_size; \
Expand Down
7 changes: 5 additions & 2 deletions include/parser_ac4.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ struct parser_ac4_t_
uint8_t presentation_version[PRESENTATION_NUM];
uint8_t b_add_emdf_substreams[PRESENTATION_NUM];
uint8_t mdcompat[PRESENTATION_NUM];
uint8_t b_presentation_group_index[PRESENTATION_NUM];
uint8_t presentation_group_index[PRESENTATION_NUM];
uint8_t b_presentation_id[PRESENTATION_NUM];
uint16_t presentation_id[PRESENTATION_NUM];
uint8_t frame_rate_factor[PRESENTATION_NUM];
uint8_t dsi_frame_rate_multiply_info[PRESENTATION_NUM];
uint8_t emdf_version[PRESENTATION_NUM];
Expand Down Expand Up @@ -102,6 +102,7 @@ struct parser_ac4_t_

uint8_t n_substream_groups[PRESENTATION_NUM];
uint8_t b_multi_pid[PRESENTATION_NUM];
uint8_t isAtmos[PRESENTATION_NUM];

uint8_t total_n_substream_groups;
uint8_t max_group_index;
Expand All @@ -111,6 +112,7 @@ struct parser_ac4_t_
uint8_t group_index[PRESENTATION_NUM][SUBSTREAM_GROUP];

uint8_t b_4_back_channels_present[SUBSTREAM_GROUP][SUBSTREAM_COUNT];
uint8_t b_centre_present[SUBSTREAM_GROUP][SUBSTREAM_COUNT];
uint8_t top_channels_present[SUBSTREAM_GROUP][SUBSTREAM_COUNT];

uint8_t b_substreams_present[SUBSTREAM_GROUP];
Expand Down Expand Up @@ -150,6 +152,7 @@ struct parser_ac4_t_
uint8_t n_fullband_dmx_signals_minus1[SUBSTREAM_GROUP][SUBSTREAM_COUNT];
uint8_t n_fullband_upmix_signals_minus1[SUBSTREAM_GROUP][SUBSTREAM_COUNT];

uint32_t bit_rate_mode;
};
typedef struct parser_ac4_t_ parser_ac4_t;
typedef parser_ac4_t *parser_ac4_handle_t;
Expand Down
5 changes: 3 additions & 2 deletions include/parser_avc_dpb.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#define __PARSER_AVC_DPB_H__

#include "boolean.h" /** BOOL */
#include "c99_inttypes.h"

#define USE_HRD_FOR_TS 1 /** use the hrd model for dts, cts*/
#define TEST_DELTA_POC (0 && USE_HRD_FOR_TS) /** apoc is for what it mean for when USE_HRD_FOR_TS = 0 */
Expand All @@ -43,8 +44,8 @@ void apoc_set_num_reorder_au(avc_apoc_t *p, int num_reorder_au);
void apoc_set_max_ref_au (avc_apoc_t *p, int num_ref_frames);
void apoc_flush (avc_apoc_t *p);
void apoc_add (avc_apoc_t *p, int poc, int is_idr);
int apoc_reorder_num (avc_apoc_t *p, int doc); /** return -1 for unknown */
int apoc_min_cts (avc_apoc_t *p); /** in au count */
int32_t apoc_reorder_num (avc_apoc_t *p, int doc); /** return -1 for unknown */
int32_t apoc_min_cts (avc_apoc_t *p); /** in au count */
BOOL apoc_need_adj_cts (avc_apoc_t *p); /** always return true */

#if defined(_DEBUG) && TEST_DELTA_POC
Expand Down
151 changes: 149 additions & 2 deletions include/parser_hevc_dec.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,88 @@ typedef enum
I_SLICE
} slice_type_t;


/// texture component type
typedef enum
{
TEXT_LUMA, ///< luma
TEXT_CHROMA, ///< chroma (U+V)
TEXT_CHROMA_U, ///< chroma U
TEXT_CHROMA_V, ///< chroma V
TEXT_ALL, ///< Y+U+V
TEXT_NONE = 15
} texture_type_t;


/* partition shape */
typedef enum
{
SIZE_2Nx2N, /** < symmetric motion partition, 2Nx2N */
SIZE_2NxN, /** < symmetric motion partition, 2Nx N ( 2 rows ) */
SIZE_Nx2N, /** < symmetric motion partition, Nx2N ( 2 columns ) */
SIZE_NxN, /** < symmetric motion partition, Nx N */
SIZE_2NxnU, /** < asymmetric motion partition, 2Nx( N/2) + 2Nx(3N/2) */
SIZE_2NxnD, /** < asymmetric motion partition, 2Nx(3N/2) + 2Nx( N/2) */
SIZE_nLx2N, /** < asymmetric motion partition, ( N/2)x2N + (3N/2)x2N */
SIZE_nRx2N, /** < asymmetric motion partition, (3N/2)x2N + ( N/2)x2N */

SIZE_nUx2N, /** < the larger halves of the above */
SIZE_nDx2N, /** < the larger halves of the above */
SIZE_2NxnL, /** < the larger halves of the above */
SIZE_2NxnR, /** < the larger halves of the above */

SIZE_NONE = 15
} partition_size_t;


/* prediction type */
typedef enum
{
MODE_SKIP,
MODE_INTER,
MODE_INTRA,
MODE_NONE = 15
} prediction_mode_t;


typedef enum
{
SCAN_DIAG = 0, /** < up-right diagonal scan */
SCAN_HOR, /** < horizontal first scan */
SCAN_VER /** < vertical first scan */
} coeff_scan_t;


typedef enum
{
REF_PIC_LIST_0 = 0, /** < reference list 0 */
REF_PIC_LIST_1 = 1, /** < reference list 1 */
REF_PIC_LIST_C = 2, /** < combined reference list for uni-prediction in B-Slices */
REF_PIC_LIST_X = 100 /** < special mark */
} ref_pic_list_t;



typedef struct
{
/** parameters for AMVP */
int16_t i_x[ AMVP_MAX_NUM_CANDS_MEM ];
int16_t i_y[ AMVP_MAX_NUM_CANDS_MEM ];
int8_t i_N; /** < number of motion vector predictor candidates */
} amvp_context_t;


typedef enum
{
/** motion vector predictor direction used in AMVP */
MD_LEFT = 0, /** < MVP of left block */
MD_ABOVE, /** < MVP of above block */
MD_ABOVE_RIGHT, /** < MVP of above right block */
MD_BELOW_LEFT, /** < MVP of below left block */
MD_ABOVE_LEFT /** < MVP of above left block */
} mvp_dir_t;


typedef enum
{
SCALING_LIST_4x4 = 0,
Expand All @@ -143,8 +225,31 @@ typedef enum
SCALING_LIST_SIZE_NUM
} scaling_list_size_t;


typedef enum
{
SAO_EO_LEN = 4,
SAO_BO_LEN = 4,
SAO_MAX_BO_CLASSES = 32
} SAO_type_len_t;

typedef enum
{
SAO_EO_0 = 0,
SAO_EO_1,
SAO_EO_2,
SAO_EO_3,
SAO_BO,
MAX_NUM_SAO_TYPE
} SAO_type_t;


#define SAO_MAX_DEPTH 4
#define SAO_BO_BITS 5
#define SAO_LUMA_GROUP_NUM (1<<SAO_BO_BITS)
#define MAX_NUM_SAO_OFFSETS 4
#define MAX_NUM_SAO_CLASS 33


typedef struct
{
Expand Down Expand Up @@ -458,6 +563,9 @@ typedef struct
int16_t i_pic_conf_win_top_offset;
int16_t i_pic_conf_win_bottom_offset;

int16_t i_pic_luma_width_dis;
int16_t i_pic_luma_height_dis;

int8_t i_bit_depth_luma;
int8_t i_bit_depth_chroma;
int8_t i_log2_max_pic_order_cnt_lsb;
Expand Down Expand Up @@ -657,10 +765,49 @@ typedef struct

} vui_t;

typedef struct
{
int32_t i_active_vps_id;
bool b_active_sps_id_present;
int32_t i_active_sps_id;
bool b_active_param_set_sei_extension;
} sei_parameter_sets_t;

typedef struct
{
int16_t i_seqParameterSetId;
bool b_altCpbParamsPresentFlag;
int16_t ai_initialCpbRemovalDelay [ MAX_CPB_CNT ][ 2 ];
int16_t ai_initialCpbRemovalDelayOffset [ MAX_CPB_CNT ][ 2 ];
int16_t ai_initialAltCpbRemovalDelay [ MAX_CPB_CNT ][ 2 ];
int16_t ai_initialAltCpbRemovalDelayOffset[ MAX_CPB_CNT ][ 2 ];
} sei_buffering_period_t;

typedef struct
{
int32_t i_cpb_removal_delay;
int32_t i_dpb_output_delay;
int32_t i_num_decoding_units_minus1;
bool b_du_common_cpb_removal_delay;
int32_t i_du_common_cpb_removal_delay_minus1;
int32_t *pi_num_nalus_in_du_minus1;
int32_t *pi_du_cpb_removal_delay_minus1;

} sei_picture_timing_t;

typedef struct
{
#define QP_BITS 15
int32_t i_qp;
int32_t i_per;
int32_t i_rem;
int32_t i_bits;
} qp_param_t;

typedef struct
{
/** Explicit weighted prediction parameters parsed in slice header, */
/** or implicit weighted prediction parameters (8 bits depth values). */
/** Explicit weighted prediction parameters parsed in slice header,
or implicit weighted prediction parameters (8 bits depth values). */
bool b_present;
int32_t i_log2_weight_denom;
int32_t i_weight;
Expand Down
1 change: 1 addition & 0 deletions src/esparser/parser_aac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,7 @@ void
parser_aac_reg(void)
{
reg_parser_set("aac", parser_aac_create);
reg_parser_set("adts", parser_aac_create);
}

/*
Expand Down
Loading

4 comments on commit 70a2e1d

@jcdr428
Copy link

@jcdr428 jcdr428 commented on 70a2e1d Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ShaoWeiguo So compatibility with deprecated profile 6 has been removed on 12 Feb 20. Profile 4 states "BL compatibility: SDR/HDR", however the latest profile document DolbyVisionProfilesLevels_v1_3_2_2019_09_16.pdf mentions BL compatibility to SDR only (VUI 1,1,1,0).

Which HDR is profile 4 compatible with, is it CTA HDR10 (VUI 9,16,9, chromaloc 0 or 2) and will the profile document be updated accordingly?

@rgalv-Dolby
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Profile 4 is a Dolby Vision specific dual layer format where the base layer is SDR ( BT.1886, ITU-R BT.709, YCbCr 4:2:0) and then the enhancement layer contains the Dolby Vision data. So its is only cross compatible with SDR and not HDR10. That is why the current profile and levels doc was updated to reflect that.

@jcdr428
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rgalv-Dolby Thanks. So could we please remove HDR in BL compatibility: SDR/HDR in the profile description as it is misleading, thanks.

                " --dv-profile <arg>                 = Sets the Dolby Vision profile. This option is MANDATORY for \n"
                "                                      DoVi elementary stream: Valid profile values are:\n"
                "                                      4 - dvhe.04, BL codec: HEVC10; EL codec: HEVC10; BL compatibility: SDR/HDR.   \n"

@ShaoWeiguo
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcdr428 Sure.

Please sign in to comment.