[FFmpeg-devel] [PATCH] vorbisdec: convert to lavu/tx
This also fixes not checking the return values on transform init. Total decoder speedup on Zen 3: 9% Patch attached. >From efe3006093cd80182b293f01aa98fb75733a8188 Mon Sep 17 00:00:00 2001 From: Lynne Date: Sat, 29 Oct 2022 08:30:56 +0200 Subject: [PATCH] vorbisdec: convert to lavu/tx This also fixes not checking the return values on transform init. Total decoder speedup on Zen 3: 9% --- libavcodec/vorbisdec.c | 32 +++- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index 715a7f7d03..dd856a6dfe 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -31,12 +31,12 @@ #include "libavutil/avassert.h" #include "libavutil/float_dsp.h" +#include "libavutil/tx.h" #define BITSTREAM_READER_LE #include "avcodec.h" #include "codec_internal.h" #include "decode.h" -#include "fft.h" #include "get_bits.h" #include "vorbis.h" #include "vorbisdsp.h" @@ -130,7 +130,9 @@ typedef struct vorbis_context_s { VorbisDSPContext dsp; AVFloatDSPContext *fdsp; -FFTContext mdct[2]; +AVTXContext *mdct[2]; +av_tx_fn mdct_fn[2]; + uint8_t first_frame; int64_t initial_pts; uint32_t version; @@ -202,8 +204,8 @@ static void vorbis_free(vorbis_context *vc) av_freep(&vc->residues); av_freep(&vc->modes); -ff_mdct_end(&vc->mdct[0]); -ff_mdct_end(&vc->mdct[1]); +av_tx_uninit(&vc->mdct[0]); +av_tx_uninit(&vc->mdct[1]); if (vc->codebooks) for (i = 0; i < vc->codebook_count; ++i) { @@ -964,6 +966,8 @@ static int vorbis_parse_id_hdr(vorbis_context *vc) { GetBitContext *gb = &vc->gb; unsigned bl0, bl1; +float scale = -1.0; +int ret; if ((get_bits(gb, 8) != 'v') || (get_bits(gb, 8) != 'o') || (get_bits(gb, 8) != 'r') || (get_bits(gb, 8) != 'b') || @@ -1009,8 +1013,16 @@ static int vorbis_parse_id_hdr(vorbis_context *vc) vc->previous_window = -1; -ff_mdct_init(&vc->mdct[0], bl0, 1, -1.0); -ff_mdct_init(&vc->mdct[1], bl1, 1, -1.0); +ret = av_tx_init(&vc->mdct[0], &vc->mdct_fn[0], AV_TX_FLOAT_MDCT, 1, + vc->blocksize[0] >> 1, &scale, 0); +if (ret < 0) +return ret; + +ret = av_tx_init(&vc->mdct[1], &vc->mdct_fn[1], AV_TX_FLOAT_MDCT, 1, + vc->blocksize[1] >> 1, &scale, 0); +if (ret < 0) +return ret; + vc->fdsp = avpriv_float_dsp_alloc(vc->avctx->flags & AV_CODEC_FLAG_BITEXACT); if (!vc->fdsp) return AVERROR(ENOMEM); @@ -1585,7 +1597,8 @@ static inline int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, static int vorbis_parse_audio_packet(vorbis_context *vc, float **floor_ptr) { GetBitContext *gb = &vc->gb; -FFTContext *mdct; +AVTXContext *mdct; +av_tx_fn mdct_fn; int previous_window = vc->previous_window; unsigned mode_number, blockflag, blocksize; int i, j; @@ -1707,12 +1720,13 @@ static int vorbis_parse_audio_packet(vorbis_context *vc, float **floor_ptr) // Dotproduct, MDCT -mdct = &vc->mdct[blockflag]; +mdct = vc->mdct[blockflag]; +mdct_fn = vc->mdct_fn[blockflag]; for (j = vc->audio_channels-1;j >= 0; j--) { ch_res_ptr = vc->channel_residues + res_chan[j] * blocksize / 2; vc->fdsp->vector_fmul(floor_ptr[j], floor_ptr[j], ch_res_ptr, blocksize / 2); -mdct->imdct_half(mdct, ch_res_ptr, floor_ptr[j]); +mdct_fn(mdct, ch_res_ptr, floor_ptr[j], sizeof(float)); } // Overlap/add, save data for next overlapping -- 2.37.2.609.g9ff673ca1a ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/v210enc: add new function for avx2 avx512 avx512icl
On Fri, 28 Oct 2022 at 19:57, James Darnley wrote: > Negligible speed difference for avx2 on Zen 2 (Ryzen 5700X) and > Broadwell (Xeon E5-2620 v4): > 1690±4.3 decicycles vs. 1693±78.4 > 1439±31.1 decicycles vs 1429±16.7 > Just to avoid confusion for anyone who decides to review this over the weekend, Broadwell is in fact ~10% faster, these numbers look like a mistake. Kieran ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] aacdec: convert to lavu/tx and support fixed-point 960-sample decoding
This patch replaces the transform used in AAC with lavu/tx and removes the limitation on only being able to decode 960-sample files with the float decoder. This commit also removes a whole bunch of unnecessary and slow lifting steps the decoder did to compensate for the poor accuracy of the old integer transformation code. Overall float decoder speedup on Zen 3 for 64kbps: 32% Patch attached. Note: lavu/tx's PFA 960pt transform currently has a bug that'll get fixed by my next patchset. The naive transforms are unaffected and may be used to test 960pt fixed-point decoding. >From 95625b470fb61676e838310dc0108eb648f972a3 Mon Sep 17 00:00:00 2001 From: Lynne Date: Fri, 28 Oct 2022 21:36:10 +0200 Subject: [PATCH] aacdec: convert to lavu/tx and support fixed-point 960-sample decoding This patch replaces the transform used in AAC with lavu/tx and removes the limitation on only being able to decode 960-sample files with the float decoder. This commit also removes a whole bunch of unnecessary and slow lifting steps the decoder did to compensate for the poor accuracy of the old integer transformation code. Overall float decoder speedup on Zen 3 for 64kbps: 32% --- configure | 4 +- libavcodec/aac.h| 27 --- libavcodec/aac_defines.h| 4 +- libavcodec/aacdec.c | 4 +- libavcodec/aacdec_fixed.c | 5 +- libavcodec/aacdec_template.c| 106 ++-- libavcodec/aacsbr.c | 1 - libavcodec/aacsbr_fixed.c | 1 - libavcodec/mips/aacdec_mips.c | 4 +- libavcodec/sinewin_fixed_tablegen.c | 3 + libavcodec/sinewin_fixed_tablegen.h | 6 ++ 11 files changed, 74 insertions(+), 91 deletions(-) diff --git a/configure b/configure index 70c9e41dcc..97a7cdd7fd 100755 --- a/configure +++ b/configure @@ -2763,8 +2763,8 @@ vc1dsp_select="h264chroma qpeldsp startcode" rdft_select="fft" # decoders / encoders -aac_decoder_select="adts_header mdct15 mdct mpeg4audio sinewin" -aac_fixed_decoder_select="adts_header mdct mpeg4audio" +aac_decoder_select="adts_header mpeg4audio sinewin" +aac_fixed_decoder_select="adts_header mpeg4audio" aac_encoder_select="audio_frame_queue iirfilter lpc mdct sinewin" aac_latm_decoder_select="aac_decoder aac_latm_parser" ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct" diff --git a/libavcodec/aac.h b/libavcodec/aac.h index c8d6b17710..285d3b7482 100644 --- a/libavcodec/aac.h +++ b/libavcodec/aac.h @@ -36,11 +36,8 @@ #include "libavutil/float_dsp.h" #include "libavutil/fixed_dsp.h" #include "libavutil/mem_internal.h" +#include "libavutil/tx.h" #include "avcodec.h" -#if !USE_FIXED -#include "mdct15.h" -#endif -#include "fft.h" #include "mpeg4audio.h" #include "sbr.h" @@ -326,16 +323,24 @@ struct AACContext { * @name Computed / set up during initialization * @{ */ -FFTContext mdct; -FFTContext mdct_small; -FFTContext mdct_ld; -FFTContext mdct_ltp; +AVTXContext *mdct120; +AVTXContext *mdct128; +AVTXContext *mdct480; +AVTXContext *mdct512; +AVTXContext *mdct960; +AVTXContext *mdct1024; +AVTXContext *mdct_ltp; + +av_tx_fn mdct120_fn; +av_tx_fn mdct128_fn; +av_tx_fn mdct480_fn; +av_tx_fn mdct512_fn; +av_tx_fn mdct960_fn; +av_tx_fn mdct1024_fn; +av_tx_fn mdct_ltp_fn; #if USE_FIXED AVFixedDSPContext *fdsp; #else -MDCT15Context *mdct120; -MDCT15Context *mdct480; -MDCT15Context *mdct960; AVFloatDSPContext *fdsp; #endif /* USE_FIXED */ int random_state; diff --git a/libavcodec/aac_defines.h b/libavcodec/aac_defines.h index a3c680b65c..21063c4d58 100644 --- a/libavcodec/aac_defines.h +++ b/libavcodec/aac_defines.h @@ -45,7 +45,7 @@ typedef int AAC_SIGNE; #define Q23(a) (int)((a) * 8388608.0 + 0.5) #define Q30(x) (int)((x)*1073741824.0 + 0.5) #define Q31(x) (int)((x)*2147483648.0 + 0.5) -#define RANGE15(x) x +#define TX_SCALE(x) ((x) * 128.0f) #define GET_GAIN(x, y) (-(y) * (1 << (x))) + 1024 #define AAC_MUL16(x, y) (int)(((int64_t)(x) * (y) + 0x8000) >> 16) #define AAC_MUL26(x, y) (int)(((int64_t)(x) * (y) + 0x200) >> 26) @@ -94,7 +94,7 @@ typedef unsignedAAC_SIGNE; #define Q23(x) ((float)(x)) #define Q30(x) ((float)(x)) #define Q31(x) ((float)(x)) -#define RANGE15(x) (32768.0 * (x)) +#define TX_SCALE(x) ((x) / 32768.0f) #define GET_GAIN(x, y) powf((x), -(y)) #define AAC_MUL16(x, y) ((x) * (y)) #define AAC_MUL26(x, y) ((x) * (y)) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 2fdfd6b221..ca31540d3c 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -32,16 +32,14 @@ * @author Maxim Gavrilov ( maxim.gavrilov gmail com ) */ -#define FFT_FLOAT 1 #define USE_FIXED 0 +#define TX_TYPE AV_TX_FLOAT_MDCT #in
Re: [FFmpeg-devel] [PATCH v14 9/9] avcodec/evc: Changes in Changelog and MAINTAINERS files
Oct 27, 2022, 18:45 by mich...@niedermayer.cc: > On Tue, Oct 25, 2022 at 01:17:15PM +0200, Lynne wrote: > >> >> >> >> Oct 24, 2022, 18:29 by jamr...@gmail.com: >> >> > On 10/24/2022 12:56 PM, Lynne wrote: >> > >> >> Oct 24, 2022, 09:42 by d.kozin...@samsung.com: >> >> >> >>> - Changelog update >> >>> - MAINTAINERS update >> >>> >> >>> Signed-off-by: Dawid Kozinski >> >>> --- >> >>> Changelog | 3 ++- >> >>> MAINTAINERS | 5 + >> >>> 2 files changed, 7 insertions(+), 1 deletion(-) >> >>> >> >>> diff --git a/Changelog b/Changelog >> >>> index ec9de1bd85..19e9ae3b1f 100644 >> >>> --- a/Changelog >> >>> +++ b/Changelog >> >>> @@ -45,6 +45,8 @@ version 5.1: >> >>> - remap_opencl filter >> >>> - added chromakey_cuda filter >> >>> - added bilateral_cuda filter >> >>> +- eXtra-fast Essential Video Encoder (XEVE) >> >>> +- eXtra-fast Essential Video Decoder (XEVD) >> >>> version 5.0: >> >>> @@ -92,7 +94,6 @@ version 5.0: >> >>> - anlmf audio filter >> >>> - IMF demuxer (experimental) >> >>> - >> >>> version 4.4: >> >>> - AudioToolbox output device >> >>> - MacCaption demuxer >> >>> diff --git a/MAINTAINERS b/MAINTAINERS >> >>> index eebfa5cfb7..df8d8eca73 100644 >> >>> --- a/MAINTAINERS >> >>> +++ b/MAINTAINERS >> >>> @@ -200,6 +200,8 @@ Codecs: >> >>> libvpx* James Zern >> >>> libxavs.c Stefan Gehrer >> >>> libxavs2.cHuiwen Ren >> >>> + libxevd.c Dawid Kozinski >> >>> + libxeve.c,Dawid Kozinski >> >>> libzvbi-teletextdec.c Marton Balint >> >>> lzo.h, lzo.c Reimar Doeffinger >> >>> mdec.cMichael Niedermayer >> >>> @@ -420,6 +422,9 @@ Muxers/Demuxers: >> >>> dv.c Roman Shaposhnik >> >>> electronicarts.c Peter Ross >> >>> epafdec.c Paul B Mahol >> >>> + evc.c, evc.h Dawid Kozinski >> >>> + evcdec.c Dawid Kozinski >> >>> + evc_parser.c Dawid Kozinski >> >>> ffm* Baptiste Coudurier >> >>> flic.cMike Melanson >> >>> flvdec.c Michael Niedermayer >> >>> >> >> >> >> Nak, that list is only for those with push access, and no >> >> other changes may be made in the same patch. >> >> >> > >> > No, it's the other way around. Those in this list may be eligible for push >> > access. >> > Being listed here gives them the right to NAK a patch made for a module >> > they maintain, as well as their approval being (ideally) a requirement >> > before making changes to it. >> > >> >> Nope. Michael will give anyone on the list push access. >> > > I have the feeling you dont trust me > if thats the issue, 2 lists will not fix that > I trust you more than others. But in this case, I simply don't understand. > The idea is that each developer who takes care of a bit of the code base > (reviewing patches, approving them, fixing issues, adding features, ...) > has the same rights as others. > That is git write, the list is the MAINAINERs list. > > Its not really true that everyone in that file has write access because > some people where forgotten and never asked, some simply dont know git well > enough, some explicitly said they do not want git write, some sent a lot of > messy patches and gave me pause so i didnt offer it and they also didnt ask. > The list should be pretty close though, these are all exceptions not the rule. > The maintainers list used to be what jamrial said it was - an informal list of those with good knowledge on a piece of code to make a review, independent of whether they had push access or not. This is also how users/casual patch senders treated it as - they added their name if they felt like they would like to be consulted on. The list is always a bit outdated, and that's okay. You started treating it as a formal list of those with commit access, and it's been somewhat chaotic. Users still think it's an informal list, developers still think it's an informal list, only you seem to think it should be more formal. When a user submits a patch, I wonder if they're asking for push access or do they simply want to be consulted on for future patches? More often than not, it's the latter. I think there should be 2 lists, and if someone wants push access, they should just send a patch requesting it directly rather than using the vague maintainer term that no one pays attention to. If someone thinks they should have push access and ask, then they probably need it. The maintainers list could continue to be treated the same way it's been treated. > I fail to see the problem, btw. > A Problem would be if someoe does something that requires to remove his git > write or that requires us to think about "should we close that
Re: [FFmpeg-devel] [PATCH v9 02/25] avutil/frame: Prepare AVFrame for subtitle handling
> -Original Message- > From: ffmpeg-devel On Behalf Of > Soft Works > Sent: Tuesday, October 25, 2022 11:59 AM > To: FFmpeg development discussions and patches de...@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH v9 02/25] avutil/frame: Prepare > AVFrame for subtitle handling > > > > > -Original Message- > > From: ffmpeg-devel On Behalf Of > > Hendrik Leppkes > > Sent: Tuesday, October 25, 2022 11:38 AM > > To: FFmpeg development discussions and patches > de...@ffmpeg.org> > > Subject: Re: [FFmpeg-devel] [PATCH v9 02/25] avutil/frame: Prepare > > AVFrame for subtitle handling > > > > On Tue, Oct 25, 2022 at 11:14 AM softworkz > > wrote: > > > > > > @@ -712,6 +712,53 @@ typedef struct AVFrame { > > > * Duration of the frame, in the same units as pts. 0 if > > unknown. > > > */ > > > int64_t duration; > > > + > > > +/** > > > + * Media type of the frame (audio, video, subtitles..) > > > + * > > > + * See AVMEDIA_TYPE_xxx > > > + */ > > > +enum AVMediaType type; > > > + > > > +/** > > > + * Number of items in the @ref subtitle_areas array. > > > + */ > > > +unsigned num_subtitle_areas; > > > + > > > +/** > > > + * Array of subtitle areas, may be empty. > > > + */ > > > +AVSubtitleArea **subtitle_areas; > > > + > > > +/** > > > + * Header containing style information for text subtitles. > > > + */ > > > +AVBufferRef *subtitle_header; > > > + > > > +/** > > > + * Indicates that a subtitle frame is a repeated frame for > > arbitrating flow > > > + * in a filter graph. > > > + * The field subtitle_timing.start_pts always indicates the > > original presentation > > > + * time, while the frame's pts field may be different. > > > + */ > > > +int repeat_sub; > > > + > > > +struct SubtitleTiming > > > +{ > > > +/** > > > + * The display start time, in AV_TIME_BASE. > > > + * > > > + * For subtitle frames, AVFrame.pts is populated from > the > > packet pts value, > > > + * which is not always the same as this value. > > > + */ > > > +int64_t start_pts; > > > > There is still no explanation here why they are not the same, why > > they > > could not just be the same, and which field a user should look at. > > The cover letter talks about clarity why this is needed is > important, > > but then provides none of that. > > > > "Its required" is not an argument. So please enlighten us once > again > > why we absolutely need two timestamps for subtitles, instead of > just > > one. As far as I can see, subtitle frames only have one relevant > time > > - when its supposed to be shown on the screen. What would the other > > time ever be good for to a user? > > Similarly for the duration, of course. I can even see the > > AVFrame.duration field in this patch snippet just above the > additions > > that would seem to fully replace this one. > > > > - Hendrik > > Hi Hendrik, > > thanks a lot for your reply. > > Probably I should have better advertised the article I had written > specifically to explain the background of this: > > https://github.com/softworkz/SubtitleFilteringDemos/issues/1 @Hendrik - did that answer your question? You are also welcome to contact me directly for discussing details or going through specific examples; or just to ping me for logging on to IRC for chat. softworkz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] FFmpeg 5.0
+1 for moving it to the old downloads Best regards, Reto ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v7 0/3] 32bps FLAC patches
Op di 11 okt. 2022 om 19:24 schreef Martijn van Beurden : > > Recently libFLAC gained the ability (first released in FLAC 1.4.0) > to create FLAC files containing 32-bit int PCM samples. To > keep complexity reasonable, the choice was made to limit residuals > to 32-bit integers, which the encoder must make sure of. In case > the encoder cannot find any predictor of which the residuals fit > this limit, it must default to using a verbatim subframe. Tests have > shown that this does not happen often (<0.1% of subframes on a > music corpus of various styles). See also discussion here: > https://github.com/ietf-wg-cellar/flac-specification/pull/148 > > These two patches implement decoding and encoding following this > format. > > Changes since v1: > fix copy-paste error in encoder, several invocations of > lpc_encode_choose_datapath used wrong parameters, making FATE fail as > compression was less than it should be > > Changes since v2: > Rebased decoder part as it didn't apply anymore > > Changes since v3: > Moved put_golomb part to flacenc.c (as it is now quite specific to FLAC) > and renamed put_sbits64 to put_sbits63 (and changed assert accordingly) > > Changes since v4: > Fix check of decoded_buffer_33bps malloc. Fix reading of wasted bits > for 33bps subframe. Add fate test > > Changes since v5: > Slimmed down 32 bps fate flac test from 2 to 1 input file. Replaced > -strict -2 with -strict experimental in fate and encoder warning. > > Changes since v6: > Deduplicated function bodies with preprocessor macros in both > encoder and decoder, declared variables in loop body where possible > and changed ff_ctz to ff_ctzll where necessary > > Martijn van Beurden (3): > libavcodec/flacdec: Implement decoding of 32 bit-per-sample PCM > libavcodec/flacenc: Implement encoding of 32 bit-per-sample PCM > fate/flac: Add test of 32 bps encoding/decoding > > libavcodec/flac.c | 4 +- > libavcodec/flacdec.c| 218 -- > libavcodec/flacenc.c| 480 +++- > libavcodec/get_bits.h | 12 + > libavcodec/mathops.h| 9 + > libavcodec/put_bits.h | 7 + > libavcodec/put_golomb.h | 14 -- > tests/fate/flac.mak | 4 + > 8 files changed, 602 insertions(+), 146 deletions(-) > Hi all, With this email, I would like to renew the attention of the mailing list for these patches. Kind regards, Martijn van Beurden ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] FFmpeg 5.0
On 28.10.2022 20:23, Michael Niedermayer wrote: Hi According to our https://trac.ffmpeg.org/wiki/Downstreams Noone and nothing is using 5.0 should i make another release of 5.0 ? should i move 5.0 to olddownloads ? does anyone use it ? plan to use it or know of someone using it ? thx I see no reason to keep maintaining it, specially given we had no ABI bump since then. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec/v210enc: add new function for avx2 avx512 avx512icl
Negligible speed difference for avx2 on Zen 2 (Ryzen 5700X) and Broadwell (Xeon E5-2620 v4): 1690±4.3 decicycles vs. 1693±78.4 1439±31.1 decicycles vs 1429±16.7 Moderate speedup with avx512 on Skylake-X (Xeon D-2123IT): 1.22x faster (793±0.8 vs. 649±5.5 decicycles) compared with avx2 Better speedup with avx512icl on Ice Lake (Xeon Silver 4316): 1.77x faster (784±1.8 vs. 442±11.6 decicycles) compared with avx2 Co-authors: Henrik Gramner Kieran Kunhya --- libavcodec/x86/v210enc.asm| 80 ++- libavcodec/x86/v210enc_init.c | 14 ++ 2 files changed, 92 insertions(+), 2 deletions(-) diff --git a/libavcodec/x86/v210enc.asm b/libavcodec/x86/v210enc.asm index 965f2bea3c..afac238ede 100644 --- a/libavcodec/x86/v210enc.asm +++ b/libavcodec/x86/v210enc.asm @@ -21,7 +21,7 @@ %include "libavutil/x86/x86util.asm" -SECTION_RODATA 32 +SECTION_RODATA 64 cextern pw_4 %define v210_enc_min_10 pw_4 @@ -46,6 +46,16 @@ v210_enc_chroma_shuf2_8: times 2 db 3,-1,4,-1,5,-1,7,-1,11,-1,12,-1,13,-1,15,-1 v210_enc_chroma_mult_8: times 2 dw 4,16,64,0,64,4,16,0 +v210enc_8_permb: db 32, 0,48,-1 , 1,33, 2,-1 , 49, 3,34,-1 , 4,50, 5,-1 + db 35, 6,51,-1 , 7,36, 8,-1 , 52, 9,37,-1 , 10,53,11,-1 + db 38,12,54,-1 , 13,39,14,-1 , 55,15,40,-1 , 16,56,17,-1 + db 41,18,57,-1 , 19,42,20,-1 , 58,21,43,-1 , 22,59,23,-1 +v210enc_8_shufb: db 0, 8, 1,-1 , 9, 2,10,-1 , 3,11, 4,-1 , 12, 5,13,-1 + db 2,10, 3,-1 , 11, 4,12,-1 , 5,13, 6,-1 , 14, 7,15,-1 +v210enc_8_permd: dd 0,1,4,5, 1,2,5,6 +v210enc_8_mult: db 4, 0, 64, 0 +v210enc_8_mask: dd 255<<12 + SECTION .text %macro v210_planar_pack_10 0 @@ -178,7 +188,73 @@ INIT_XMM avx v210_planar_pack_8 %endif +%macro v210_planar_pack_8_new 0 + +cglobal v210_planar_pack_8, 5, 5, 7+notcpuflag(avx512icl), y, u, v, dst, width +add yq, widthq +shr widthq, 1 +add uq, widthq +add vq, widthq +neg widthq + +%if cpuflag(avx512icl) +mova m2, [v210enc_8_permb] +%else +mova m2, [v210enc_8_permd] +%endif +vpbroadcastd m3, [v210enc_8_mult] +VBROADCASTI128 m4, [v210_enc_min_8] ; only ymm sized +VBROADCASTI128 m5, [v210_enc_max_8] ; only ymm sized +vpbroadcastd m6, [v210enc_8_mask] +%if notcpuflag(avx512icl) +movu m7, [v210enc_8_shufb] +%endif + +.loop: +%if cpuflag(avx512icl) +movu ym1, [yq + 2*widthq] +vinserti32x4 m1, [uq + 1*widthq], 2 +vinserti32x4 m1, [vq + 1*widthq], 3 +vpermbm1, m2, m1 ; uyv0 yuy0 vyu0 yvy0 +%else +movq xm0, [uq + 1*widthq]; uuxx +movq xm1, [vq + 1*widthq]; vvxx +punpcklbwxm1, xm0, xm1 ; uvuv uvuv uvuv +vinserti128 m1, m1, [yq + 2*widthq], 1 ; uvuv uvuv uvuv +vpermdm1, m2, m1 ; uvuv uvxx yyxx xxuv uvuv xxyy +pshufbm1, m7 ; uyv0 yuy0 vyu0 yvy0 +%endif +CLIPUB m1, m4, m5 + +pmaddubsw m0, m1, m3 +pslld m1, 4 +%if cpuflag(avx512) +vpternlogd m0, m1, m6, 0xd8 ; C?B:A +%else +pand m1, m6, m1 +pandn m0, m6, m0 +porm0, m0, m1 +%endif + +movu [dstq], m0 +add dstq, mmsize +add widthq, (mmsize*3)/16 +jl .loop +RET + +%endmacro + %if HAVE_AVX2_EXTERNAL INIT_YMM avx2 -v210_planar_pack_8 +v210_planar_pack_8_new +%endif + +%if HAVE_AVX512_EXTERNAL +INIT_YMM avx512 +v210_planar_pack_8_new +%endif + +%if HAVE_AVX512ICL_EXTERNAL +INIT_ZMM avx512icl +v210_planar_pack_8_new %endif diff --git a/libavcodec/x86/v210enc_init.c b/libavcodec/x86/v210enc_init.c index 13a351dd1d..6e9f8c6e61 100644 --- a/libavcodec/x86/v210enc_init.c +++ b/libavcodec/x86/v210enc_init.c @@ -27,6 +27,10 @@ void ff_v210_planar_pack_8_avx(const uint8_t *y, const uint8_t *u, const uint8_t *v, uint8_t *dst, ptrdiff_t width); void ff_v210_planar_pack_8_avx2(const uint8_t *y, const uint8_t *u, const uint8_t *v, uint8_t *dst, ptrdiff_t width); +void ff_v210_planar_pack_8_avx512(const uint8_t *y, const uint8_t *u, +const uint8_t *v, uint8_t *dst, ptrdiff_t width); +void ff_v210_planar_pack_8_avx512icl(const uint8_t *y, const uint8_t *u, +const uint8_t *v, uint8_t *dst, ptrdiff_t width); void ff_v210_planar_pack_10_ssse3(const uint16_t *y, const uint16_t *u, const uint16_t *v, uint8_t *dst, ptrdiff_t width); @@ -52,4 +56,14 @@ av_cold void ff_v210enc_init_x86(V210EncContext *s) s->sample_factor_10 = 2;
[FFmpeg-devel] [PATCH] checkasm: add a verbose check function for uint32_t data
--- tests/checkasm/checkasm.c | 1 + tests/checkasm/checkasm.h | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 421bd096c5..c3d77cb6af 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -918,5 +918,6 @@ int checkasm_check_##type(const char *const file, const int line, \ DEF_CHECKASM_CHECK_FUNC(uint8_t, "%02x") DEF_CHECKASM_CHECK_FUNC(uint16_t, "%04x") +DEF_CHECKASM_CHECK_FUNC(uint32_t, "%08x") DEF_CHECKASM_CHECK_FUNC(int16_t, "%6d") DEF_CHECKASM_CHECK_FUNC(int32_t, "%9d") diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index ee9151410e..5f68115035 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -296,6 +296,7 @@ int checkasm_check_##type(const char *const file, const int line, \ DECL_CHECKASM_CHECK_FUNC(uint8_t); DECL_CHECKASM_CHECK_FUNC(uint16_t); +DECL_CHECKASM_CHECK_FUNC(uint32_t); DECL_CHECKASM_CHECK_FUNC(int16_t); DECL_CHECKASM_CHECK_FUNC(int32_t); -- 2.38.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2 1/3] avformat/imfdec: use CPL start timecode if available
Hi Zane et al., Quick ping on the revised patchset below. It addresses https://trac.ffmpeg.org/ticket/9842. Best, -- Pierre On Sun, Oct 2, 2022 at 9:28 AM wrote: > > From: Pierre-Anthony Lemieux > > The IMF CPL contains an optional timecode start address. This patch reads the > latter, if present, into the context's timecode metadata parameter. > This addresses https://trac.ffmpeg.org/ticket/9842. > > --- > libavformat/imf.h | 2 + > libavformat/imf_cpl.c | 106 ++ > libavformat/imfdec.c | 11 + > 3 files changed, 119 insertions(+) > > diff --git a/libavformat/imf.h b/libavformat/imf.h > index 4271cd9582..70ed007312 100644 > --- a/libavformat/imf.h > +++ b/libavformat/imf.h > @@ -59,6 +59,7 @@ > #include "libavformat/avio.h" > #include "libavutil/rational.h" > #include "libavutil/uuid.h" > +#include "libavutil/timecode.h" > #include > > /** > @@ -130,6 +131,7 @@ typedef struct FFIMFCPL { > AVUUID id_uuid; /**< > CompositionPlaylist/Id element */ > xmlChar *content_title_utf8; /**< > CompositionPlaylist/ContentTitle element */ > AVRational edit_rate;/**< > CompositionPlaylist/EditRate element */ > +AVTimecode *tc; /**< > CompositionPlaylist/CompositionTimecode element */ > FFIMFMarkerVirtualTrack *main_markers_track; /**< Main Marker > Virtual Track */ > FFIMFTrackFileVirtualTrack *main_image_2d_track; /**< Main Image Virtual > Track */ > uint32_t main_audio_track_count; /**< Number of Main > Audio Virtual Tracks */ > diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c > index 474db6b7f5..183e6dd84e 100644 > --- a/libavformat/imf_cpl.c > +++ b/libavformat/imf_cpl.c > @@ -116,6 +116,22 @@ int ff_imf_xml_read_uint32(xmlNodePtr element, uint32_t > *number) > return ret; > } > > +static int ff_imf_xml_read_boolean(xmlNodePtr element, int *value) > +{ > +int ret = 0; > + > +xmlChar *element_text = xmlNodeListGetString(element->doc, > element->xmlChildrenNode, 1); > +if (xmlStrcmp(element_text, "true") == 0 || xmlStrcmp(element_text, "1") > == 0) > +*value = 1; > +else if (xmlStrcmp(element_text, "false") == 0 || > xmlStrcmp(element_text, "0") == 0) > +*value = 0; > +else > +ret = 1; > +xmlFree(element_text); > + > +return ret; > +} > + > static void imf_base_virtual_track_init(FFIMFBaseVirtualTrack *track) > { > memset(track->id_uuid, 0, sizeof(track->id_uuid)); > @@ -179,6 +195,90 @@ static int fill_content_title(xmlNodePtr cpl_element, > FFIMFCPL *cpl) > return 0; > } > > +static int digit_to_int(char digit) > +{ > +if (digit >= '0' && digit <= '9') > +return digit - '0'; > +return -1; > +} > + > +/** > + * Parses a string that conform to the TimecodeType used in IMF CPL and > defined > + * in SMPTE ST 2067-3. > + * @param[in] s string to parse > + * @param[out] tc_comps pointer to an array of 4 integers where the parsed > HH, > + * MM, SS and FF fields of the timecode are returned. > + * @return 0 on success, < 0 AVERROR code on error. > + */ > +static int parse_cpl_tc_type(const char *s, int *tc_comps) > +{ > +if (av_strnlen(s, 11) != 11) > +return AVERROR(EINVAL); > + > +for (int i = 0; i < 4; i++) { > +int hi; > +int lo; > + > +hi = digit_to_int(s[i * 3]); > +lo = digit_to_int(s[i * 3 + 1]); > + > +if (hi == -1 || lo == -1) > +return AVERROR(EINVAL); > + > +tc_comps[i] = 10 * hi + lo; > +} > + > +return 0; > +} > + > +static int fill_timecode(xmlNodePtr cpl_element, FFIMFCPL *cpl) > +{ > +xmlNodePtr tc_element = NULL; > +xmlNodePtr element = NULL; > +xmlChar *tc_str = NULL; > +int df = 0; > +int comps[4]; > +int ret = 0; > + > +tc_element = ff_imf_xml_get_child_element_by_name(cpl_element, > "CompositionTimecode"); > +if (!tc_element) > + return 0; > + > +element = ff_imf_xml_get_child_element_by_name(tc_element, > "TimecodeDropFrame"); > +if (!element) { > +av_log(NULL, AV_LOG_ERROR, "CompositionTimecode element is missing\ > +a TimecodeDropFrame child element\n"); > +return AVERROR_INVALIDDATA; > +} > + > +if (ff_imf_xml_read_boolean(element, &df)) { > +av_log(NULL, AV_LOG_ERROR, "TimecodeDropFrame element is invalid\n"); > +return AVERROR_INVALIDDATA; > +} > +element = ff_imf_xml_get_child_element_by_name(tc_element, > "TimecodeStartAddress"); > +if (!element) { > +av_log(NULL, AV_LOG_ERROR, "CompositionTimecode element is missing\ > +a TimecodeStartAddress child element\n"); > +return AVERROR_INVALIDDATA; > +} > + > +tc_str = xmlNodeListGetString(element->doc, element->xmlC
[FFmpeg-devel] [PATCH] avutil/tests/cpu: print the avx512icl flag
--- libavutil/tests/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavutil/tests/cpu.c b/libavutil/tests/cpu.c index 5bec742b2b..dadadb31dc 100644 --- a/libavutil/tests/cpu.c +++ b/libavutil/tests/cpu.c @@ -77,6 +77,7 @@ static const struct { { AV_CPU_FLAG_BMI2, "bmi2" }, { AV_CPU_FLAG_AESNI, "aesni" }, { AV_CPU_FLAG_AVX512,"avx512" }, +{ AV_CPU_FLAG_AVX512ICL, "avx512icl" }, { AV_CPU_FLAG_SLOW_GATHER, "slowgather" }, #elif ARCH_LOONGARCH { AV_CPU_FLAG_LSX, "lsx"}, -- 2.38.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] mailmap: stop git lying about who I commit things as
--- .mailmap | 1 - 1 file changed, 1 deletion(-) diff --git a/.mailmap b/.mailmap index ba072f38c8..af60290f77 100644 --- a/.mailmap +++ b/.mailmap @@ -1,4 +1,3 @@ - -- 2.38.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 6/6] avcodec/vc1data: Mark tables as hidden
This e.g. allows compilers to bake the offset implied by using ff_vc1_b_field_mvpred_scales[3] into the general offset; for certain arches this is also necessary in order to avoid building suboptimal code. Signed-off-by: Andreas Rheinhardt --- libavcodec/vc1data.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/vc1data.h b/libavcodec/vc1data.h index 90dd8baf61..3512dc169b 100644 --- a/libavcodec/vc1data.h +++ b/libavcodec/vc1data.h @@ -30,10 +30,12 @@ #include +#include "libavutil/attributes_internal.h" #include "libavutil/rational.h" #include "vlc.h" +FF_VISIBILITY_PUSH_HIDDEN /** Table for conversion between TTBLK and TTMB */ extern const int ff_vc1_ttblk_to_tt[3][8]; @@ -204,5 +206,6 @@ extern const uint16_t ff_vc1_b_field_mvpred_scales[7][4]; #define AC_MODES 8 extern const int ff_vc1_ac_sizes[AC_MODES]; +FF_VISIBILITY_POP_HIDDEN #endif /* AVCODEC_VC1DATA_H */ -- 2.34.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 5/6] avcodec/rv34: Remove always-true/false checks
low_delay is always zero for rv34. Signed-off-by: Andreas Rheinhardt --- libavcodec/rv34.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index acf77d103d..be188edc47 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -1568,7 +1568,7 @@ static int finish_frame(AVCodecContext *avctx, AVFrame *pict) if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0); -if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { +if (s->pict_type == AV_PICTURE_TYPE_B) { if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->current_picture_ptr, pict); @@ -1613,7 +1613,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict, /* no supplementary picture */ if (buf_size == 0) { /* special case for last picture */ -if (s->low_delay==0 && s->next_picture_ptr) { +if (s->next_picture_ptr) { if ((ret = av_frame_ref(pict, s->next_picture_ptr->f)) < 0) return ret; s->next_picture_ptr = NULL; -- 2.34.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/6] avcodec/flvdec, intelh263dec: Remove redundant assignments
ff_mpeg1_dc_scale_table is the default value for [yc]_dc_scale_table (as set by ff_mpv_common_defaults()). Signed-off-by: Andreas Rheinhardt --- libavcodec/flvdec.c | 2 -- libavcodec/intelh263dec.c | 3 --- 2 files changed, 5 deletions(-) diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c index 87c5e923ea..09fefd3d1c 100644 --- a/libavcodec/flvdec.c +++ b/libavcodec/flvdec.c @@ -108,8 +108,6 @@ int ff_flv_decode_picture_header(MpegEncContext *s) s->h263_flv - 1, s->qscale, s->picture_number); } -s->y_dc_scale_table = s->c_dc_scale_table = ff_mpeg1_dc_scale_table; - return 0; } diff --git a/libavcodec/intelh263dec.c b/libavcodec/intelh263dec.c index 453b93f16c..2c216b00a6 100644 --- a/libavcodec/intelh263dec.c +++ b/libavcodec/intelh263dec.c @@ -122,9 +122,6 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s) return AVERROR_INVALIDDATA; s->f_code = 1; -s->y_dc_scale_table= -s->c_dc_scale_table= ff_mpeg1_dc_scale_table; - ff_h263_show_pict_info(s); return 0; -- 2.34.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/6] avcodec/mpegvideodata: Mark tables as hidden
This e.g. allows compilers to bake the offset implied by using ff_mpeg12_dc_scale_table[3] (as the SpeedHQ encoder does) into the general offset; for certain arches this is also necessary in order to avoid building suboptimal code. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideodata.h | 4 1 file changed, 4 insertions(+) diff --git a/libavcodec/mpegvideodata.h b/libavcodec/mpegvideodata.h index 7264b434ae..42c9d6c293 100644 --- a/libavcodec/mpegvideodata.h +++ b/libavcodec/mpegvideodata.h @@ -21,6 +21,9 @@ #include +#include "libavutil/attributes_internal.h" + +FF_VISIBILITY_PUSH_HIDDEN /* encoding scans */ extern const uint8_t ff_alternate_horizontal_scan[64]; extern const uint8_t ff_alternate_vertical_scan[64]; @@ -31,5 +34,6 @@ static const uint8_t *const ff_mpeg1_dc_scale_table = ff_mpeg12_dc_scale_table[0 extern const uint8_t ff_mpeg2_non_linear_qscale[32]; extern const uint8_t ff_default_chroma_qscale_table[32]; +FF_VISIBILITY_POP_HIDDEN #endif /* AVCODEC_MPEGVIDEODATA_H */ -- 2.34.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/6] avcodec/mpegvideodata: Join mpeg1/2 dc scale tables
Avoids relocations. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12enc.c | 2 +- libavcodec/mpegvideo_enc.c | 4 ++-- libavcodec/mpegvideodata.c | 26 +- libavcodec/mpegvideodata.h | 4 ++-- libavcodec/speedhqenc.c| 2 +- 5 files changed, 15 insertions(+), 23 deletions(-) diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 2db1d93d0e..3ad1cd84a1 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -1148,7 +1148,7 @@ av_cold void ff_mpeg1_encode_init(MpegEncContext *s) static AVOnce init_static_once = AV_ONCE_INIT; s->y_dc_scale_table = -s->c_dc_scale_table = ff_mpeg2_dc_scale_table[s->intra_dc_precision]; +s->c_dc_scale_table = ff_mpeg12_dc_scale_table[s->intra_dc_precision]; s->me.mv_penalty = mv_penalty; s->fcode_tab = fcode_tab; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index ce363a585d..46be4aad26 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -3736,9 +3736,9 @@ static int encode_picture(MpegEncContext *s, int picture_number) s-> intra_matrix[j] = av_clip_uint8(( luma_matrix[i] * s->qscale) >> 3); } s->y_dc_scale_table= -s->c_dc_scale_table= ff_mpeg2_dc_scale_table[s->intra_dc_precision]; +s->c_dc_scale_table = ff_mpeg12_dc_scale_table[s->intra_dc_precision]; s->chroma_intra_matrix[0] = -s->intra_matrix[0] = ff_mpeg2_dc_scale_table[s->intra_dc_precision][8]; +s->intra_matrix[0] = ff_mpeg12_dc_scale_table[s->intra_dc_precision][8]; ff_convert_matrix(s, s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, s->intra_quant_bias, 8, 8, 1); ff_convert_matrix(s, s->q_chroma_intra_matrix, s->q_chroma_intra_matrix16, diff --git a/libavcodec/mpegvideodata.c b/libavcodec/mpegvideodata.c index b98e90cf43..68ad84276e 100644 --- a/libavcodec/mpegvideodata.c +++ b/libavcodec/mpegvideodata.c @@ -30,31 +30,23 @@ const uint8_t ff_mpeg2_non_linear_qscale[32] = { 56, 64, 72, 80, 88, 96, 104, 112, }; -const uint8_t ff_mpeg1_dc_scale_table[32] = { +const uint8_t ff_mpeg12_dc_scale_table[4][32] = { +{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -}; - -static const uint8_t mpeg2_dc_scale_table1[32] = { +}, +{ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, -}; - -static const uint8_t mpeg2_dc_scale_table2[32] = { +}, +{ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -}; - -static const uint8_t mpeg2_dc_scale_table3[32] = { +}, +{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -}; - -const uint8_t *const ff_mpeg2_dc_scale_table[4] = { -ff_mpeg1_dc_scale_table, -mpeg2_dc_scale_table1, -mpeg2_dc_scale_table2, -mpeg2_dc_scale_table3, +}, }; const uint8_t ff_alternate_horizontal_scan[64] = { diff --git a/libavcodec/mpegvideodata.h b/libavcodec/mpegvideodata.h index cf783ef31c..7264b434ae 100644 --- a/libavcodec/mpegvideodata.h +++ b/libavcodec/mpegvideodata.h @@ -25,8 +25,8 @@ extern const uint8_t ff_alternate_horizontal_scan[64]; extern const uint8_t ff_alternate_vertical_scan[64]; -extern const uint8_t ff_mpeg1_dc_scale_table[32]; -extern const uint8_t * const ff_mpeg2_dc_scale_table[4]; +extern const uint8_t ff_mpeg12_dc_scale_table[4][32]; +static const uint8_t *const ff_mpeg1_dc_scale_table = ff_mpeg12_dc_scale_table[0]; extern const uint8_t ff_mpeg2_non_linear_qscale[32]; diff --git a/libavcodec/speedhqenc.c b/libavcodec/speedhqenc.c index 65e66afae4..7269e345d3 100644 --- a/libavcodec/speedhqenc.c +++ b/libavcodec/speedhqenc.c @@ -115,7 +115,7 @@ av_cold int ff_speedhq_encode_init(MpegEncContext *s) s->intra_chroma_ac_vlc_last_length = uni_speedhq_ac_vlc_len; s->y_dc_scale_table = -s->c_dc_scale_table = ff_mpeg2_dc_scale_table[3]; +s->c_dc_scale_table = ff_mpeg12_dc_scale_table[3]; switch (s->avctx->pix_fmt) { case AV_PIX_FMT_YUV420P: -- 2.34.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/6] avcodec/mpegvideodata: Make DC scale tables smaller
These tables are only accessed in ff_set_qscale() which only accesses values 1..31 as well as in encode_picture() in mpegvideo_enc.c, accessing the value with index 8. So make these tables smaller. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideodata.c | 32 libavcodec/mpegvideodata.h | 2 +- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/libavcodec/mpegvideodata.c b/libavcodec/mpegvideodata.c index da0638e052..b98e90cf43 100644 --- a/libavcodec/mpegvideodata.c +++ b/libavcodec/mpegvideodata.c @@ -30,46 +30,22 @@ const uint8_t ff_mpeg2_non_linear_qscale[32] = { 56, 64, 72, 80, 88, 96, 104, 112, }; -const uint8_t ff_mpeg1_dc_scale_table[128] = { -8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, +const uint8_t ff_mpeg1_dc_scale_table[32] = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; -static const uint8_t mpeg2_dc_scale_table1[128] = { -4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, -4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, -4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, -4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, -4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, -4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +static const uint8_t mpeg2_dc_scale_table1[32] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, }; -static const uint8_t mpeg2_dc_scale_table2[128] = { -2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +static const uint8_t mpeg2_dc_scale_table2[32] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; -static const uint8_t mpeg2_dc_scale_table3[128] = { -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +static const uint8_t mpeg2_dc_scale_table3[32] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; diff --git a/libavcodec/mpegvideodata.h b/libavcodec/mpegvideodata.h index 14f4806d66..cf783ef31c 100644 --- a/libavcodec/mpegvideodata.h +++ b/libavcodec/mpegvideodata.h @@ -25,7 +25,7 @@ extern const uint8_t ff_alternate_horizontal_scan[64]; extern const uint8_t ff_alternate_vertical_scan[64]; -extern const uint8_t ff_mpeg1_dc_scale_table[128]; +extern const uint8_t ff_mpeg1_dc_scale_table[32]; extern const uint8_t * const ff_mpeg2_dc_scale_table[4]; extern const uint8_t ff_mpeg2_non_linear_qscale[32]; -- 2.34.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-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/7] avcodec/mpegvideo: Don't overallocate buffer
Andreas Rheinhardt: > Only encoders need two sets of int16_t [12][64] > (one to save the current best state and one for the current > working state); decoders need only one. This saves 1.5KiB > per slice context for a decoder. > > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/mpegvideo.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c > index 697438fa6f..0cd7c86ff6 100644 > --- a/libavcodec/mpegvideo.c > +++ b/libavcodec/mpegvideo.c > @@ -382,7 +382,7 @@ static int init_duplicate_context(MpegEncContext *s) > return AVERROR(ENOMEM); > } > } > -if (!FF_ALLOCZ_TYPED_ARRAY(s->blocks, 2)) > +if (!FF_ALLOCZ_TYPED_ARRAY(s->blocks, 1 + s->encoding)) > return AVERROR(ENOMEM); > s->block = s->blocks[0]; > Will apply the rest of this patchset tomorrow unless there are objections. - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/4 v2] avcodec/aacdec: add support for channel configuration 14
On 10/28/2022 9:50 AM, Andreas Rheinhardt wrote: James Almer: On 10/28/2022 9:31 AM, Andreas Rheinhardt wrote: James Almer: It corresponds to the 7.1(top) layout. Signed-off-by: James Almer --- libavcodec/aacdec_template.c | 23 ++- libavcodec/aacdectab.h | 6 +++--- libavcodec/mpeg4audio.c | 5 +++-- libavcodec/mpeg4audio.h | 2 +- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index c10bc743b6..4b8e29ba71 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -404,6 +404,21 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) i++; } + // The previous checks would end up at 4 at this point for chan_config 14 + if (layout == AV_CH_LAYOUT_5POINT1 && tags == 5 && i == 4) { + const uint8_t (*reference_layout_map)[3] = aac_channel_layout_map[13]; + for (int j = 0; j < tags; j++) { + if (layout_map[j][0] != reference_layout_map[j][0] || + layout_map[j][2] != reference_layout_map[j][2]) + goto end_of_layout_definition; + } + + i += assign_pair(e2c_vec, layout_map, i, + AV_CH_TOP_FRONT_LEFT, + AV_CH_TOP_FRONT_RIGHT, + AAC_CHANNEL_FRONT, + &layout); + } // The previous checks would end up at 8 at this point for 22.2 if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) { const uint8_t (*reference_layout_map)[3] = aac_channel_layout_map[12]; @@ -633,7 +648,7 @@ static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx, int channel_config) { if (channel_config < 1 || (channel_config > 7 && channel_config < 11) || - channel_config > 13) { + channel_config > 14) { av_log(avctx, AV_LOG_ERROR, "invalid default channel configuration (%d)\n", channel_config); @@ -717,6 +732,12 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id) /* For indexed channel configurations map the channels solely based * on position. */ switch (ac->oc[1].m4ac.chan_config) { + case 14: + if (ac->tags_mapped > 2 && ((type == TYPE_CPE && elem_id < 3) || + (type == TYPE_LFE && elem_id < 1))) { + ac->tags_mapped++; + return ac->tag_che_map[type][elem_id] = ac->che[type][elem_id]; + } case 13: if (ac->tags_mapped > 3 && ((type == TYPE_CPE && elem_id < 8) || (type == TYPE_SCE && elem_id < 6) || diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h index b820f10556..e9bbd1fe13 100644 --- a/libavcodec/aacdectab.h +++ b/libavcodec/aacdectab.h @@ -68,8 +68,8 @@ static const uint8_t aac_channel_layout_map[16][16][3] = { { TYPE_SCE, 5, AAC_CHANNEL_FRONT }, // SCE6 = BtFC, { TYPE_CPE, 7, AAC_CHANNEL_FRONT }, // CPE8 = BtFL and BtFR }, + { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_SIDE }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, { TYPE_CPE, 2, AAC_CHANNEL_FRONT }, }, { { 0, } }, - /* TODO: Add 7+1 TOP configuration */ }; #if FF_API_OLD_CHANNEL_LAYOUT @@ -84,8 +84,8 @@ static const uint64_t aac_channel_layout[] = { AV_CH_LAYOUT_6POINT1, AV_CH_LAYOUT_7POINT1, AV_CH_LAYOUT_22POINT2, + AV_CH_LAYOUT_7POINT1_TOP, 0, - /* AV_CH_LAYOUT_7POINT1_TOP, */ }; #endif @@ -100,8 +100,8 @@ static const AVChannelLayout aac_ch_layout[] = { AV_CHANNEL_LAYOUT_6POINT1, AV_CHANNEL_LAYOUT_7POINT1, AV_CHANNEL_LAYOUT_22POINT2, + AV_CHANNEL_LAYOUT_7POINT1_TOP, { 0 }, - /* AV_CHANNEL_LAYOUT_7POINT1_TOP, */ }; #endif /* AVCODEC_AACDECTAB_H */ diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c index e38a8c0852..4a996411d1 100644 --- a/libavcodec/mpeg4audio.c +++ b/libavcodec/mpeg4audio.c @@ -56,7 +56,7 @@ static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c, void *logctx return 0; } -const uint8_t ff_mpeg4audio_channels[14] = { +const uint8_t ff_mpeg4audio_channels[15] = { 0, 1, // mono (1/0) 2, // stereo (2/0) @@ -70,7 +70,8 @@ const uint8_t ff_mpeg4audio_channels[14] = { 0, 7, // 3/3.1 8, // 3/2/2.1 - 24 // 3/3/3 - 5/2/3 - 3/0/0.2 + 24, // 3/3/3 - 5/2/3 - 3/0/0.2 + 8 // 3/2.1 - 2/0 Is it guaranteed that 8 will always be the last element of this array? If not, you should use "8,", so that the comma won't have to be added when someone makes an addition in the future. What does the pedantic gcc option say about this? I recall it complained about either having or missing the comma in the last element, so given that it
Re: [FFmpeg-devel] [PATCH 3/4 v2] avcodec/aacdec: add support for channel configuration 14
James Almer: > On 10/28/2022 9:31 AM, Andreas Rheinhardt wrote: >> James Almer: >>> It corresponds to the 7.1(top) layout. >>> >>> Signed-off-by: James Almer >>> --- >>> libavcodec/aacdec_template.c | 23 ++- >>> libavcodec/aacdectab.h | 6 +++--- >>> libavcodec/mpeg4audio.c | 5 +++-- >>> libavcodec/mpeg4audio.h | 2 +- >>> 4 files changed, 29 insertions(+), 7 deletions(-) >>> >>> diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c >>> index c10bc743b6..4b8e29ba71 100644 >>> --- a/libavcodec/aacdec_template.c >>> +++ b/libavcodec/aacdec_template.c >>> @@ -404,6 +404,21 @@ static uint64_t sniff_channel_order(uint8_t >>> (*layout_map)[3], int tags) >>> i++; >>> } >>> + // The previous checks would end up at 4 at this point for >>> chan_config 14 >>> + if (layout == AV_CH_LAYOUT_5POINT1 && tags == 5 && i == 4) { >>> + const uint8_t (*reference_layout_map)[3] = >>> aac_channel_layout_map[13]; >>> + for (int j = 0; j < tags; j++) { >>> + if (layout_map[j][0] != reference_layout_map[j][0] || >>> + layout_map[j][2] != reference_layout_map[j][2]) >>> + goto end_of_layout_definition; >>> + } >>> + >>> + i += assign_pair(e2c_vec, layout_map, i, >>> + AV_CH_TOP_FRONT_LEFT, >>> + AV_CH_TOP_FRONT_RIGHT, >>> + AAC_CHANNEL_FRONT, >>> + &layout); >>> + } >>> // The previous checks would end up at 8 at this point for 22.2 >>> if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) { >>> const uint8_t (*reference_layout_map)[3] = >>> aac_channel_layout_map[12]; >>> @@ -633,7 +648,7 @@ static int set_default_channel_config(AACContext >>> *ac, AVCodecContext *avctx, >>> int channel_config) >>> { >>> if (channel_config < 1 || (channel_config > 7 && channel_config >>> < 11) || >>> - channel_config > 13) { >>> + channel_config > 14) { >>> av_log(avctx, AV_LOG_ERROR, >>> "invalid default channel configuration (%d)\n", >>> channel_config); >>> @@ -717,6 +732,12 @@ static ChannelElement *get_che(AACContext *ac, >>> int type, int elem_id) >>> /* For indexed channel configurations map the channels solely >>> based >>> * on position. */ >>> switch (ac->oc[1].m4ac.chan_config) { >>> + case 14: >>> + if (ac->tags_mapped > 2 && ((type == TYPE_CPE && elem_id < >>> 3) || >>> + (type == TYPE_LFE && elem_id < >>> 1))) { >>> + ac->tags_mapped++; >>> + return ac->tag_che_map[type][elem_id] = >>> ac->che[type][elem_id]; >>> + } >>> case 13: >>> if (ac->tags_mapped > 3 && ((type == TYPE_CPE && elem_id < >>> 8) || >>> (type == TYPE_SCE && elem_id < >>> 6) || >>> diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h >>> index b820f10556..e9bbd1fe13 100644 >>> --- a/libavcodec/aacdectab.h >>> +++ b/libavcodec/aacdectab.h >>> @@ -68,8 +68,8 @@ static const uint8_t >>> aac_channel_layout_map[16][16][3] = { >>> { TYPE_SCE, 5, AAC_CHANNEL_FRONT }, // SCE6 = BtFC, >>> { TYPE_CPE, 7, AAC_CHANNEL_FRONT }, // CPE8 = BtFL and BtFR >>> }, >>> + { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, >>> AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_SIDE }, { TYPE_LFE, >>> 0, AAC_CHANNEL_LFE }, { TYPE_CPE, 2, AAC_CHANNEL_FRONT }, }, >>> { { 0, } }, >>> - /* TODO: Add 7+1 TOP configuration */ >>> }; >>> #if FF_API_OLD_CHANNEL_LAYOUT >>> @@ -84,8 +84,8 @@ static const uint64_t aac_channel_layout[] = { >>> AV_CH_LAYOUT_6POINT1, >>> AV_CH_LAYOUT_7POINT1, >>> AV_CH_LAYOUT_22POINT2, >>> + AV_CH_LAYOUT_7POINT1_TOP, >>> 0, >>> - /* AV_CH_LAYOUT_7POINT1_TOP, */ >>> }; >>> #endif >>> @@ -100,8 +100,8 @@ static const AVChannelLayout aac_ch_layout[] = { >>> AV_CHANNEL_LAYOUT_6POINT1, >>> AV_CHANNEL_LAYOUT_7POINT1, >>> AV_CHANNEL_LAYOUT_22POINT2, >>> + AV_CHANNEL_LAYOUT_7POINT1_TOP, >>> { 0 }, >>> - /* AV_CHANNEL_LAYOUT_7POINT1_TOP, */ >>> }; >>> #endif /* AVCODEC_AACDECTAB_H */ >>> diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c >>> index e38a8c0852..4a996411d1 100644 >>> --- a/libavcodec/mpeg4audio.c >>> +++ b/libavcodec/mpeg4audio.c >>> @@ -56,7 +56,7 @@ static int parse_config_ALS(GetBitContext *gb, >>> MPEG4AudioConfig *c, void *logctx >>> return 0; >>> } >>> -const uint8_t ff_mpeg4audio_channels[14] = { >>> +const uint8_t ff_mpeg4audio_channels[15] = { >>> 0, >>> 1, // mono (1/0) >>> 2, // stereo (2/0) >>> @@ -70,7 +70,8 @@ const uint8_t ff_mpeg4audio_channels[14] = { >>> 0, >>> 7, // 3/3.1 >>> 8, // 3/2/2.1 >>> - 24 // 3/3/3 - 5/2/3 - 3/0/0.2 >>> + 24, //
Re: [FFmpeg-devel] [PATCH 3/4 v2] avcodec/aacdec: add support for channel configuration 14
On 10/28/2022 9:31 AM, Andreas Rheinhardt wrote: James Almer: It corresponds to the 7.1(top) layout. Signed-off-by: James Almer --- libavcodec/aacdec_template.c | 23 ++- libavcodec/aacdectab.h | 6 +++--- libavcodec/mpeg4audio.c | 5 +++-- libavcodec/mpeg4audio.h | 2 +- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index c10bc743b6..4b8e29ba71 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -404,6 +404,21 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) i++; } +// The previous checks would end up at 4 at this point for chan_config 14 +if (layout == AV_CH_LAYOUT_5POINT1 && tags == 5 && i == 4) { +const uint8_t (*reference_layout_map)[3] = aac_channel_layout_map[13]; +for (int j = 0; j < tags; j++) { +if (layout_map[j][0] != reference_layout_map[j][0] || +layout_map[j][2] != reference_layout_map[j][2]) +goto end_of_layout_definition; +} + +i += assign_pair(e2c_vec, layout_map, i, + AV_CH_TOP_FRONT_LEFT, + AV_CH_TOP_FRONT_RIGHT, + AAC_CHANNEL_FRONT, + &layout); +} // The previous checks would end up at 8 at this point for 22.2 if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) { const uint8_t (*reference_layout_map)[3] = aac_channel_layout_map[12]; @@ -633,7 +648,7 @@ static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx, int channel_config) { if (channel_config < 1 || (channel_config > 7 && channel_config < 11) || -channel_config > 13) { +channel_config > 14) { av_log(avctx, AV_LOG_ERROR, "invalid default channel configuration (%d)\n", channel_config); @@ -717,6 +732,12 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id) /* For indexed channel configurations map the channels solely based * on position. */ switch (ac->oc[1].m4ac.chan_config) { +case 14: +if (ac->tags_mapped > 2 && ((type == TYPE_CPE && elem_id < 3) || +(type == TYPE_LFE && elem_id < 1))) { +ac->tags_mapped++; +return ac->tag_che_map[type][elem_id] = ac->che[type][elem_id]; +} case 13: if (ac->tags_mapped > 3 && ((type == TYPE_CPE && elem_id < 8) || (type == TYPE_SCE && elem_id < 6) || diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h index b820f10556..e9bbd1fe13 100644 --- a/libavcodec/aacdectab.h +++ b/libavcodec/aacdectab.h @@ -68,8 +68,8 @@ static const uint8_t aac_channel_layout_map[16][16][3] = { { TYPE_SCE, 5, AAC_CHANNEL_FRONT }, // SCE6 = BtFC, { TYPE_CPE, 7, AAC_CHANNEL_FRONT }, // CPE8 = BtFL and BtFR }, +{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_SIDE }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, { TYPE_CPE, 2, AAC_CHANNEL_FRONT }, }, { { 0, } }, -/* TODO: Add 7+1 TOP configuration */ }; #if FF_API_OLD_CHANNEL_LAYOUT @@ -84,8 +84,8 @@ static const uint64_t aac_channel_layout[] = { AV_CH_LAYOUT_6POINT1, AV_CH_LAYOUT_7POINT1, AV_CH_LAYOUT_22POINT2, +AV_CH_LAYOUT_7POINT1_TOP, 0, -/* AV_CH_LAYOUT_7POINT1_TOP, */ }; #endif @@ -100,8 +100,8 @@ static const AVChannelLayout aac_ch_layout[] = { AV_CHANNEL_LAYOUT_6POINT1, AV_CHANNEL_LAYOUT_7POINT1, AV_CHANNEL_LAYOUT_22POINT2, +AV_CHANNEL_LAYOUT_7POINT1_TOP, { 0 }, -/* AV_CHANNEL_LAYOUT_7POINT1_TOP, */ }; #endif /* AVCODEC_AACDECTAB_H */ diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c index e38a8c0852..4a996411d1 100644 --- a/libavcodec/mpeg4audio.c +++ b/libavcodec/mpeg4audio.c @@ -56,7 +56,7 @@ static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c, void *logctx return 0; } -const uint8_t ff_mpeg4audio_channels[14] = { +const uint8_t ff_mpeg4audio_channels[15] = { 0, 1, // mono (1/0) 2, // stereo (2/0) @@ -70,7 +70,8 @@ const uint8_t ff_mpeg4audio_channels[14] = { 0, 7, // 3/3.1 8, // 3/2/2.1 -24 // 3/3/3 - 5/2/3 - 3/0/0.2 +24, // 3/3/3 - 5/2/3 - 3/0/0.2 +8 // 3/2.1 - 2/0 Is it guaranteed that 8 will always be the last element of this array? If not, you should use "8,", so that the comma won't have to be added when someone makes an addition in the future. What does the pedantic gcc option say about this? I recall it complained about either having or missing the comma in the last element, so given that it makes no real difference I'd go with whatever keeps it quiet. }; static inline int ge
Re: [FFmpeg-devel] [PATCH 3/4 v2] avcodec/aacdec: add support for channel configuration 14
James Almer: > It corresponds to the 7.1(top) layout. > > Signed-off-by: James Almer > --- > libavcodec/aacdec_template.c | 23 ++- > libavcodec/aacdectab.h | 6 +++--- > libavcodec/mpeg4audio.c | 5 +++-- > libavcodec/mpeg4audio.h | 2 +- > 4 files changed, 29 insertions(+), 7 deletions(-) > > diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c > index c10bc743b6..4b8e29ba71 100644 > --- a/libavcodec/aacdec_template.c > +++ b/libavcodec/aacdec_template.c > @@ -404,6 +404,21 @@ static uint64_t sniff_channel_order(uint8_t > (*layout_map)[3], int tags) > i++; > } > > +// The previous checks would end up at 4 at this point for chan_config 14 > +if (layout == AV_CH_LAYOUT_5POINT1 && tags == 5 && i == 4) { > +const uint8_t (*reference_layout_map)[3] = > aac_channel_layout_map[13]; > +for (int j = 0; j < tags; j++) { > +if (layout_map[j][0] != reference_layout_map[j][0] || > +layout_map[j][2] != reference_layout_map[j][2]) > +goto end_of_layout_definition; > +} > + > +i += assign_pair(e2c_vec, layout_map, i, > + AV_CH_TOP_FRONT_LEFT, > + AV_CH_TOP_FRONT_RIGHT, > + AAC_CHANNEL_FRONT, > + &layout); > +} > // The previous checks would end up at 8 at this point for 22.2 > if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) { > const uint8_t (*reference_layout_map)[3] = > aac_channel_layout_map[12]; > @@ -633,7 +648,7 @@ static int set_default_channel_config(AACContext *ac, > AVCodecContext *avctx, >int channel_config) > { > if (channel_config < 1 || (channel_config > 7 && channel_config < 11) || > -channel_config > 13) { > +channel_config > 14) { > av_log(avctx, AV_LOG_ERROR, > "invalid default channel configuration (%d)\n", > channel_config); > @@ -717,6 +732,12 @@ static ChannelElement *get_che(AACContext *ac, int type, > int elem_id) > /* For indexed channel configurations map the channels solely based > * on position. */ > switch (ac->oc[1].m4ac.chan_config) { > +case 14: > +if (ac->tags_mapped > 2 && ((type == TYPE_CPE && elem_id < 3) || > +(type == TYPE_LFE && elem_id < 1))) { > +ac->tags_mapped++; > +return ac->tag_che_map[type][elem_id] = ac->che[type][elem_id]; > +} > case 13: > if (ac->tags_mapped > 3 && ((type == TYPE_CPE && elem_id < 8) || > (type == TYPE_SCE && elem_id < 6) || > diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h > index b820f10556..e9bbd1fe13 100644 > --- a/libavcodec/aacdectab.h > +++ b/libavcodec/aacdectab.h > @@ -68,8 +68,8 @@ static const uint8_t aac_channel_layout_map[16][16][3] = { >{ TYPE_SCE, 5, AAC_CHANNEL_FRONT }, // SCE6 = BtFC, >{ TYPE_CPE, 7, AAC_CHANNEL_FRONT }, // CPE8 = BtFL and BtFR > }, > +{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT > }, { TYPE_CPE, 1, AAC_CHANNEL_SIDE }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, { > TYPE_CPE, 2, AAC_CHANNEL_FRONT }, }, > { { 0, } }, > -/* TODO: Add 7+1 TOP configuration */ > }; > > #if FF_API_OLD_CHANNEL_LAYOUT > @@ -84,8 +84,8 @@ static const uint64_t aac_channel_layout[] = { > AV_CH_LAYOUT_6POINT1, > AV_CH_LAYOUT_7POINT1, > AV_CH_LAYOUT_22POINT2, > +AV_CH_LAYOUT_7POINT1_TOP, > 0, > -/* AV_CH_LAYOUT_7POINT1_TOP, */ > }; > #endif > > @@ -100,8 +100,8 @@ static const AVChannelLayout aac_ch_layout[] = { > AV_CHANNEL_LAYOUT_6POINT1, > AV_CHANNEL_LAYOUT_7POINT1, > AV_CHANNEL_LAYOUT_22POINT2, > +AV_CHANNEL_LAYOUT_7POINT1_TOP, > { 0 }, > -/* AV_CHANNEL_LAYOUT_7POINT1_TOP, */ > }; > > #endif /* AVCODEC_AACDECTAB_H */ > diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c > index e38a8c0852..4a996411d1 100644 > --- a/libavcodec/mpeg4audio.c > +++ b/libavcodec/mpeg4audio.c > @@ -56,7 +56,7 @@ static int parse_config_ALS(GetBitContext *gb, > MPEG4AudioConfig *c, void *logctx > return 0; > } > > -const uint8_t ff_mpeg4audio_channels[14] = { > +const uint8_t ff_mpeg4audio_channels[15] = { > 0, > 1, // mono (1/0) > 2, // stereo (2/0) > @@ -70,7 +70,8 @@ const uint8_t ff_mpeg4audio_channels[14] = { > 0, > 7, // 3/3.1 > 8, // 3/2/2.1 > -24 // 3/3/3 - 5/2/3 - 3/0/0.2 > +24, // 3/3/3 - 5/2/3 - 3/0/0.2 > +8 // 3/2.1 - 2/0 Is it guaranteed that 8 will always be the last element of this array? If not, you should use "8,", so that the comma won't have to be added when someone makes an addition in the future. > }; > > static inline int get_object_type(GetBitContext *gb) > diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpe
[FFmpeg-devel] [PATCH 4/4] avformat/mov_chan: add missing AAC 7.1 mappings
Signed-off-by: James Almer --- libavformat/mov_chan.c | 5 + libavformat/mov_chan.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c index 5b757c6a8a..19da01996c 100644 --- a/libavformat/mov_chan.c +++ b/libavformat/mov_chan.c @@ -186,6 +186,9 @@ static const struct MovChannelLayoutMap mov_ch_layout_map_8ch[] = { { MOV_CH_LAYOUT_MPEG_7_1_C, AV_CH_LAYOUT_7POINT1 },// L, R, C, LFE, Ls, Rs, Rls, Rrs { MOV_CH_LAYOUT_EAC3_7_1_A, AV_CH_LAYOUT_7POINT1 },// L, C, R, Ls, Rs, LFE, Rls, Rrs +{ MOV_CH_LAYOUT_AAC_7_1_B, AV_CH_LAYOUT_7POINT1 },// C, L, R, Ls, Rs, Rls, Rrs, LFE + +{ MOV_CH_LAYOUT_AAC_7_1_C, AV_CH_LAYOUT_7POINT1_TOP },// C, L, R, Ls, Rs, LFE, Vhl, Vhr { MOV_CH_LAYOUT_SMPTE_DTV, AV_CH_LAYOUT_5POINT1 | // L, R, C, LFE, Ls, Rs, Lt, Rt AV_CH_LAYOUT_STEREO_DOWNMIX }, @@ -276,6 +279,8 @@ static const enum MovChannelLayoutTag mov_ch_layouts_aac[] = { MOV_CH_LAYOUT_DTS_6_1_A, MOV_CH_LAYOUT_AAC_OCTAGONAL, MOV_CH_LAYOUT_MPEG_7_1_B, +MOV_CH_LAYOUT_AAC_7_1_B, +MOV_CH_LAYOUT_AAC_7_1_C, MOV_CH_LAYOUT_DTS_8_0_A, 0, }; diff --git a/libavformat/mov_chan.h b/libavformat/mov_chan.h index 93d9878798..322fdecff8 100644 --- a/libavformat/mov_chan.h +++ b/libavformat/mov_chan.h @@ -135,6 +135,8 @@ enum MovChannelLayoutTag { MOV_CH_LAYOUT_DTS_8_0_B = (179 << 16) | 8, MOV_CH_LAYOUT_DTS_8_1_A = (180 << 16) | 9, MOV_CH_LAYOUT_DTS_8_1_B = (181 << 16) | 9, +MOV_CH_LAYOUT_AAC_7_1_B = (183 << 16) | 8, +MOV_CH_LAYOUT_AAC_7_1_C = (184 << 16) | 8, }; /** -- 2.38.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/4 v2] avcodec/aacdec: add support for channel configuration 14
It corresponds to the 7.1(top) layout. Signed-off-by: James Almer --- libavcodec/aacdec_template.c | 23 ++- libavcodec/aacdectab.h | 6 +++--- libavcodec/mpeg4audio.c | 5 +++-- libavcodec/mpeg4audio.h | 2 +- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index c10bc743b6..4b8e29ba71 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -404,6 +404,21 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) i++; } +// The previous checks would end up at 4 at this point for chan_config 14 +if (layout == AV_CH_LAYOUT_5POINT1 && tags == 5 && i == 4) { +const uint8_t (*reference_layout_map)[3] = aac_channel_layout_map[13]; +for (int j = 0; j < tags; j++) { +if (layout_map[j][0] != reference_layout_map[j][0] || +layout_map[j][2] != reference_layout_map[j][2]) +goto end_of_layout_definition; +} + +i += assign_pair(e2c_vec, layout_map, i, + AV_CH_TOP_FRONT_LEFT, + AV_CH_TOP_FRONT_RIGHT, + AAC_CHANNEL_FRONT, + &layout); +} // The previous checks would end up at 8 at this point for 22.2 if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) { const uint8_t (*reference_layout_map)[3] = aac_channel_layout_map[12]; @@ -633,7 +648,7 @@ static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx, int channel_config) { if (channel_config < 1 || (channel_config > 7 && channel_config < 11) || -channel_config > 13) { +channel_config > 14) { av_log(avctx, AV_LOG_ERROR, "invalid default channel configuration (%d)\n", channel_config); @@ -717,6 +732,12 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id) /* For indexed channel configurations map the channels solely based * on position. */ switch (ac->oc[1].m4ac.chan_config) { +case 14: +if (ac->tags_mapped > 2 && ((type == TYPE_CPE && elem_id < 3) || +(type == TYPE_LFE && elem_id < 1))) { +ac->tags_mapped++; +return ac->tag_che_map[type][elem_id] = ac->che[type][elem_id]; +} case 13: if (ac->tags_mapped > 3 && ((type == TYPE_CPE && elem_id < 8) || (type == TYPE_SCE && elem_id < 6) || diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h index b820f10556..e9bbd1fe13 100644 --- a/libavcodec/aacdectab.h +++ b/libavcodec/aacdectab.h @@ -68,8 +68,8 @@ static const uint8_t aac_channel_layout_map[16][16][3] = { { TYPE_SCE, 5, AAC_CHANNEL_FRONT }, // SCE6 = BtFC, { TYPE_CPE, 7, AAC_CHANNEL_FRONT }, // CPE8 = BtFL and BtFR }, +{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_SIDE }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, { TYPE_CPE, 2, AAC_CHANNEL_FRONT }, }, { { 0, } }, -/* TODO: Add 7+1 TOP configuration */ }; #if FF_API_OLD_CHANNEL_LAYOUT @@ -84,8 +84,8 @@ static const uint64_t aac_channel_layout[] = { AV_CH_LAYOUT_6POINT1, AV_CH_LAYOUT_7POINT1, AV_CH_LAYOUT_22POINT2, +AV_CH_LAYOUT_7POINT1_TOP, 0, -/* AV_CH_LAYOUT_7POINT1_TOP, */ }; #endif @@ -100,8 +100,8 @@ static const AVChannelLayout aac_ch_layout[] = { AV_CHANNEL_LAYOUT_6POINT1, AV_CHANNEL_LAYOUT_7POINT1, AV_CHANNEL_LAYOUT_22POINT2, +AV_CHANNEL_LAYOUT_7POINT1_TOP, { 0 }, -/* AV_CHANNEL_LAYOUT_7POINT1_TOP, */ }; #endif /* AVCODEC_AACDECTAB_H */ diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c index e38a8c0852..4a996411d1 100644 --- a/libavcodec/mpeg4audio.c +++ b/libavcodec/mpeg4audio.c @@ -56,7 +56,7 @@ static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c, void *logctx return 0; } -const uint8_t ff_mpeg4audio_channels[14] = { +const uint8_t ff_mpeg4audio_channels[15] = { 0, 1, // mono (1/0) 2, // stereo (2/0) @@ -70,7 +70,8 @@ const uint8_t ff_mpeg4audio_channels[14] = { 0, 7, // 3/3.1 8, // 3/2/2.1 -24 // 3/3/3 - 5/2/3 - 3/0/0.2 +24, // 3/3/3 - 5/2/3 - 3/0/0.2 +8 // 3/2.1 - 2/0 }; static inline int get_object_type(GetBitContext *gb) diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h index a6f71cff58..56615ef321 100644 --- a/libavcodec/mpeg4audio.h +++ b/libavcodec/mpeg4audio.h @@ -42,7 +42,7 @@ typedef struct MPEG4AudioConfig { } MPEG4AudioConfig; extern const int ff_mpeg4audio_sample_rates[16]; -extern const uint8_t ff_mpeg4audio_channels[14]; +extern const uint8_t ff_mpeg4audio_channels[15]; /** * Parse MPEG-4 systems extradata from a potentially unaligned GetBitContext to retrieve audio configuration
[FFmpeg-devel] [PATCH 2/4 v2] avutil/channel_layout: add a 7.1(top) channel layout
Signed-off-by: James Almer --- doc/APIchanges| 3 +++ doc/utils.texi| 2 ++ libavutil/channel_layout.c| 1 + libavutil/channel_layout.h| 2 ++ tests/ref/fate/channel_layout | 1 + 5 files changed, 9 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 5807bf8069..75bbcaddff 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2022-10-xx - xx - lavu 57.xx.xxx - channel_layout.h + Add AV_CH_LAYOUT_7POINT1_TOP and AV_CHANNEL_LAYOUT_7POINT1_TOP. + 2022-10-11 - xx - lavu 57.39.101 - pixfmt.h Add AV_PIX_FMT_RGBF32 and AV_PIX_FMT_RGBAF32. diff --git a/doc/utils.texi b/doc/utils.texi index 627b55d154..d19523a5f4 100644 --- a/doc/utils.texi +++ b/doc/utils.texi @@ -713,6 +713,8 @@ FL+FR+FC+LFE+BL+BR+SL+SR FL+FR+FC+LFE+BL+BR+FLC+FRC @item 7.1(wide-side) FL+FR+FC+LFE+FLC+FRC+SL+SR +@item 7.1(top) +FL+FR+FC+LFE+SL+SR+TFL+TFR @item octagonal FL+FR+FC+BL+BR+BC+SL+SR @item hexadecagonal diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c index 21b70173b7..bc0016d346 100644 --- a/libavutil/channel_layout.c +++ b/libavutil/channel_layout.c @@ -196,6 +196,7 @@ static const struct channel_layout_name channel_layout_map[] = { { "7.1",AV_CHANNEL_LAYOUT_7POINT1 }, { "7.1(wide)", AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK }, { "7.1(wide-side)", AV_CHANNEL_LAYOUT_7POINT1_WIDE}, +{ "7.1(top)", AV_CHANNEL_LAYOUT_7POINT1_TOP }, { "octagonal", AV_CHANNEL_LAYOUT_OCTAGONAL }, { "hexadecagonal", AV_CHANNEL_LAYOUT_HEXADECAGONAL }, { "downmix",AV_CHANNEL_LAYOUT_STEREO_DOWNMIX, }, diff --git a/libavutil/channel_layout.h b/libavutil/channel_layout.h index 059ff70841..9246562807 100644 --- a/libavutil/channel_layout.h +++ b/libavutil/channel_layout.h @@ -232,6 +232,7 @@ enum AVChannelOrder { #define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) #define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) #define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_7POINT1_TOP (AV_CH_LAYOUT_5POINT1|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT) #define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT) #define AV_CH_LAYOUT_HEXADECAGONAL (AV_CH_LAYOUT_OCTAGONAL|AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT) #define AV_CH_LAYOUT_STEREO_DOWNMIX(AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) @@ -388,6 +389,7 @@ typedef struct AVChannelLayout { #define AV_CHANNEL_LAYOUT_7POINT1 AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1) #define AV_CHANNEL_LAYOUT_7POINT1_WIDE AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE) #define AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE_BACK) +#define AV_CHANNEL_LAYOUT_7POINT1_TOP AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_TOP) #define AV_CHANNEL_LAYOUT_OCTAGONAL AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_OCTAGONAL) #define AV_CHANNEL_LAYOUT_HEXADECAGONAL AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_HEXADECAGONAL) #define AV_CHANNEL_LAYOUT_STEREO_DOWNMIXAV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO_DOWNMIX) diff --git a/tests/ref/fate/channel_layout b/tests/ref/fate/channel_layout index 19bcbce7d8..918b01584d 100644 --- a/tests/ref/fate/channel_layout +++ b/tests/ref/fate/channel_layout @@ -24,6 +24,7 @@ hexagonal FL+FR+FC+BL+BR+BC 7.1FL+FR+FC+LFE+BL+BR+SL+SR 7.1(wide) FL+FR+FC+LFE+BL+BR+FLC+FRC 7.1(wide-side) FL+FR+FC+LFE+FLC+FRC+SL+SR +7.1(top) FL+FR+FC+LFE+SL+SR+TFL+TFR octagonal FL+FR+FC+BL+BR+BC+SL+SR hexadecagonal FL+FR+FC+BL+BR+BC+SL+SR+TFL+TFC+TFR+TBL+TBC+TBR+WL+WR downmixDL+DR -- 2.38.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/4 v2] avcodec/aacdec: fix parsing streams with channel configuration 11
Set the correct amount of tags in tags_per_config[] and ensure the side channels (Surround in the spec) are used. Signed-off-by: James Almer --- libavcodec/aacdec_template.c | 4 +--- libavcodec/aacdectab.h | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 4a9513d53e..c10bc743b6 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -731,9 +731,7 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id) return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2]; } case 11: -if (ac->tags_mapped == 2 && -ac->oc[1].m4ac.chan_config == 11 && -type == TYPE_SCE) { +if (ac->tags_mapped == 3 && type == TYPE_SCE) { ac->tags_mapped++; return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][1]; } diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h index e38b93a534..b820f10556 100644 --- a/libavcodec/aacdectab.h +++ b/libavcodec/aacdectab.h @@ -35,7 +35,7 @@ #include -static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 4, 5, 16, 5, 0 }; +static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 5, 5, 16, 5, 0 }; static const uint8_t aac_channel_layout_map[16][16][3] = { { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, }, @@ -48,7 +48,7 @@ static const uint8_t aac_channel_layout_map[16][16][3] = { { { 0, } }, { { 0, } }, { { 0, } }, -{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, }, +{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_SIDE }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, }, { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_SIDE }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, }, { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, // SCE1 = FC, -- 2.38.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/3] sw_scale: Add specializations for hscale 16 to 19
Provide arm64 neon optimized implementations for hscale16To19 with filter sizes 4, 8 and X4. The tests and benchmarks run on AWS Graviton 2 instances. The results from a checkasm tool are shown below. hscale_16_to_19__fs_4_dstW_512_c: 6216.0 hscale_16_to_19__fs_4_dstW_512_neon: 2257.0 hscale_16_to_19__fs_8_dstW_512_c: 10417.7 hscale_16_to_19__fs_8_dstW_512_neon: 3112.5 hscale_16_to_19__fs_12_dstW_512_c: 14890.5 hscale_16_to_19__fs_12_dstW_512_neon: 3899.0 hscale_16_to_19__fs_16_dstW_512_c: 19006.5 hscale_16_to_19__fs_16_dstW_512_neon: 5341.2 hscale_16_to_19__fs_32_dstW_512_c: 36629.5 hscale_16_to_19__fs_32_dstW_512_neon: 9502.7 hscale_16_to_19__fs_40_dstW_512_c: 45477.5 hscale_16_to_19__fs_40_dstW_512_neon: 11552.0 Signed-off-by: Hubert Mazur --- libswscale/aarch64/hscale.S | 402 +++ libswscale/aarch64/swscale.c | 66 ++ 2 files changed, 468 insertions(+) diff --git a/libswscale/aarch64/hscale.S b/libswscale/aarch64/hscale.S index b571a5dc219..a4fa0709f81 100644 --- a/libswscale/aarch64/hscale.S +++ b/libswscale/aarch64/hscale.S @@ -1045,3 +1045,405 @@ function ff_hscale16to15_X4_neon_asm, export=1 ret endfunc + +function ff_hscale16to19_4_neon_asm, export=1 +// w0 int shift +// x1 int32_t *dst +// w2 int dstW +// x3 const uint8_t *src // treat it as uint16_t *src +// x4 const uint16_t *filter +// x5 const int32_t *filterPos +// w6 int filterSize + +moviv18.4s, #1 +moviv17.4s, #1 +shl v18.4s, v18.4s, #19 +sub v18.4s, v18.4s, v17.4s // max allowed value +dup v17.4s, w0 // read shift +neg v17.4s, v17.4s // negate it, so it can be used in sshl (effectively shift right) + +cmp w2, #16 +b.lt2f // move to last block + +ldp w8, w9, [x5]// filterPos[0], filterPos[1] +ldp w10, w11, [x5, #8] // filterPos[2], filterPos[3] +ldp w12, w13, [x5, #16] // filterPos[4], filterPos[5] +ldp w14, w15, [x5, #24] // filterPos[6], filterPos[7] +add x5, x5, #32 + +// shift all filterPos left by one, as uint16_t will be read +lsl x8, x8, #1 +lsl x9, x9, #1 +lsl x10, x10, #1 +lsl x11, x11, #1 +lsl x12, x12, #1 +lsl x13, x13, #1 +lsl x14, x14, #1 +lsl x15, x15, #1 + +// load src with given offset +ldr x8, [x3, w8, UXTW] +ldr x9, [x3, w9, UXTW] +ldr x10, [x3, w10, UXTW] +ldr x11, [x3, w11, UXTW] +ldr x12, [x3, w12, UXTW] +ldr x13, [x3, w13, UXTW] +ldr x14, [x3, w14, UXTW] +ldr x15, [x3, w15, UXTW] + +sub sp, sp, #64 +// push src on stack so it can be loaded into vectors later +stp x8, x9, [sp] +stp x10, x11, [sp, #16] +stp x12, x13, [sp, #32] +stp x14, x15, [sp, #48] + +1: +ld4 {v0.8h, v1.8h, v2.8h, v3.8h}, [sp] +ld4 {v28.8h, v29.8h, v30.8h, v31.8h}, [x4], #64 // filter[0..7] + +// Each of blocks does the following: +// Extend src and filter to 32 bits with uxtl and sxtl +// multiply or multiply and accumulate results +// Extending to 32 bits is necessary, as unit16_t values can't +// be represented as int16_t without type promotion. +uxtlv26.4s, v0.4h +sxtlv27.4s, v28.4H +uxtl2 v0.4s, v0.8h +mul v5.4s, v26.4s, v27.4s +sxtl2 v28.4s, v28.8H +uxtlv26.4s, v1.4h +mul v6.4s, v0.4s, v28.4s + +sxtlv27.4s, v29.4H +uxtl2 v0.4s, v1.8h +mla v5.4s, v27.4s, v26.4s +sxtl2 v28.4s, v29.8H +uxtlv26.4s, v2.4h +mla v6.4s, v28.4s, v0.4s + +sxtlv27.4s, v30.4H +uxtl2 v0.4s, v2.8h +mla v5.4s, v27.4s, v26.4s +sxtl2 v28.4s, v30.8H +uxtlv26.4s, v3.4h +mla v6.4s, v28.4s, v0.4s + +sxtlv27.4s, v31.4H +
[FFmpeg-devel] [PATCH 2/3] sw_scale: Add specializations for hscale 16 to 15
Add arm64 neon implementations for hscale 16 to 15 with filter sizes 4, 8 and X4. The tests and benchmarks run on AWS Graviton 2 instances. The results from a checkasm tool are shown below. hscale_16_to_15__fs_4_dstW_512_c: 6703.5 hscale_16_to_15__fs_4_dstW_512_neon: 2298.0 hscale_16_to_15__fs_8_dstW_512_c: 10983.0 hscale_16_to_15__fs_8_dstW_512_neon: 3216.5 hscale_16_to_15__fs_12_dstW_512_c: 15526.0 hscale_16_to_15__fs_12_dstW_512_neon: 3993.0 hscale_16_to_15__fs_16_dstW_512_c: 20183.5 hscale_16_to_15__fs_16_dstW_512_neon: 5369.7 hscale_16_to_15__fs_32_dstW_512_c: 39315.2 hscale_16_to_15__fs_32_dstW_512_neon: 9511.2 hscale_16_to_15__fs_40_dstW_512_c: 48995.7 hscale_16_to_15__fs_40_dstW_512_neon: 11570.0 Signed-off-by: Hubert Mazur --- libswscale/aarch64/hscale.S | 407 +++ libswscale/aarch64/swscale.c | 61 ++ libswscale/swscale.c | 1 - 3 files changed, 468 insertions(+), 1 deletion(-) diff --git a/libswscale/aarch64/hscale.S b/libswscale/aarch64/hscale.S index 35e25462ce8..b571a5dc219 100644 --- a/libswscale/aarch64/hscale.S +++ b/libswscale/aarch64/hscale.S @@ -636,5 +636,412 @@ function ff_hscale8to19_X4_neon, export=1 add x4, x4, x7, lsl #2 b.gt1b ret +endfunc + +function ff_hscale16to15_4_neon_asm, export=1 +// w0 int shift +// x1 int32_t *dst +// w2 int dstW +// x3 const uint8_t *src // treat it as uint16_t *src +// x4 const uint16_t *filter +// x5 const int32_t *filterPos +// w6 int filterSize + +moviv18.4s, #1 +moviv17.4s, #1 +shl v18.4s, v18.4s, #15 +sub v18.4s, v18.4s, v17.4s // max allowed value +dup v17.4s, w0 // read shift +neg v17.4s, v17.4s // negate it, so it can be used in sshl (effectively shift right) + +cmp w2, #16 +b.lt2f // move to last block + +ldp w8, w9, [x5]// filterPos[0], filterPos[1] +ldp w10, w11, [x5, #8] // filterPos[2], filterPos[3] +ldp w12, w13, [x5, #16] // filterPos[4], filterPos[5] +ldp w14, w15, [x5, #24] // filterPos[6], filterPos[7] +add x5, x5, #32 + +// shift all filterPos left by one, as uint16_t will be read +lsl x8, x8, #1 +lsl x9, x9, #1 +lsl x10, x10, #1 +lsl x11, x11, #1 +lsl x12, x12, #1 +lsl x13, x13, #1 +lsl x14, x14, #1 +lsl x15, x15, #1 + +// load src with given offset +ldr x8, [x3, w8, UXTW] +ldr x9, [x3, w9, UXTW] +ldr x10, [x3, w10, UXTW] +ldr x11, [x3, w11, UXTW] +ldr x12, [x3, w12, UXTW] +ldr x13, [x3, w13, UXTW] +ldr x14, [x3, w14, UXTW] +ldr x15, [x3, w15, UXTW] + +sub sp, sp, #64 +// push src on stack so it can be loaded into vectors later +stp x8, x9, [sp] +stp x10, x11, [sp, #16] +stp x12, x13, [sp, #32] +stp x14, x15, [sp, #48] + +1: +ld4 {v0.8h, v1.8h, v2.8h, v3.8h}, [sp] +ld4 {v28.8h, v29.8h, v30.8h, v31.8h}, [x4], #64 // filter[0..7] + +// Each of blocks does the following: +// Extend src and filter to 32 bits with uxtl and sxtl +// multiply or multiply and accumulate results +// Extending to 32 bits is necessary, as unit16_t values can't +// be represented as int16_t without type promotion. +uxtlv26.4s, v0.4h +sxtlv27.4s, v28.4H +uxtl2 v0.4s, v0.8h +mul v5.4s, v26.4s, v27.4s +sxtl2 v28.4s, v28.8H +uxtlv26.4s, v1.4h +mul v6.4s, v0.4s, v28.4s + +sxtlv27.4s, v29.4H +uxtl2 v0.4s, v1.8h +mla v5.4s, v27.4s, v26.4s +sxtl2 v28.4s, v29.8H +uxtlv26.4s, v2.4h +mla v6.4s, v28.4s, v0.4s + +sxtlv27.4s, v30.4H +uxtl2 v0.4s, v2.8h +mla v5.4s, v27.4s, v26.4s +sxtl2 v28.4s, v30.8H +uxtl
[FFmpeg-devel] [PATCH 1/3] sw_scale: Add specializations for hscale 8 to 19
Add arm64 neon implementations for hscale 8 to 19 with filter sizes 4, 4X and 8. Both implementations are based on very similar ones dedicated to hscale 8 to 15. The major changes refer to saving the data - instead of writing the result as int16_t it is done with int32_t. These functions are heavily inspired on patches provided by J. Swinney and M. Storsjö for hscale8to15 which were slightly adapted for hscale8to19. The tests and benchmarks run on AWS Graviton 2 instances. The results from a checkasm tool shown below. hscale_8_to_19__fs_4_dstW_512_c: 5663.2 hscale_8_to_19__fs_4_dstW_512_neon: 1259.7 hscale_8_to_19__fs_8_dstW_512_c: 9306.0 hscale_8_to_19__fs_8_dstW_512_neon: 2020.2 hscale_8_to_19__fs_12_dstW_512_c: 12932.7 hscale_8_to_19__fs_12_dstW_512_neon: 2462.5 hscale_8_to_19__fs_16_dstW_512_c: 16844.2 hscale_8_to_19__fs_16_dstW_512_neon: 4671.2 hscale_8_to_19__fs_32_dstW_512_c: 32803.7 hscale_8_to_19__fs_32_dstW_512_neon: 5474.2 hscale_8_to_19__fs_40_dstW_512_c: 40948.0 hscale_8_to_19__fs_40_dstW_512_neon: 6669.7 Signed-off-by: Hubert Mazur --- libswscale/aarch64/hscale.S | 291 +++ libswscale/aarch64/swscale.c | 13 +- 2 files changed, 300 insertions(+), 4 deletions(-) diff --git a/libswscale/aarch64/hscale.S b/libswscale/aarch64/hscale.S index a16d3dca42a..35e25462ce8 100644 --- a/libswscale/aarch64/hscale.S +++ b/libswscale/aarch64/hscale.S @@ -347,3 +347,294 @@ function ff_hscale8to15_4_neon, export=1 add sp, sp, #32 // clean up stack ret endfunc + +function ff_hscale8to19_4_neon, export=1 +// x0 SwsContext *c (unused) +// x1 int32_t *dst +// w2 int dstW +// x3 const uint8_t *src // treat it as uint16_t *src +// x4 const uint16_t *filter +// x5 const int32_t *filterPos +// w6 int filterSize + +moviv18.4s, #1 +moviv17.4s, #1 +shl v18.4s, v18.4s, #19 +sub v18.4s, v18.4s, v17.4s // max allowed value + +cmp w2, #16 +b.lt2f // move to last block + +ldp w8, w9, [x5]// filterPos[0], filterPos[1] +ldp w10, w11, [x5, #8] // filterPos[2], filterPos[3] +ldp w12, w13, [x5, #16] // filterPos[4], filterPos[5] +ldp w14, w15, [x5, #24] // filterPos[6], filterPos[7] +add x5, x5, #32 + +// load data from +ldr w8, [x3, w8, UXTW] +ldr w9, [x3, w9, UXTW] +ldr w10, [x3, w10, UXTW] +ldr w11, [x3, w11, UXTW] +ldr w12, [x3, w12, UXTW] +ldr w13, [x3, w13, UXTW] +ldr w14, [x3, w14, UXTW] +ldr w15, [x3, w15, UXTW] + +sub sp, sp, #32 + +stp w8, w9, [sp] +stp w10, w11, [sp, #8] +stp w12, w13, [sp, #16] +stp w14, w15, [sp, #24] + +1: +ld4 {v0.8b, v1.8b, v2.8b, v3.8b}, [sp] +ld4 {v28.8h, v29.8h, v30.8h, v31.8h}, [x4], #64 // filter[0..7] +// load filterPositions into registers for next iteration + +ldp w8, w9, [x5]// filterPos[0], filterPos[1] +ldp w10, w11, [x5, #8] // filterPos[2], filterPos[3] +ldp w12, w13, [x5, #16] // filterPos[4], filterPos[5] +ldp w14, w15, [x5, #24] // filterPos[6], filterPos[7] +add x5, x5, #32 +uxtlv0.8h, v0.8b +ldr w8, [x3, w8, UXTW] +smull v5.4s, v0.4h, v28.4h// multiply first column of src +ldr w9, [x3, w9, UXTW] +smull2 v6.4s, v0.8h, v28.8h +stp w8, w9, [sp] + +uxtlv1.8h, v1.8b +ldr w10, [x3, w10, UXTW] +smlal v5.4s, v1.4h, v29.4h// multiply second column of src +ldr w11, [x3, w11, UXTW] +smlal2 v6.4s, v1.8h, v29.8h +stp w10, w11, [sp, #8] + +uxtlv2.8h, v2.8b +ldr w12, [x3, w12, UXTW] +smlal v5.4s, v2.4h, v30.4h// multiply third column of src +ldr w13, [x3, w13, UXTW] +smlal2 v6.4s, v2.8h, v30.8h +stp w12, w13, [sp, #16] + +uxtlv3.8h, v3.8b +ldr
[FFmpeg-devel] [PATCH 0/3] sw_scale: Provide neon implementation for hscale
This patchset contains arm64 neon implementation of hscale functions. Fixed minor style issues and declared C function wrappers as static. This patchset do not contain the patch for checkasm tool, as the previous one did. The reason behind it was failing tests on x86 arch but not on aarch64 or loongarch. Probably the hscale functions on x86 have some bugs. Currently the checkasm tool does not check the validity of hscale functions on x86 at all. Implementation of hscale for x86 should be fixed anyway. As it comes to aarch64 the tests were passing. Attaching a link to fate result in patchwork. After fixing x86 the patch for checkasm could be merged. https://patchwork.ffmpeg.org/project/ffmpeg/patch/20221017130715.30896-3-...@semihalf.com/ Hubert Mazur (3): sw_scale: Add specializations for hscale 8 to 19 sw_scale: Add specializations for hscale 16 to 15 sw_scale: Add specializations for hscale 16 to 19 libswscale/aarch64/hscale.S | 1100 ++ libswscale/aarch64/swscale.c | 140 - libswscale/swscale.c |1 - 3 files changed, 1236 insertions(+), 5 deletions(-) -- 2.37.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-requ...@ffmpeg.org with subject "unsubscribe".