From patchwork Mon Aug 21 23:22:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Converse X-Patchwork-Id: 4788 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.137.29 with SMTP id o29csp276397jaj; Mon, 21 Aug 2017 16:30:42 -0700 (PDT) X-Received: by 10.223.144.103 with SMTP id h94mr12695811wrh.216.1503358242593; Mon, 21 Aug 2017 16:30:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503358242; cv=none; d=google.com; s=arc-20160816; b=DYmVi9yL89qucfoOY0jtDtxp6hCYZuGwxAGrW17DxxaryjceiFUZ7oWbVPXV1ECiBK n6h7pPQNSblpMSo3+LS6WHP5BuFrypDOjmBhfb0xYe5Q2ZYN24HQz/EF5l/3Lec8AgwB uYu4xrTCHKYFqRLe6Wtn99qeG/HJLory5htk6F5Su7+cdnek+MOrr4oHRzfpMrphS2dV swI2Oen1nne/okiRC/UdNa9KPnxBlxUMwsLeKGylGYgFij9obFdfzqAzpFVtZkvpLber wppkqnvZQ9jVH21C+X2qTF/Glcmp3vKLrogOSBUqRPul+gBxlXK29+ObC666ZZIXrT0y RJ0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=RPAl+wIE2qC1B52H7px9CBj4YvScVUKXJAmZJc/K5O4=; b=WBio+5xR7FtHV8clWrBpqZXGXmZ+4E06F3E+aDhTUDd7m8Eh/0Z9S+z4xKqbZaziv6 Mujo1vETGjuD8OjWR4q08tqDFlSl8R/k874uHkwVaRK8aoKEyIljrGc5pr32Gi6VY+JS 0sL5u1ZCKpp4K3BJta/Is92G9K6KbmM13VUVgM8+3XZC9Pvj6usz/zzGooh+clHoCUt7 uvOfIkaDoIZnjTU4k+l3VMGLu+3UFDLX+WlryTTWvRNqTMJHPHGyLqZ/kKMpS72CpSYJ x376p6tD94Mgm3QxEMpgxA4kH30wZidmdrIjRTvBwlWcuevPP4nmnmcVO6hTm2R09xRN nS3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=F/YoYMRj; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id u90si3114727wrc.77.2017.08.21.16.30.42; Mon, 21 Aug 2017 16:30:42 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=F/YoYMRj; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 94E3F689AA7; Tue, 22 Aug 2017 02:30:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AC54668030B for ; Tue, 22 Aug 2017 02:30:29 +0300 (EEST) Received: by mail-pg0-f68.google.com with SMTP id y129so25769360pgy.3 for ; Mon, 21 Aug 2017 16:30:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=qgh2E0/ZbgAJvK6HjPfxFh+BNGHwYjxggDYD2OeVNxo=; b=F/YoYMRjX+U+RoqBYRoyDIahTKnBqEa/eIb4etSzyi1jqFmkWl3EYR3bHcnkHaF560 Dxn+lGSAoUKEqqL7VGWeFPS4Pob75s7i8rhmHAaiPlRPAInCoBChVEsaGB0L1VpabW0G 7UypA0VzQk6ZNfWjwwECAhm8bqH87fQYH5VqWufHCoBH/gwLvuhcu7A0Sqa7EZSz3fJM ARhR1/EUW63q0u+5k2XtgmutZwAtCiKKu9W15d+7XmLpIJzDQZdccnBK62PKyKuudA1r WzJ5/NyQEuzEMfjsbK10OTzknqn5f/odio9UWRwE3XAxPz3UF69URjNfgOzungitxdq+ q7rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=qgh2E0/ZbgAJvK6HjPfxFh+BNGHwYjxggDYD2OeVNxo=; b=Mq0NJkQF28bzMPwVrExGGoYUu+W2bnYSBiRt0a7omCTV6UpWwixtzcSHTDmdjHiwZi Yd99VcqCmjtUH5MVLkSkeN5yBf6wj417z2vcKTw0fX7zkmD/1PipzSsx2jORyKszvUfP KPW2Kh4BzK0axX7uJ8FuhY/U6cEngAl6hS3RPMyBV1DRStGSTXRJfd7anD2TgV7ZMr16 zusFVqAx9c63QzzvxUFGPVLwlsM3ENsvoVXWNbfdMQ2nJAP5BXpZZCBdXkrHjraYS0+h OORYX8elD4XriDYgaKIIq/LZyg3OcSkJLxXNqw4nG0s8OgUZTMER0Lx4EDbd4OCVJJWt 0JVw== X-Gm-Message-State: AHYfb5hV5hquIVDNt0jZHbF9uy8Mksm3e8aYgZwhwZBK2BYuu7dcDMiF nAtFXuC9BPgcb2pN6io= X-Received: by 10.84.215.15 with SMTP id k15mr20474687pli.92.1503357767285; Mon, 21 Aug 2017 16:22:47 -0700 (PDT) Received: from localhost.localdomain ([136.25.129.14]) by smtp.gmail.com with ESMTPSA id r3sm225970pfg.14.2017.08.21.16.22.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Aug 2017 16:22:46 -0700 (PDT) From: Alex Converse To: ffmpeg-devel@ffmpeg.org Date: Mon, 21 Aug 2017 16:22:14 -0700 Message-Id: <20170821232215.5844-1-alex.converse@gmail.com> X-Mailer: git-send-email 2.13.3 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/aac: Add floating point 960/120 MDCT window X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Paul B Mahol MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Paul B Mahol Co-Authored-By: Alex Converse --- libavcodec/aac.h | 3 + libavcodec/aacdec_template.c | 124 +++++++++++++++++++++++++++++++++++++++--- libavcodec/aactab.c | 120 ++++++++++++++++++++++++++++++++++++++++ libavcodec/aactab.h | 6 ++ libavcodec/sinewin.h | 4 +- libavcodec/sinewin_tablegen.h | 5 +- 6 files changed, 253 insertions(+), 9 deletions(-) diff --git a/libavcodec/aac.h b/libavcodec/aac.h index 97a2df6b86..4910c661d6 100644 --- a/libavcodec/aac.h +++ b/libavcodec/aac.h @@ -327,7 +327,9 @@ struct AACContext { #if USE_FIXED AVFixedDSPContext *fdsp; #else + MDCT15Context *mdct120; MDCT15Context *mdct480; + MDCT15Context *mdct960; AVFloatDSPContext *fdsp; #endif /* USE_FIXED */ int random_state; @@ -353,6 +355,7 @@ struct AACContext { OutputConfiguration oc[2]; int warned_num_aac_frames; + int warned_960_sbr; /* aacdec functions pointers */ void (*imdct_and_windowing)(AACContext *ac, SingleChannelElement *sce); diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index a539f74e6f..e76e824fbb 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -811,11 +811,21 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx, uint8_t layout_map[MAX_ELEM_ID*4][3]; int tags = 0; +#if USE_FIXED if (get_bits1(gb)) { // frameLengthFlag - avpriv_request_sample(avctx, "960/120 MDCT window"); + avpriv_report_missing_feature(avctx, "Fixed point 960/120 MDCT window"); return AVERROR_PATCHWELCOME; } m4ac->frame_length_short = 0; +#else + m4ac->frame_length_short = get_bits1(gb); + if (m4ac->frame_length_short && m4ac->sbr == 1) { + avpriv_report_missing_feature(avctx, "SBR with 960 frame length"); + if (ac) ac->warned_960_sbr = 1; + m4ac->sbr = 0; + m4ac->ps = 0; + } +#endif if (get_bits1(gb)) // dependsOnCoreCoder skip_bits(gb, 14); // coreCoderDelay @@ -1126,6 +1136,12 @@ static av_cold void aac_static_table_init(void) // window initialization AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(ff_aac_kbd_long_1024), 4.0, 1024); AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(ff_aac_kbd_short_128), 6.0, 128); +#if !USE_FIXED + AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(ff_aac_kbd_long_960), 4.0, 960); + AAC_RENAME(ff_kbd_window_init)(AAC_RENAME(ff_aac_kbd_short_120), 6.0, 120); + AAC_RENAME(ff_sine_window_init)(AAC_RENAME(ff_sine_960), 960); + AAC_RENAME(ff_sine_window_init)(AAC_RENAME(ff_sine_120), 120); +#endif AAC_RENAME(ff_init_ff_sine_windows)(10); AAC_RENAME(ff_init_ff_sine_windows)( 9); AAC_RENAME(ff_init_ff_sine_windows)( 7); @@ -1211,9 +1227,15 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) AAC_RENAME_32(ff_mdct_init)(&ac->mdct_small, 8, 1, 1.0 / RANGE15(128.0)); AAC_RENAME_32(ff_mdct_init)(&ac->mdct_ltp, 11, 0, RANGE15(-2.0)); #if !USE_FIXED + ret = ff_mdct15_init(&ac->mdct120, 1, 3, 1.0f/(16*1024*120*2)); + if (ret < 0) + return ret; ret = ff_mdct15_init(&ac->mdct480, 1, 5, 1.0f/(16*1024*960)); if (ret < 0) return ret; + ret = ff_mdct15_init(&ac->mdct960, 1, 6, 1.0f/(16*1024*960*2)); + if (ret < 0) + return ret; #endif return 0; @@ -1314,8 +1336,13 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics, } } ics->num_windows = 8; - ics->swb_offset = ff_swb_offset_128[sampling_index]; - ics->num_swb = ff_aac_num_swb_128[sampling_index]; + if (m4ac->frame_length_short) { + ics->swb_offset = ff_swb_offset_120[sampling_index]; + ics->num_swb = ff_aac_num_swb_120[sampling_index]; + } else { + ics->swb_offset = ff_swb_offset_128[sampling_index]; + ics->num_swb = ff_aac_num_swb_128[sampling_index]; + } ics->tns_max_bands = ff_tns_max_bands_128[sampling_index]; ics->predictor_present = 0; } else { @@ -1334,8 +1361,13 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics, if (!ics->num_swb || !ics->swb_offset) return AVERROR_BUG; } else { - ics->swb_offset = ff_swb_offset_1024[sampling_index]; - ics->num_swb = ff_aac_num_swb_1024[sampling_index]; + if (m4ac->frame_length_short) { + ics->num_swb = ff_aac_num_swb_960[sampling_index]; + ics->swb_offset = ff_swb_offset_960[sampling_index]; + } else { + ics->num_swb = ff_aac_num_swb_1024[sampling_index]; + ics->swb_offset = ff_swb_offset_1024[sampling_index]; + } ics->tns_max_bands = ff_tns_max_bands_1024[sampling_index]; } if (aot != AOT_ER_AAC_ELD) { @@ -2356,6 +2388,13 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt, if (!che) { av_log(ac->avctx, AV_LOG_ERROR, "SBR was found before the first channel element.\n"); return res; + } else if (ac->oc[1].m4ac.frame_length_short) { + if (!ac->warned_960_sbr) + avpriv_report_missing_feature(ac->avctx, + "SBR with 960 frame length"); + ac->warned_960_sbr = 1; + skip_bits_long(gb, 8 * cnt - 4); + return res; } else if (!ac->oc[1].m4ac.sbr) { av_log(ac->avctx, AV_LOG_ERROR, "SBR signaled to be not-present but was found in the bitstream.\n"); skip_bits_long(gb, 8 * cnt - 4); @@ -2615,6 +2654,72 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce) } } +/** + * Conduct IMDCT and windowing. + */ +static void imdct_and_windowing_960(AACContext *ac, SingleChannelElement *sce) +{ +#if !USE_FIXED + IndividualChannelStream *ics = &sce->ics; + INTFLOAT *in = sce->coeffs; + INTFLOAT *out = sce->ret; + INTFLOAT *saved = sce->saved; + const INTFLOAT *swindow = ics->use_kb_window[0] ? AAC_RENAME(ff_aac_kbd_short_120) : AAC_RENAME(ff_sine_120); + const INTFLOAT *lwindow_prev = ics->use_kb_window[1] ? AAC_RENAME(ff_aac_kbd_long_960) : AAC_RENAME(ff_sine_960); + const INTFLOAT *swindow_prev = ics->use_kb_window[1] ? AAC_RENAME(ff_aac_kbd_short_120) : AAC_RENAME(ff_sine_120); + INTFLOAT *buf = ac->buf_mdct; + INTFLOAT *temp = ac->temp; + int i; + + // imdct + if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { + for (i = 0; i < 8; i++) + ac->mdct120->imdct_half(ac->mdct120, buf + i * 120, in + i * 128, 1); + } else { + ac->mdct960->imdct_half(ac->mdct960, buf, in, 1); + } + + /* window overlapping + * NOTE: To simplify the overlapping code, all 'meaningless' short to long + * and long to short transitions are considered to be short to short + * transitions. This leaves just two cases (long to long and short to short) + * with a little special sauce for EIGHT_SHORT_SEQUENCE. + */ + + if ((ics->window_sequence[1] == ONLY_LONG_SEQUENCE || ics->window_sequence[1] == LONG_STOP_SEQUENCE) && + (ics->window_sequence[0] == ONLY_LONG_SEQUENCE || ics->window_sequence[0] == LONG_START_SEQUENCE)) { + ac->fdsp->vector_fmul_window( out, saved, buf, lwindow_prev, 480); + } else { + memcpy( out, saved, 420 * sizeof(*out)); + + if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { + ac->fdsp->vector_fmul_window(out + 420 + 0*120, saved + 420, buf + 0*120, swindow_prev, 60); + ac->fdsp->vector_fmul_window(out + 420 + 1*120, buf + 0*120 + 60, buf + 1*120, swindow, 60); + ac->fdsp->vector_fmul_window(out + 420 + 2*120, buf + 1*120 + 60, buf + 2*120, swindow, 60); + ac->fdsp->vector_fmul_window(out + 420 + 3*120, buf + 2*120 + 60, buf + 3*120, swindow, 60); + ac->fdsp->vector_fmul_window(temp, buf + 3*120 + 60, buf + 4*120, swindow, 60); + memcpy( out + 420 + 4*120, temp, 60 * sizeof(*out)); + } else { + ac->fdsp->vector_fmul_window(out + 420, saved + 420, buf, swindow_prev, 60); + memcpy( out + 540, buf + 60, 420 * sizeof(*out)); + } + } + + // buffer update + if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { + memcpy( saved, temp + 60, 60 * sizeof(*saved)); + ac->fdsp->vector_fmul_window(saved + 60, buf + 4*120 + 60, buf + 5*120, swindow, 60); + ac->fdsp->vector_fmul_window(saved + 180, buf + 5*120 + 60, buf + 6*120, swindow, 60); + ac->fdsp->vector_fmul_window(saved + 300, buf + 6*120 + 60, buf + 7*120, swindow, 60); + memcpy( saved + 420, buf + 7*120 + 60, 60 * sizeof(*saved)); + } else if (ics->window_sequence[0] == LONG_START_SEQUENCE) { + memcpy( saved, buf + 480, 420 * sizeof(*saved)); + memcpy( saved + 420, buf + 7*120 + 60, 60 * sizeof(*saved)); + } else { // LONG_STOP or ONLY_LONG + memcpy( saved, buf + 480, 480 * sizeof(*saved)); + } +#endif +} static void imdct_and_windowing_ld(AACContext *ac, SingleChannelElement *sce) { IndividualChannelStream *ics = &sce->ics; @@ -2766,7 +2871,10 @@ static void spectral_to_sample(AACContext *ac, int samples) imdct_and_window = imdct_and_windowing_eld; break; default: - imdct_and_window = ac->imdct_and_windowing; + if (ac->oc[1].m4ac.frame_length_short) + imdct_and_window = imdct_and_windowing_960; + else + imdct_and_window = ac->imdct_and_windowing; } for (type = 3; type >= 0; type--) { for (i = 0; i < MAX_ELEM_ID; i++) { @@ -3010,7 +3118,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, err = AVERROR_INVALIDDATA; goto fail; } - samples = 1024; + samples = ac->oc[1].m4ac.frame_length_short ? 960 : 1024; che->present = 1; } @@ -3237,7 +3345,9 @@ static av_cold int aac_decode_close(AVCodecContext *avctx) ff_mdct_end(&ac->mdct_ld); ff_mdct_end(&ac->mdct_ltp); #if !USE_FIXED + ff_mdct15_uninit(&ac->mdct120); ff_mdct15_uninit(&ac->mdct480); + ff_mdct15_uninit(&ac->mdct960); #endif av_freep(&ac->fdsp); return 0; diff --git a/libavcodec/aactab.c b/libavcodec/aactab.c index 77d8732c47..df551b058f 100644 --- a/libavcodec/aactab.c +++ b/libavcodec/aactab.c @@ -37,6 +37,8 @@ float ff_aac_pow34sf_tab[428]; DECLARE_ALIGNED(32, float, ff_aac_kbd_long_1024)[1024]; DECLARE_ALIGNED(32, float, ff_aac_kbd_short_128)[128]; +DECLARE_ALIGNED(32, float, ff_aac_kbd_long_960)[960]; +DECLARE_ALIGNED(32, float, ff_aac_kbd_short_120)[120]; DECLARE_ALIGNED(32, int, ff_aac_kbd_long_1024_fixed)[1024]; DECLARE_ALIGNED(32, int, ff_aac_kbd_short_128_fixed)[128]; @@ -44,6 +46,10 @@ const uint8_t ff_aac_num_swb_1024[] = { 41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40, 40 }; +const uint8_t ff_aac_num_swb_960[] = { + 40, 40, 46, 49, 49, 49, 46, 46, 42, 42, 42, 40, 40 +}; + const uint8_t ff_aac_num_swb_512[] = { 0, 0, 0, 36, 36, 37, 31, 31, 0, 0, 0, 0, 0 }; @@ -56,6 +62,10 @@ const uint8_t ff_aac_num_swb_128[] = { 12, 12, 12, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15 }; +const uint8_t ff_aac_num_swb_120[] = { + 12, 12, 12, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15 +}; + const uint8_t ff_aac_pred_sfb_max[] = { 33, 33, 38, 40, 40, 40, 41, 41, 37, 37, 37, 34, 34 }; @@ -1229,6 +1239,100 @@ static const uint16_t swb_offset_128_8[] = { 36, 44, 52, 60, 72, 88, 108, 128 }; +static const uint16_t swb_offset_960_96[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, + 40, 44, 48, 52, 56, 64, 72, 80, 88, 96, + 108, 120, 132, 144, 156, 172, 188, 212, 240, 276, + 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, + 960 +}; + +static const uint16_t swb_offset_960_64[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, + 40, 44, 48, 52, 56, 64, 72, 80, 88, 100, + 112, 124, 140, 156, 172, 192, 216, 240, 268, 304, + 344, 384, 424, 464, 504, 544, 584, 624, 664, 704, + 744, 784, 824, 864, 904, 944, 960 +}; + +static const uint16_t swb_offset_960_48[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, + 40, 48, 56, 64, 72, 80, 88, 96, 108, 120, + 132, 144, 160, 176, 196, 216, 240, 264, 292, 320, + 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, + 672, 704, 736, 768, 800, 832, 864, 896, 928, 960 +}; + +static const uint16_t swb_offset_960_32[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, + 40, 48, 56, 64, 72, 80, 88, 96, 108, 120, + 132, 144, 160, 176, 196, 216, 240, 264, 292, 320, + 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, + 672, 704, 736, 768, 800, 832, 864, 896, 928, 960 +}; + +static const uint16_t swb_offset_960_24[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, + 40, 44, 52, 60, 68, 76, 84, 92, 100, 108, + 116, 124, 136, 148, 160, 172, 188, 204, 220, 240, + 260, 284, 308, 336, 364, 396, 432, 468, 508, 552, + 600, 652, 704, 768, 832, 896, 960 +}; + +static const uint16_t swb_offset_960_16[] = +{ + 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, + 80, 88, 100, 112, 124, 136, 148, 160, 172, 184, + 196, 212, 228, 244, 260, 280, 300, 320, 344, 368, + 396, 424, 456, 492, 532, 572, 616, 664, 716, 772, + 832, 896, 960 +}; + +static const uint16_t swb_offset_960_8[] = +{ + 0, 12, 24, 36, 48, 60, 72, 84, 96, 108, + 120, 132, 144, 156, 172, 188, 204, 220, 236, 252, + 268, 288, 308, 328, 348, 372, 396, 420, 448, 476, + 508, 544, 580, 620, 664, 712, 764, 820, 880, 944, + 960 +}; + + +static const uint16_t swb_offset_120_96[] = +{ + 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 120 +}; + +static const uint16_t swb_offset_120_64[] = +{ + 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 120 +}; + +static const uint16_t swb_offset_120_48[] = +{ + 0, 4, 8, 12, 16, 20, 28, 36, 44, 56, 68, 80, 96, 112, 120 +}; + +static const uint16_t swb_offset_120_24[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 64, 76, 92, 108, 120 +}; + +static const uint16_t swb_offset_120_16[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 40, 48, 60, 72, 88, 108, 120 +}; + +static const uint16_t swb_offset_120_8[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 60, 72, 88, 108, 120 +}; + const uint16_t * const ff_swb_offset_1024[] = { swb_offset_1024_96, swb_offset_1024_96, swb_offset_1024_64, swb_offset_1024_48, swb_offset_1024_48, swb_offset_1024_32, @@ -1237,6 +1341,14 @@ const uint16_t * const ff_swb_offset_1024[] = { swb_offset_1024_8 }; +const uint16_t * const ff_swb_offset_960[] = { + swb_offset_960_96, swb_offset_960_96, swb_offset_960_64, + swb_offset_960_48, swb_offset_960_48, swb_offset_960_32, + swb_offset_960_24, swb_offset_960_24, swb_offset_960_16, + swb_offset_960_16, swb_offset_960_16, swb_offset_960_8, + swb_offset_960_8 +}; + const uint16_t * const ff_swb_offset_512[] = { NULL, NULL, NULL, swb_offset_512_48, swb_offset_512_48, swb_offset_512_32, @@ -1263,6 +1375,14 @@ const uint16_t * const ff_swb_offset_128[] = { swb_offset_128_8 }; +const uint16_t * const ff_swb_offset_120[] = { + swb_offset_120_96, swb_offset_120_96, swb_offset_120_96, + swb_offset_120_48, swb_offset_120_48, swb_offset_120_48, + swb_offset_120_24, swb_offset_120_24, swb_offset_120_16, + swb_offset_120_16, swb_offset_120_16, swb_offset_120_8, + swb_offset_120_8 +}; + // @} /* @name ff_tns_max_bands diff --git a/libavcodec/aactab.h b/libavcodec/aactab.h index 48ca0fd163..7cd8128231 100644 --- a/libavcodec/aactab.h +++ b/libavcodec/aactab.h @@ -136,6 +136,8 @@ static const INTFLOAT * const tns_tmp2_map[4] = { */ DECLARE_ALIGNED(32, extern float, ff_aac_kbd_long_1024)[1024]; DECLARE_ALIGNED(32, extern float, ff_aac_kbd_short_128)[128]; +DECLARE_ALIGNED(32, extern float, ff_aac_kbd_long_960)[960]; +DECLARE_ALIGNED(32, extern float, ff_aac_kbd_short_120)[120]; DECLARE_ALIGNED(32, extern int, ff_aac_kbd_long_1024_fixed)[1024]; DECLARE_ALIGNED(32, extern int, ff_aac_kbd_long_512_fixed)[512]; DECLARE_ALIGNED(32, extern int, ff_aac_kbd_short_128_fixed)[128]; @@ -149,9 +151,11 @@ DECLARE_ALIGNED(32, extern const int, ff_aac_eld_window_480_fixed)[1800]; * @{ */ extern const uint8_t ff_aac_num_swb_1024[]; +extern const uint8_t ff_aac_num_swb_960 []; extern const uint8_t ff_aac_num_swb_512 []; extern const uint8_t ff_aac_num_swb_480 []; extern const uint8_t ff_aac_num_swb_128 []; +extern const uint8_t ff_aac_num_swb_120 []; // @} extern const uint8_t ff_aac_pred_sfb_max []; @@ -168,9 +172,11 @@ extern const float *ff_aac_codebook_vector_vals[]; extern const uint16_t *ff_aac_codebook_vector_idx[]; extern const uint16_t * const ff_swb_offset_1024[13]; +extern const uint16_t * const ff_swb_offset_960 [13]; extern const uint16_t * const ff_swb_offset_512 [13]; extern const uint16_t * const ff_swb_offset_480 [13]; extern const uint16_t * const ff_swb_offset_128 [13]; +extern const uint16_t * const ff_swb_offset_120 [13]; extern const uint8_t ff_tns_max_bands_1024[13]; extern const uint8_t ff_tns_max_bands_512 [13]; diff --git a/libavcodec/sinewin.h b/libavcodec/sinewin.h index 27c107ce59..6b97a7185f 100644 --- a/libavcodec/sinewin.h +++ b/libavcodec/sinewin.h @@ -52,14 +52,16 @@ void AAC_RENAME(ff_init_ff_sine_windows)(int index); extern SINETABLE( 32); extern SINETABLE( 64); +extern SINETABLE( 120); extern SINETABLE( 128); extern SINETABLE( 256); extern SINETABLE( 512); +extern SINETABLE( 960); extern SINETABLE(1024); extern SINETABLE(2048); extern SINETABLE(4096); extern SINETABLE(8192); -extern SINETABLE_CONST INTFLOAT * const AAC_RENAME(ff_sine_windows)[14]; +extern SINETABLE_CONST INTFLOAT * const AAC_RENAME(ff_sine_windows)[16]; #endif /* AVCODEC_SINEWIN_H */ diff --git a/libavcodec/sinewin_tablegen.h b/libavcodec/sinewin_tablegen.h index 4432135f19..30c8cbf769 100644 --- a/libavcodec/sinewin_tablegen.h +++ b/libavcodec/sinewin_tablegen.h @@ -34,9 +34,11 @@ #if !CONFIG_HARDCODED_TABLES SINETABLE( 32); SINETABLE( 64); +SINETABLE( 120); SINETABLE( 128); SINETABLE( 256); SINETABLE( 512); +SINETABLE( 960); SINETABLE(1024); SINETABLE(2048); SINETABLE(4096); @@ -59,7 +61,8 @@ SINETABLE_CONST INTFLOAT * const AAC_RENAME(ff_sine_windows)[] = { NULL, NULL, NULL, NULL, NULL, // unused AAC_RENAME(ff_sine_32) , AAC_RENAME(ff_sine_64), AAC_RENAME(ff_sine_128), AAC_RENAME(ff_sine_256), AAC_RENAME(ff_sine_512), AAC_RENAME(ff_sine_1024), - AAC_RENAME(ff_sine_2048), AAC_RENAME(ff_sine_4096), AAC_RENAME(ff_sine_8192) + AAC_RENAME(ff_sine_2048), AAC_RENAME(ff_sine_4096), AAC_RENAME(ff_sine_8192), + AAC_RENAME(ff_sine_120), AAC_RENAME(ff_sine_960), }; // Generate a sine window.