From patchwork Mon Mar 27 02:57:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Jones X-Patchwork-Id: 3112 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.50.79 with SMTP id y76csp1029701vsy; Sun, 26 Mar 2017 20:05:21 -0700 (PDT) X-Received: by 10.223.169.210 with SMTP id b76mr6101315wrd.197.1490583920983; Sun, 26 Mar 2017 20:05:20 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l42si11638994wrc.6.2017.03.26.20.05.20; Sun, 26 Mar 2017 20:05:20 -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; 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 9AB306882C1; Mon, 27 Mar 2017 06:04:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-it0-f66.google.com (mail-it0-f66.google.com [209.85.214.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 47B3468094E for ; Mon, 27 Mar 2017 06:04:50 +0300 (EEST) Received: by mail-it0-f66.google.com with SMTP id 76so8937695itj.0 for ; Sun, 26 Mar 2017 20:05:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=M0uY4MteNTd/PrMgitmBZKzXh2QzHUfpd1TMDONnZMU=; b=d/rKRkNWgiNPePa/Q63AreaHjE9a745Wz+vp+6ecmDcUKiIxuWkx7YNWEfk+4iyX9C ZgOTcdR/FwmGOAeVY8fNP2rSM3DRaVrAfUBavXNCxIIKvyekK27IdV0nxlnTJiE+pNmO TmT7FPuhrpQG82W5rVVvmNaUmv1Jy7ZSB+iOCbloOzhd7CRMt6E7T1fwr32oN03qJFhU tD5BPXzUHD8cZltQwz5Zip02ZMzqII+f3Gu8zwSWWfWke5q6VkQpVBDUthDKsMjbHRAK 3SPZ9LY5FljYiNeykiEUqGhTKZZ6tkP8/Pdp2yWhZu7StdsPk4dPdrcBj2L4o+jUhSZ1 CPeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=M0uY4MteNTd/PrMgitmBZKzXh2QzHUfpd1TMDONnZMU=; b=QfbJ+EfWHMUD7mKSpZYfgC+tR3kZkDs3DPfGRTbZV7rbtgC/Ql0A0TfLW519w3Ieok KO1EfeN7A7XsY6Qq/rCXjOSi2hD0NDimnzDE9X5MZV+c2e8Z0yYb7qYNN5E/e1KEKJWU 0ifIdA76TSTrV082d1epDf6KKokL72hZsqx6tSMh6RkW2+jHqzhs1MIV6QO5NTzoMEiC 5DnYp0/BiXZr/YqRYqQS4fil5JZCKz81QtwZ6uEyjM76lb9qziMfW9iYNmhNax7HU9ve Nn4FQ2GdhU0TrUI/Exso5u7S7pVq0+Jb43EtVwwvneziLRf0EhPr/hAHkkUaDuK8+R+Q miCQ== X-Gm-Message-State: AFeK/H0/UP+lwwNlfex7jy0JPDy45nbZzP4hyZmq/rEHyUNEJE399U5JsY+ZolkSVnVcXw== X-Received: by 10.36.127.132 with SMTP id r126mr8292362itc.57.1490583470767; Sun, 26 Mar 2017 19:57:50 -0700 (PDT) Received: from tdjones879 (host-184-167-177-46.csp-wy.client.bresnan.net. [184.167.177.46]) by smtp.gmail.com with ESMTPSA id i197sm5036679ioi.7.2017.03.26.19.57.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Mar 2017 19:57:49 -0700 (PDT) Date: Sun, 26 Mar 2017 20:57:47 -0600 From: Tyler Jones To: ffmpeg-devel@ffmpeg.org Message-ID: <20170327025747.GA1654@tdjones879> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/vorbis_enc_data: Include scalewidth band factors 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Scale factors are copied from the AAC encoder tabulated data. Including the AAC tabulated header includes files that cause improper framing bits to be put in the header and an improper end of file. Providing this for the vorbis encoder is necessary to use the existing AAC psychoacoustic system. Window size is currently only assumed to be 1024 with the vorbis encoder. This is part of a GSoC qualification task. Signed-off-by: Tyler Jones --- libavcodec/vorbis_enc_data.h | 108 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/libavcodec/vorbis_enc_data.h b/libavcodec/vorbis_enc_data.h index a51aaec..d65e7cc 100644 --- a/libavcodec/vorbis_enc_data.h +++ b/libavcodec/vorbis_enc_data.h @@ -501,4 +501,112 @@ static const struct { { 3, 2, 3, { -1, 12, 13, 14 } }, }; +static const uint8_t swb_size_128_96[] = { + 4, 4, 4, 4, 4, 4, 8, 8, 8, 16, 28, 36 +}; + +static const uint8_t swb_size_128_64[] = { + 4, 4, 4, 4, 4, 4, 8, 8, 8, 16, 28, 36 +}; + +static const uint8_t swb_size_128_48[] = { + 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16 +}; + +static const uint8_t swb_size_128_24[] = { + 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 16, 16, 20 +}; + +static const uint8_t swb_size_128_16[] = { + 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 12, 12, 16, 20, 20 +}; + +static const uint8_t swb_size_128_8[] = { + 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 12, 16, 20, 20 +}; + +static const uint8_t swb_size_1024_96[] = { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, + 12, 12, 12, 12, 12, 16, 16, 24, 28, 36, 44, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 +}; + +static const uint8_t swb_size_1024_64[] = { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, + 12, 12, 12, 16, 16, 16, 20, 24, 24, 28, 36, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 +}; + +static const uint8_t swb_size_1024_48[] = { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, + 12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28, 28, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 96 +}; + +static const uint8_t swb_size_1024_32[] = { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, + 12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28, 28, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 +}; + +static const uint8_t swb_size_1024_24[] = { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 12, 12, 12, 12, 16, 16, 16, 20, 20, 24, 24, 28, 28, + 32, 36, 36, 40, 44, 48, 52, 52, 64, 64, 64, 64, 64 +}; + +static const uint8_t swb_size_1024_16[] = { + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 20, 20, 20, 24, 24, 28, 28, + 32, 36, 40, 40, 44, 48, 52, 56, 60, 64, 64, 64 +}; + +static const uint8_t swb_size_1024_8[] = { + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 16, 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 24, 24, 24, 28, 28, + 32, 36, 36, 40, 44, 48, 52, 56, 60, 64, 80 +}; + +const uint8_t *ff_vorbis_swb_size_128[] = { + swb_size_128_96, swb_size_128_96, swb_size_128_64, + swb_size_128_48, swb_size_128_48, swb_size_128_48, + swb_size_128_24, swb_size_128_24, swb_size_128_16, + swb_size_128_16, swb_size_128_16, swb_size_128_8, + swb_size_128_8 +}; + +const uint8_t *ff_vorbis_swb_size_1024[] = { + swb_size_1024_96, swb_size_1024_96, swb_size_1024_64, + swb_size_1024_48, swb_size_1024_48, swb_size_1024_32, + swb_size_1024_24, swb_size_1024_24, swb_size_1024_16, + swb_size_1024_16, swb_size_1024_16, swb_size_1024_8, + swb_size_1024_8 +}; + +const int ff_vorbis_swb_size_128_len = FF_ARRAY_ELEMS(ff_vorbis_swb_size_128); +const int ff_vorbis_swb_size_1024_len = FF_ARRAY_ELEMS(ff_vorbis_swb_size_1024); + +/* duplicated from avpriv_mpeg4audio_sample_rates to avoid shared build + * failures */ +static const int mpeg4audio_sample_rates[16] = { + 96000, 88200, 64000, 48000, 44100, 32000, + 24000, 22050, 16000, 12000, 11025, 8000, 7350 +}; + +enum WindowSequence { + ONLY_LONG_SEQUENCE, + LONG_START_SEQUENCE, + EIGHT_SHORT_SEQUENCE, + LONG_STOP_SEQUENCE, +}; + +const uint8_t ff_vorbis_num_swb_1024[] = { + 41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40, 40 +}; + +const uint8_t ff_vorbis_num_swb_128[] = { + 12, 12, 12, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15 +}; + #endif /* AVCODEC_VORBIS_ENC_DATA_H */