* [FFmpeg-devel] [PATCH] avcodec/opus: always use ambisonic layout for mapping family 2
@ 2022-03-18 1:43 James Almer
2022-03-20 22:09 ` Michael Niedermayer
0 siblings, 1 reply; 3+ messages in thread
From: James Almer @ 2022-03-18 1:43 UTC (permalink / raw)
To: ffmpeg-devel
No need to use a Custom layout when the non diegetic channels can be
described as a standard mask.
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavcodec/opus.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/libavcodec/opus.c b/libavcodec/opus.c
index 7eccc17e80..3540206347 100644
--- a/libavcodec/opus.c
+++ b/libavcodec/opus.c
@@ -399,21 +399,10 @@ av_cold int ff_opus_parse_extradata(AVCodecContext *avctx,
goto fail;
}
+ layout.order = AV_CHANNEL_ORDER_AMBISONIC;
layout.nb_channels = channels;
- if (channels == (ambisonic_order + 1) * (ambisonic_order + 1)) {
- layout.order = AV_CHANNEL_ORDER_AMBISONIC;
- } else {
- layout.order = AV_CHANNEL_ORDER_CUSTOM;
- layout.u.map = av_calloc(channels, sizeof(*layout.u.map));
- if (!layout.u.map) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- for (i = 0; i < channels - 2; i++)
- layout.u.map[i].id = AV_CHAN_AMBISONIC_BASE + i;
- layout.u.map[channels - 2].id = AV_CHAN_FRONT_LEFT;
- layout.u.map[channels - 1].id = AV_CHAN_FRONT_RIGHT;
- }
+ if (channels != ((ambisonic_order + 1) * (ambisonic_order + 1)))
+ layout.u.mask = AV_CH_LAYOUT_STEREO;
} else {
layout.order = AV_CHANNEL_ORDER_UNSPEC;
layout.nb_channels = channels;
--
2.35.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avcodec/opus: always use ambisonic layout for mapping family 2
2022-03-18 1:43 [FFmpeg-devel] [PATCH] avcodec/opus: always use ambisonic layout for mapping family 2 James Almer
@ 2022-03-20 22:09 ` Michael Niedermayer
2022-03-20 22:24 ` James Almer
0 siblings, 1 reply; 3+ messages in thread
From: Michael Niedermayer @ 2022-03-20 22:09 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 2145 bytes --]
On Thu, Mar 17, 2022 at 10:43:15PM -0300, James Almer wrote:
> No need to use a Custom layout when the non diegetic channels can be
> described as a standard mask.
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> libavcodec/opus.c | 17 +++--------------
> 1 file changed, 3 insertions(+), 14 deletions(-)
This fixes: (please mention this in the commit and dont forget to apply this patch or an equivalent one)
45684/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBOPUS_fuzzer-5039410989629440
=================================================================
==7879==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 96 byte(s) in 1 object(s) allocated from:
#0 0x497dd7 in posix_memalign /b/swarming/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/asan/asan_malloc_linux.cc:226:3
#1 0x1229708 in av_malloc libavutil/mem.c:105:9
#2 0x1229f3b in av_mallocz libavutil/mem.c:266:17
#3 0x1229f3b in av_calloc libavutil/mem.c:277
#4 0xf469c7 in ff_opus_parse_extradata libavcodec/opus.c:407:32
#5 0xbb4091 in opus_find_frame_end libavcodec/opus_parser.c:128:15
#6 0xbb4091 in opus_parse libavcodec/opus_parser.c:173
#7 0x5c0883 in av_parser_parse2 libavcodec/parser.c:164:13
#8 0x4cb83f in LLVMFuzzerTestOneInput tools/target_dec_fuzzer.c:396:27
#9 0x12a68ed in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) Fuzzer/build/../FuzzerLoop.cpp:495:13
#10 0x129b4c2 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) Fuzzer/build/../FuzzerDriver.cpp:273:6
#11 0x12a06c1 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) Fuzzer/build/../FuzzerDriver.cpp:690:9
#12 0x129b1a0 in main Fuzzer/build/../FuzzerMain.cpp:20:10
#13 0x7f79c2017c86 in __libc_start_main /build/glibc-uZu3wS/glibc-2.27/csu/../csu/libc-start.c:310
SUMMARY: AddressSanitizer: 96 byte(s) leaked in 1 allocation(s).
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avcodec/opus: always use ambisonic layout for mapping family 2
2022-03-20 22:09 ` Michael Niedermayer
@ 2022-03-20 22:24 ` James Almer
0 siblings, 0 replies; 3+ messages in thread
From: James Almer @ 2022-03-20 22:24 UTC (permalink / raw)
To: ffmpeg-devel
On 3/20/2022 7:09 PM, Michael Niedermayer wrote:
> On Thu, Mar 17, 2022 at 10:43:15PM -0300, James Almer wrote:
>> No need to use a Custom layout when the non diegetic channels can be
>> described as a standard mask.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> libavcodec/opus.c | 17 +++--------------
>> 1 file changed, 3 insertions(+), 14 deletions(-)
>
> This fixes: (please mention this in the commit and dont forget to apply this patch or an equivalent one)
Added and applied. Thanks.
>
> 45684/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBOPUS_fuzzer-5039410989629440
>
> =================================================================
> ==7879==ERROR: LeakSanitizer: detected memory leaks
>
> Direct leak of 96 byte(s) in 1 object(s) allocated from:
> #0 0x497dd7 in posix_memalign /b/swarming/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/asan/asan_malloc_linux.cc:226:3
> #1 0x1229708 in av_malloc libavutil/mem.c:105:9
> #2 0x1229f3b in av_mallocz libavutil/mem.c:266:17
> #3 0x1229f3b in av_calloc libavutil/mem.c:277
> #4 0xf469c7 in ff_opus_parse_extradata libavcodec/opus.c:407:32
> #5 0xbb4091 in opus_find_frame_end libavcodec/opus_parser.c:128:15
> #6 0xbb4091 in opus_parse libavcodec/opus_parser.c:173
> #7 0x5c0883 in av_parser_parse2 libavcodec/parser.c:164:13
> #8 0x4cb83f in LLVMFuzzerTestOneInput tools/target_dec_fuzzer.c:396:27
> #9 0x12a68ed in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) Fuzzer/build/../FuzzerLoop.cpp:495:13
> #10 0x129b4c2 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) Fuzzer/build/../FuzzerDriver.cpp:273:6
> #11 0x12a06c1 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) Fuzzer/build/../FuzzerDriver.cpp:690:9
> #12 0x129b1a0 in main Fuzzer/build/../FuzzerMain.cpp:20:10
> #13 0x7f79c2017c86 in __libc_start_main /build/glibc-uZu3wS/glibc-2.27/csu/../csu/libc-start.c:310
>
> SUMMARY: AddressSanitizer: 96 byte(s) leaked in 1 allocation(s).
>
> thx
>
> [...]
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-20 22:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-18 1:43 [FFmpeg-devel] [PATCH] avcodec/opus: always use ambisonic layout for mapping family 2 James Almer
2022-03-20 22:09 ` Michael Niedermayer
2022-03-20 22:24 ` James Almer
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git