Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] avcodec/vorbisdec: Move ff_vorbis_inverse_coupling() to vorbisdsp.c
Date: Mon, 19 Sep 2022 14:18:11 -0300
Message-ID: <cb9c8f61-c394-597b-144f-1ac2669658cc@gmail.com> (raw)
In-Reply-To: <GV1P250MB07376D1190901383E5E53C2A8F4D9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM>

On 9/19/2022 2:16 PM, Andreas Rheinhardt wrote:
> Only used there. Also make it static.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>   libavcodec/vorbis.h    |  1 -
>   libavcodec/vorbisdec.c | 23 -----------------------
>   libavcodec/vorbisdsp.c | 26 ++++++++++++++++++++++++--
>   3 files changed, 24 insertions(+), 26 deletions(-)
> 
> diff --git a/libavcodec/vorbis.h b/libavcodec/vorbis.h
> index 270855da04..0dd109dd2e 100644
> --- a/libavcodec/vorbis.h
> +++ b/libavcodec/vorbis.h
> @@ -45,7 +45,6 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num);
>   void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
>                                     uint16_t *y_list, int *flag,
>                                     int multiplier, float * out, int samples);
> -void ff_vorbis_inverse_coupling(float *mag, float *ang, ptrdiff_t blocksize);
>   
>   #define ilog(i) av_log2(2*(i))
>   
> diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
> index 72b8e8e15b..0d04e7c2c4 100644
> --- a/libavcodec/vorbisdec.c
> +++ b/libavcodec/vorbisdec.c
> @@ -1579,29 +1579,6 @@ static inline int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr,
>       }
>   }
>   
> -void ff_vorbis_inverse_coupling(float *mag, float *ang, ptrdiff_t blocksize)
> -{
> -    for (ptrdiff_t i = 0;  i < blocksize;  i++) {
> -        float angi = ang[i], magi = mag[i];
> -
> -        if (magi > 0.f) {
> -            if (angi > 0.f) {
> -                ang[i] = magi - angi;
> -            } else {
> -                ang[i] = magi;
> -                mag[i] = magi + angi;
> -            }
> -        } else {
> -            if (angi > 0.f) {
> -                ang[i] = magi + angi;
> -            } else {
> -                ang[i] = magi;
> -                mag[i] = magi - angi;
> -            }
> -        }
> -    }
> -}
> -
>   // Decode the audio packet using the functions above
>   
>   static int vorbis_parse_audio_packet(vorbis_context *vc, float **floor_ptr)
> diff --git a/libavcodec/vorbisdsp.c b/libavcodec/vorbisdsp.c
> index e94b65cb7b..693c44dfcb 100644
> --- a/libavcodec/vorbisdsp.c
> +++ b/libavcodec/vorbisdsp.c
> @@ -19,11 +19,33 @@
>   #include "config.h"
>   #include "libavutil/attributes.h"
>   #include "vorbisdsp.h"
> -#include "vorbis.h"
> +
> +static void vorbis_inverse_coupling_c(float *mag, float *ang, ptrdiff_t blocksize)
> +{
> +    for (ptrdiff_t i = 0;  i < blocksize;  i++) {
> +        float angi = ang[i], magi = mag[i];
> +
> +        if (magi > 0.f) {
> +            if (angi > 0.f) {
> +                ang[i] = magi - angi;
> +            } else {
> +                ang[i] = magi;
> +                mag[i] = magi + angi;
> +            }
> +        } else {
> +            if (angi > 0.f) {
> +                ang[i] = magi + angi;
> +            } else {
> +                ang[i] = magi;
> +                mag[i] = magi - angi;
> +            }
> +        }
> +    }
> +}
>   
>   av_cold void ff_vorbisdsp_init(VorbisDSPContext *dsp)
>   {
> -    dsp->vorbis_inverse_coupling = ff_vorbis_inverse_coupling;
> +    dsp->vorbis_inverse_coupling = vorbis_inverse_coupling_c;
>   
>   #if ARCH_AARCH64
>       ff_vorbisdsp_init_aarch64(dsp);

LGTM.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

      reply	other threads:[~2022-09-19 17:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19 17:16 Andreas Rheinhardt
2022-09-19 17:18 ` James Almer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb9c8f61-c394-597b-144f-1ac2669658cc@gmail.com \
    --to=jamrial@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git