Skip to content

Commit 12cd7a9

Browse files
committed
Add more comments about normalization loudness
1 parent 6f9c879 commit 12cd7a9

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

code/include/IAMF_decoder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ char *IAMF_decoder_get_codec_capability();
136136
* adjusted to the setting target.
137137
* @param [in] handle : iamf decoder handle.
138138
* @param [in] loundness : target normalization loudness in LKFS.
139+
* 0 dose not do normalization,
140+
* others(<0) target value of normalization.
139141
* @return @ref IAErrCode.
140142
*/
141143
int IAMF_decoder_set_normalization_loudness(IAMF_DecoderHandle handle,
@@ -225,7 +227,6 @@ typedef struct IAMF_extradata {
225227

226228
/**
227229
* @brief Set the start timestamp and time base to decoder.
228-
* max frame size could be gotten.
229230
* @param [in] handle : iamf decoder handle.
230231
* @param [in] pts : the start timestamp.
231232
* @param [in] time_base : the time base used for pts.

code/src/iamf_dec/IAMF_decoder.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#define INVALID_TIMESTAMP 0xFFFFFFFF
4141
#define OUTPUT_SAMPLERATE 48000
4242
#define SPEEX_RESAMPLER_QUALITY 4
43+
#define MAX_LIMITED_NORMALIZATION_LOUDNESS 0.0f
4344

4445
#define IAMF_DECODER_CONFIG_MIX_PRESENTATION 0x1
4546
#define IAMF_DECODER_CONFIG_OUTPUT_LAYOUT 0x2
@@ -3676,7 +3677,7 @@ static int iamf_decoder_internal_decode(IAMF_DecoderHandle handle,
36763677
swap((void **)&f->data, (void **)&out);
36773678
}
36783679

3679-
if (ctx->normalization_loudness) {
3680+
if (ctx->normalization_loudness < MAX_LIMITED_NORMALIZATION_LOUDNESS) {
36803681
iamf_loudness_process(
36813682
f->data, real_frame_size, ctx->output_layout->channels,
36823683
db2lin(ctx->normalization_loudness - ctx->loudness));
@@ -3919,6 +3920,8 @@ IAMF_DecoderHandle IAMF_decoder_open(void) {
39193920
handle->ctx.threshold_db = LIMITER_MaximumTruePeak;
39203921
handle->ctx.loudness = 1.0f;
39213922
handle->ctx.sampling_rate = OUTPUT_SAMPLERATE;
3923+
handle->ctx.normalization_loudness =
3924+
MAX_LIMITED_NORMALIZATION_LOUDNESS;
39223925
handle->ctx.status = IAMF_DECODER_STATUS_INIT;
39233926
handle->ctx.mix_presentation_id = INVALID_ID;
39243927
handle->limiter = audio_effect_peak_limiter_create();

code/test/tools/iamfdec/src/test_iamfdec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static void print_usage(char *argv[]) {
101101
fprintf(stderr, " 12 : Sound system mono (0+1+0)\n");
102102
fprintf(stderr, " b : Binaural.\n");
103103
fprintf(stderr, "-p [dB] : Peak threshold in dB.\n");
104-
fprintf(stderr, "-l [LKFS] : Normalization loudness in LKFS.\n");
104+
fprintf(stderr, "-l [LKFS] : Normalization loudness(<0) in LKFS.\n");
105105
fprintf(stderr, "-d [bit] : Bit depth of WAVE output.\n");
106106
fprintf(stderr, "-mp [id] : Set mix presentation id.\n");
107107
fprintf(stderr,

0 commit comments

Comments
 (0)