Skip to content

Commit b80777b

Browse files
committed
1,fix bug for invalid mapping value in amb mono. 2,skip invalid layout verification log
1 parent 2ff5479 commit b80777b

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

code/src/iamf_dec/IAMF_core_decoder.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,11 @@ static int iamf_core_decoder_convert_mono(IAMF_CoreDecoder *ths, float *out,
9393

9494
memset(out, 0, sizeof(float) * frame_size * ths->ctx->channels);
9595
for (int i = 0; i < ths->ctx->channels; ++i) {
96-
memcpy(&out[frame_size * i], &in[frame_size * map[i]],
97-
frame_size * sizeof(float));
96+
if (map[i] != 255)
97+
memcpy(&out[frame_size * i], &in[frame_size * map[i]],
98+
frame_size * sizeof(float));
99+
else
100+
memset(&out[frame_size * i], 0, frame_size * sizeof(float));
98101
}
99102
return IAMF_OK;
100103
}
@@ -261,10 +264,9 @@ int iamf_core_decoder_decode(IAMF_CoreDecoder *ths, uint8_t *buffer[],
261264
return ths->cdec->decode(ctx, buffer, size, count, out, frame_size);
262265

263266
if (!ths->buffer) {
264-
int c = ctx->coupled_streams + ctx->streams;
265267
float *block = 0;
266268

267-
block = IAMF_MALLOC(float, c *frame_size);
269+
block = IAMF_MALLOC(float, ctx->channels *frame_size);
268270
if (!block) return IAMF_ERR_ALLOC_FAIL;
269271
ths->buffer = block;
270272
}

code/src/iamf_dec/vlogging_tool_sr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <fcntl.h>
2222
#include <io.h>
2323
#else
24-
#include <unistd.h>
24+
#include <unistd.h>
2525
#endif
2626
#include <stdio.h>
2727
#include <stdlib.h>
@@ -738,6 +738,7 @@ static void write_mix_presentation_log(uint64_t idx, void* obu, char* log) {
738738

739739
log += write_yaml_form(log, 2, "layouts:");
740740
for (uint64_t j = 0; j < submix->num_layouts; ++j) {
741+
if (!submix->layouts[j]) continue;
741742
// layout
742743
log += write_yaml_form(log, 2, "- loudness_layout:");
743744

0 commit comments

Comments
 (0)