[FFmpeg-devel] this is the gsos qualification task which use psychoacoustic system to detect transients in vorbis encoder.

Submitted by Ruyi Ji on April 17, 2017, 2:23 a.m.

Details

Message ID CAOOv6YO+7tMM+zxJMYjoW4xvt0VEnQU1Pe4Dbksk8J7XtZk_6g@mail.gmail.com
State New
Headers show

Commit Message

Ruyi Ji April 17, 2017, 2:23 a.m.
Hi, I am sorry for my mistakes. I have fixed them. And attachment is the
patch which fix error in first one. Thanks.


2017-04-16 15:25 GMT-04:00 Michael Niedermayer <michael@niedermayer.cc>:

> On Sun, Apr 16, 2017 at 09:19:33AM -0400, Ruyi Ji wrote:
> > Signed-off-by: Ruyi Ji <jiruyi1@gmail.com>
> > ---
> >  libavcodec/psymodel.c        |   1 +
> >  libavcodec/vorbis_enc_data.h | 111 ++++++++++++++++++++++++++++++
> +++++++++++++
> >  libavcodec/vorbisenc.c       |  60 +++++++++++++++++++++++
> >  3 files changed, 172 insertions(+)
>
> This seems to fail to build here
>
> CC      libavcodec/vorbisenc.o
> libavcodec/vorbisenc.c:133:45: error: ‘MAX_CHANNELS’ undeclared here (not
> in a function)
> libavcodec/vorbisenc.c: In function ‘vorbis_encode_frame’:
> libavcodec/vorbisenc.c:1057:25: error: expected ‘;’ before ‘if’
> libavcodec/vorbisenc.c: In function ‘vorbis_encode_close’:
> libavcodec/vorbisenc.c:1196:9: error: incompatible type for argument 1 of
> ‘ff_psy_end’
> libavcodec/psymodel.h:176:6: note: expected ‘struct FFPsyContext *’ but
> argument is of type ‘FFPsyContext’
> make: *** [libavcodec/vorbisenc.o] Error 1
> make: Target `all' not remade because of errors.
>
>
> >
> > diff --git a/libavcodec/psymodel.c b/libavcodec/psymodel.c
> > index 2b5f111..2e11c48 100644
> > --- a/libavcodec/psymodel.c
> > +++ b/libavcodec/psymodel.c
> > @@ -62,6 +62,7 @@ av_cold int ff_psy_init(FFPsyContext *ctx,
> AVCodecContext *avctx, int num_lens,
> >
> >      switch (ctx->avctx->codec_id) {
> >      case AV_CODEC_ID_AAC:
> > +     case AV_CODEC_ID_VORBIS:
> >          ctx->model = &ff_aac_psy_model;
>
> tabs are forbidden in ffmpeg-git except where needed for syntax
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> In fact, the RIAA has been known to suggest that students drop out
> of college or go to community college in order to be able to afford
> settlements. -- The RIAA
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>

Comments

Michael Niedermayer April 19, 2017, 6:47 p.m.
On Sun, Apr 16, 2017 at 10:23:05PM -0400, 汲如意 wrote:
> Hi, I am sorry for my mistakes. I have fixed them. And attachment is the
> patch which fix error in first one. Thanks.

this segfaults

make fate-vorbis-encode

ffmpeg  -i fate-suite//audio-reference/luckynight_2ch_44kHz_s16.wav -c:a vorbis -strict experimental -f ogg -y vorbis-encode.ogg

also please send complete patches and not a patch + a bugfix on top of
it

==30596== Conditional jump or move depends on uninitialised value(s)
==30596==    at 0xF3736B: ff_psy_init (psymodel.c:59)
==30596==    by 0xBBAFFD: vorbis_encode_init (vorbisenc.c:1250)
==30596==    by 0xB61BC5: avcodec_open2 (utils.c:1001)
==30596==    by 0x43695D: init_output_stream (ffmpeg.c:3427)
==30596==    by 0x42E562: reap_filters (ffmpeg.c:1441)
==30596==    by 0x43ACAA: transcode_step (ffmpeg.c:4511)
==30596==    by 0x43AD8E: transcode (ffmpeg.c:4555)
==30596==    by 0x43B563: main (ffmpeg.c:4760)
==30596==
==30596== Invalid write of size 8
==30596==    at 0xF3732A: ff_psy_init (psymodel.c:60)
==30596==    by 0xBBAFFD: vorbis_encode_init (vorbisenc.c:1250)
==30596==    by 0xB61BC5: avcodec_open2 (utils.c:1001)
==30596==    by 0x43695D: init_output_stream (ffmpeg.c:3427)
==30596==    by 0x42E562: reap_filters (ffmpeg.c:1441)
==30596==    by 0x43ACAA: transcode_step (ffmpeg.c:4511)
==30596==    by 0x43AD8E: transcode (ffmpeg.c:4555)
==30596==    by 0x43B563: main (ffmpeg.c:4760)
==30596==  Address 0x108c1508 is 0 bytes after a block of size 296 alloc'd
==30596==    at 0x4C2A6C5: memalign (vg_replace_malloc.c:727)
==30596==    by 0x4C2A760: posix_memalign (vg_replace_malloc.c:876)
==30596==    by 0x10C17CB: av_malloc (mem.c:87)
==30596==    by 0x10C1A73: av_mallocz (mem.c:224)
==30596==    by 0xF3713B: av_mallocz_array (mem.h:233)
==30596==    by 0xF371A3: ff_psy_init (psymodel.c:39)
==30596==    by 0xBBAFFD: vorbis_encode_init (vorbisenc.c:1250)
==30596==    by 0xB61BC5: avcodec_open2 (utils.c:1001)
==30596==    by 0x43695D: init_output_stream (ffmpeg.c:3427)
==30596==    by 0x42E562: reap_filters (ffmpeg.c:1441)
==30596==    by 0x43ACAA: transcode_step (ffmpeg.c:4511)
==30596==    by 0x43AD8E: transcode (ffmpeg.c:4555)
==30596==
--30596-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV) - exiting
--30596-- si_code=1;  Faulting address: 0x211ADB50;  sp: 0x4046efd50


[...]

Patch hide | download patch | download mbox

From 2629cada2ed6aa843736762cfe536c4489628272 Mon Sep 17 00:00:00 2001
From: Ruyi Ji <jiruyi1@gmail.com>
Date: Sun, 16 Apr 2017 21:41:44 -0400
Subject: [PATCH 2/2] this patch is one can build.

Signed-off-by: Ruyi Ji <jiruyi1@gmail.com>
---
 libavcodec/vorbisenc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c
index 9f1adf8..09ad446 100644
--- a/libavcodec/vorbisenc.c
+++ b/libavcodec/vorbisenc.c
@@ -98,6 +98,8 @@  typedef struct vorbis_enc_mode {
     int mapping;
 } vorbis_enc_mode;
 
+#define MAX_CHANNELS     2
+
 typedef struct vorbis_enc_context {
     int channels;
     int sample_rate;
@@ -133,7 +135,6 @@  typedef struct vorbis_enc_context {
 	enum WindowSequence window_sequence[MAX_CHANNELS];
 } vorbis_enc_context;
 
-#define MAX_CHANNELS     2
 #define MAX_CODEBOOK_DIM 8
 
 #define MAX_FLOOR_CLASS_DIM  4
@@ -1053,7 +1054,7 @@  static int vorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
 			cur_channel = start_ch + ch;
 			overlap = &audio[cur_channel][0];
 			samples2 = overlap + 1024;
-			la = samples2 + (448 + 64)
+			la = samples2 + (448 + 64);
 			if (!frame)
 				la = NULL;
 			wi[ch] = venc->psy.model->window(&venc->psy, samples2, la, cur_channel, venc->window_sequence[0]);
@@ -1193,7 +1194,7 @@  static av_cold int vorbis_encode_close(AVCodecContext *avctx)
     ff_mdct_end(&venc->mdct[0]);
     ff_mdct_end(&venc->mdct[1]);
 
-	ff_psy_end(venc->psy);
+	ff_psy_end(&venc->psy);
 	
 	if (venc->psypp)
 		ff_psy_preprocess_end(venc->psypp);
-- 
1.9.1