Re: [libav-devel] [Announcement] FFmtech board of directors election

2011-05-17 Thread Aℓex Converse
On Mon, May 9, 2011 at 2:50 PM, Benjamin Larsson ba...@ludd.ltu.se wrote:
 Hi, it's time to elect a new board for the FFmtech foundation. If you
 want to candidate or participate in electing the new board then please
 respond to this email. To be eligible for this you must fulfil the
 following.

 People who had svn accounts and were active in the last year are
 allowed to vote, in case of contention the board can decide.

 (FFmpeg repository svn account. And last year since the meeting on March
 19th 2011)


 The time line for this is 2 weeks for responding that you intend to
 either candidate or partake in the voting. Then 5 days for the
 candidates to present them self’s and then 2 days for the election
 process. If all goes according to plan we will have a new board by the
 end of May.


I wish to vote, and I nominate myself as a candidate for the board.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH/RFC] fps probsize

2011-05-13 Thread Aℓex Converse
On Fri, May 13, 2011 at 1:49 PM, Ronald S. Bultje rsbul...@gmail.com wrote:
 Hi,

 2011/5/13 Aℓex Converse aconve...@google.com:
 On Fri, May 13, 2011 at 1:32 PM, Ronald S. Bultje rsbul...@gmail.com wrote:
 Hi,

 2011/5/12 Aℓex Converse aconve...@google.com:
 2011/5/9 Aℓex Converse aconve...@google.com:
 The attached patch adds a command line option -fpsprobesize to
 specify the number of frames used in fps estimation.

 Currently some 29.97 fps FLV files are detected as 59.92 fps.

 Feel free to play with this spreadsheet to understand the issue:

 https://spreadsheets.google.com/ccc?key=0Ah8DDuo3xisxdDZOQWRWc3ZjLV9zdzZnM0hvVkZ2enchl=enauthkey=CKCX3v4D

 The Lag parameter adjusts where the file starts. When score is
 negative 59.92 fps is detected. Look how just playing with lag effects
 detection when only a few frames are used.


 Ping?

 FWIW lag=1 seems to be our most common case as we ignore the first
 frame's duration.
 [..]
 @@ -2217,19 +2217,12 @@ int av_find_stream_info(AVFormatContext *ic)

          /* check if one codec still needs to be handled */
          for(i=0;iic-nb_streams;i++) {
 -            int fps_analyze_framecount = 20;
 -
              st = ic-streams[i];
              if (!has_codec_parameters(st-codec))
                  break;
 -            /* if the timebase is coarse (like the usual millisecond 
 precision
 -               of mkv), we need to analyze more frames to reliably arrive 
 at
 -               the correct fps */
 -            if (av_q2d(st-time_base)  0.0005)
 -                fps_analyze_framecount *= 2;
              /* variable fps and no guess at the real fps */
              if(   tb_unreliable(st-codec)  !(st-r_frame_rate.num  
 st-avg_frame_rate.num)
 -                st-info-duration_count  fps_analyze_framecount
 +                st-info-duration_count  ic-fpsprobesize
                  st-codec-codec_type == AVMEDIA_TYPE_VIDEO)
                  break;
              if(st-parser  st-parser-parser-split  
 !st-codec-extradata)

 I'm not sure if removing the *2 workaround for mkv is a good idea
 here, especially not if we didn't explicitely specify a value on the
 commandline. It'll basically break mkv fps detection again (at least
 29.97) by default.

 MKV/FLV detection for 29.97 is still broken. It just happens to work
 better now with a handful of files (and worse for many others. I have
 many files that were being detected at 29.97 fps that are now being
 detected as 59.91 fps). The spreadsheet can tell you more.

 Ugh... This is a big problem. The more reason why we need a proper
 testsuite for this kind of stuff.

 So now what do we do? I can just see the insults flying around if we
 break this again. Is there some way to workaround it?...


I can use a default to preserve the current voodoo values.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH/RFC] fps probsize

2011-05-13 Thread Aℓex Converse
2011/5/13 Aℓex Converse aconve...@google.com:
 On Fri, May 13, 2011 at 1:49 PM, Ronald S. Bultje rsbul...@gmail.com wrote:
 Hi,

 2011/5/13 Aℓex Converse aconve...@google.com:
 On Fri, May 13, 2011 at 1:32 PM, Ronald S. Bultje rsbul...@gmail.com 
 wrote:
 Hi,

 2011/5/12 Aℓex Converse aconve...@google.com:
 2011/5/9 Aℓex Converse aconve...@google.com:
 The attached patch adds a command line option -fpsprobesize to
 specify the number of frames used in fps estimation.

 Currently some 29.97 fps FLV files are detected as 59.92 fps.

 Feel free to play with this spreadsheet to understand the issue:

 https://spreadsheets.google.com/ccc?key=0Ah8DDuo3xisxdDZOQWRWc3ZjLV9zdzZnM0hvVkZ2enchl=enauthkey=CKCX3v4D

 The Lag parameter adjusts where the file starts. When score is
 negative 59.92 fps is detected. Look how just playing with lag effects
 detection when only a few frames are used.


 Ping?

 FWIW lag=1 seems to be our most common case as we ignore the first
 frame's duration.
 [..]
 @@ -2217,19 +2217,12 @@ int av_find_stream_info(AVFormatContext *ic)

          /* check if one codec still needs to be handled */
          for(i=0;iic-nb_streams;i++) {
 -            int fps_analyze_framecount = 20;
 -
              st = ic-streams[i];
              if (!has_codec_parameters(st-codec))
                  break;
 -            /* if the timebase is coarse (like the usual millisecond 
 precision
 -               of mkv), we need to analyze more frames to reliably 
 arrive at
 -               the correct fps */
 -            if (av_q2d(st-time_base)  0.0005)
 -                fps_analyze_framecount *= 2;
              /* variable fps and no guess at the real fps */
              if(   tb_unreliable(st-codec)  !(st-r_frame_rate.num  
 st-avg_frame_rate.num)
 -                st-info-duration_count  fps_analyze_framecount
 +                st-info-duration_count  ic-fpsprobesize
                  st-codec-codec_type == AVMEDIA_TYPE_VIDEO)
                  break;
              if(st-parser  st-parser-parser-split  
 !st-codec-extradata)

 I'm not sure if removing the *2 workaround for mkv is a good idea
 here, especially not if we didn't explicitely specify a value on the
 commandline. It'll basically break mkv fps detection again (at least
 29.97) by default.

 MKV/FLV detection for 29.97 is still broken. It just happens to work
 better now with a handful of files (and worse for many others. I have
 many files that were being detected at 29.97 fps that are now being
 detected as 59.91 fps). The spreadsheet can tell you more.

 Ugh... This is a big problem. The more reason why we need a proper
 testsuite for this kind of stuff.

 So now what do we do? I can just see the insults flying around if we
 break this again. Is there some way to workaround it?...


 I can use a default to preserve the current voodoo values.


Updated to preserve voodoo
From 16b4b525f0c5652ed2515aba230f4466faf9f585 Mon Sep 17 00:00:00 2001
From: Alex Converse aconve...@google.com
Date: Mon, 9 May 2011 14:34:23 -0700
Subject: [PATCH] avformat: Add fpsprobesize as an AVOption.

---
 libavformat/avformat.h |5 +
 libavformat/options.c  |1 +
 libavformat/utils.c|2 ++
 3 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 7327562..0678aea 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -811,6 +811,11 @@ typedef struct AVFormatContext {
  * - decoding: Unused.
  */
 int64_t start_time_realtime;
+
+/**
+ * decoding: number of frames used to probe fps
+ */
+int fpsprobesize;
 } AVFormatContext;
 
 typedef struct AVPacketList {
diff --git a/libavformat/options.c b/libavformat/options.c
index bdf4796..ce22e81 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -57,6 +57,7 @@ static const AVOption options[]={
 {fdebug, print specific debug info, OFFSET(debug), FF_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, INT_MAX, E|D, fdebug},
 {ts, NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_FDEBUG_TS }, INT_MIN, INT_MAX, E|D, fdebug},
 {max_delay, maximum muxing or demuxing delay in microseconds, OFFSET(max_delay), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E|D},
+{fpsprobesize, number of frames used to probe fps, OFFSET(fpsprobesize), FF_OPT_TYPE_INT, -1, -1, INT_MAX-1, D},
 {NULL},
 };
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 67aa76a..e73e274 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2227,6 +2227,8 @@ int av_find_stream_info(AVFormatContext *ic)
the correct fps */
 if (av_q2d(st-time_base)  0.0005)
 fps_analyze_framecount *= 2;
+if (ic-fpsprobesize = 0)
+fps_analyze_framecount = ic-fpsprobesize;
 /* variable fps and no guess at the real fps */
 if(   tb_unreliable(st-codec)  !(st-r_frame_rate.num  st-avg_frame_rate.num)
 st-info-duration_count  fps_analyze_framecount

Re: [libav-devel] [PATCH] Add an aac sample which uses LTP to fate-aac.

2011-05-12 Thread Aℓex Converse
On Mon, May 9, 2011 at 3:42 PM, Ronald S. Bultje rsbul...@gmail.com wrote:
 Hi,

 2011/5/9 Måns Rullgård m...@mansr.com:
 Ronald S. Bultje rsbul...@gmail.com writes:

 Hi,

 2011/4/26 Måns Rullgård m...@mansr.com:
 Justin Ruggles justin.rugg...@gmail.com writes:

 ---
 Sample and reference uploaded to fate-suite.libav.org today.

 My samples will not be updated until tomorrow at the earliest.  Pushing
 before I update will be rather pointless.  I'll let you know when it's
 safe to proceed.

 Ping, this should be committed.

 I am still no wiser as to where samples can be reliably synced from.

 I think we just added a make fate-sync target.


make fate-rsync is syncing this sample for me ...

Can we move ahead with this?
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [RFC] fix swscale for 9/10bit

2011-05-11 Thread Aℓex Converse
On Wed, May 11, 2011 at 10:20 AM, Ronald S. Bultje rsbul...@gmail.com wrote:
 Hi again,

 On Wed, May 11, 2011 at 12:07 PM, Ronald S. Bultje rsbul...@gmail.com wrote:
 On Wed, May 11, 2011 at 11:59 AM, Ronald S. Bultje rsbul...@gmail.com 
 wrote:
 On Wed, May 11, 2011 at 11:26 AM, Ronald S. Bultje rsbul...@gmail.com 
 wrote:
 attached is a RFC for fixing SWS for 9/10bit, as output by H264. It
 takes endianness in account and does some other stuff. As you can see,
 this stuff quickly gets hideous (e.g. planarCopyWrapper is a mess), so
 I'd like some advice on how people think we should do this.

 We need this fix so we can convert 10bitBE to 10bitLE and thereby fix
 10bit H264 on BE systems (e.g. PPC), which are now correct except that
 byte ordering for each word is inverted.

 Attached is one more that should fix fate (at least 10bit h264) on BE
 systems, along with the swscale hackery.

 And one more adding a missing if. We need someone to write tests for
 these various colorspace conversions...

 And this one has fate tests added so that it doesn't break. I've
 tested all YUV8/9/10/16/RGB - 10/9bit conversions and they all
 produce images that are visibly correct, so all codepaths should be
 fine.

 Ronald


Be aware that the pixfmt.h changes break ABI.

On my limited best effort basis this seems ok.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 4/6] Fix libx264 fastfirstpass, move apply_fastfirstpass after user customized options. (cherry picked from commit 37c0a443f9aa01fcf33215b3cde06961f1e9df5c)

2011-05-10 Thread Aℓex Converse
On Tue, May 10, 2011 at 11:34 AM, Anton Khirnov an...@khirnov.net wrote:
 On Wed, 20 Apr 2011 15:56:16 -0700, Aℓex Converse aconve...@google.com 
 wrote:
 On Wed, Apr 20, 2011 at 3:40 PM, Alex Converse aconve...@google.com wrote:
  ---
   libavcodec/libx264.c |   14 +++---
   1 files changed, 7 insertions(+), 7 deletions(-)
 
 



 This looks like it should be squashed with 1.

 --
 Anton Khirnov


This seems vaguely similar to what you said April 28th
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/2] Allow resampling with no channel count change for up to 8 channels.

2011-05-10 Thread Aℓex Converse
On Tue, May 10, 2011 at 4:01 PM, Alex Converse aconve...@google.com wrote:
 ---
  libavcodec/resample.c |   83 
 -
  1 files changed, 41 insertions(+), 42 deletions(-)


Updated to drop an obsoleted comment.
From 5bcc724fd3a3b69c37d0419626c7b17913a09c9d Mon Sep 17 00:00:00 2001
From: Alex Converse aconve...@google.com
Date: Tue, 10 May 2011 14:24:05 -0700
Subject: [PATCH 2/3] Allow resampling with no channel count change for up to 8 channels.

---
 libavcodec/resample.c |   84 -
 1 files changed, 41 insertions(+), 43 deletions(-)

diff --git a/libavcodec/resample.c b/libavcodec/resample.c
index 8800098..2fe2e46 100644
--- a/libavcodec/resample.c
+++ b/libavcodec/resample.c
@@ -29,6 +29,8 @@
 #include libavutil/opt.h
 #include libavutil/samplefmt.h
 
+#define MAX_CHANNELS 8
+
 struct AVResampleContext;
 
 static const char *context_to_name(void *ptr)
@@ -41,7 +43,7 @@ static const AVClass audioresample_context_class = { ReSampleContext, context_
 
 struct ReSampleContext {
 struct AVResampleContext *resample_context;
-short *temp[2];
+short *temp[MAX_CHANNELS];
 int temp_len;
 float ratio;
 /* channel convert */
@@ -104,24 +106,25 @@ static void mono_to_stereo(short *output, short *input, int n1)
 }
 }
 
-/* XXX: should use more abstract 'N' channels system */
-static void stereo_split(short *output1, short *output2, short *input, int n)
+static void deinterleave(short **output, short *input, int channels, int samples)
 {
-int i;
+int i, j;
 
-for(i=0;in;i++) {
-*output1++ = *input++;
-*output2++ = *input++;
+for (i = 0; i  samples; i++) {
+for (j = 0; j  channels; j++) {
+*output[j]++ = *input++;
+}
 }
 }
 
-static void stereo_mux(short *output, short *input1, short *input2, int n)
+static void interleave(short *output, short **input, int channels, int samples)
 {
-int i;
+int i, j;
 
-for(i=0;in;i++) {
-*output++ = *input1++;
-*output++ = *input2++;
+for (i = 0; i  samples; i++) {
+for (j = 0; j  channels; j++) {
+*output++ = *input[j]++;
+}
 }
 }
 
@@ -151,14 +154,18 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
 {
 ReSampleContext *s;
 
-if ( input_channels  2)
+if (input_channels  MAX_CHANNELS)
   {
-av_log(NULL, AV_LOG_ERROR, Resampling with input channels greater than 2 unsupported.\n);
+av_log(NULL, AV_LOG_ERROR,
+   Resampling with input channels greater than %d unsupported.\n,
+   MAX_CHANNELS);
 return NULL;
   }
-if (output_channels  2  !(output_channels == 6  input_channels == 2)) {
+if (  output_channels  2 
+!(output_channels == 6  input_channels == 2) 
+  output_channels != input_channels) {
 av_log(NULL, AV_LOG_ERROR,
-   Resampling output channel count must 1 or 2 for mono input and 1, 2 or 6 for stereo input.\n);
+   Resampling output channel count must 1 or 2 for mono input; 1, 2 or 6 for stereo input; or N for N channel input.\n);
 return NULL;
 }
 
@@ -206,14 +213,6 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
 }
 }
 
-/*
- * AC-3 output is the only case where filter_channels could be greater than 2.
- * input channels can't be greater than 2, so resample the 2 channels and then
- * expand to 6 channels after the resampling.
- */
-if(s-filter_channels2)
-  s-filter_channels = 2;
-
 #define TAPS 16
 s-resample_context= av_resample_init(output_rate, input_rate,
  filter_length, log2_phase_count, linear, cutoff);
@@ -228,9 +227,9 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples)
 {
 int i, nb_samples1;
-short *bufin[2];
-short *bufout[2];
-short *buftmp2[2], *buftmp3[2];
+short *bufin[MAX_CHANNELS];
+short *bufout[MAX_CHANNELS];
+short *buftmp2[MAX_CHANNELS], *buftmp3[MAX_CHANNELS];
 short *output_bak = NULL;
 int lenout;
 
@@ -291,12 +290,9 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
 bufin[i]= av_malloc( (nb_samples + s-temp_len) * sizeof(short) );
 memcpy(bufin[i], s-temp[i], s-temp_len * sizeof(short));
 buftmp2[i] = bufin[i] + s-temp_len;
+bufout[i] = av_malloc( lenout * sizeof(short) );
 }
 
-/* make some zoom to avoid round pb */
-bufout[0]= av_malloc( lenout * sizeof(short) );
-bufout[1]= av_malloc( lenout * sizeof(short) );
-
 if (s-input_channels == 2 
 s-output_channels == 1) {
 buftmp3[0] = output;
@@ -304,10 +300,11 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
 } else if 

[libav-devel] [PATCH 3/2] cosmetics: Fix crazy formatting in resample.

2011-05-10 Thread Aℓex Converse
I used indent. This is not perfect but it is good enough. I just need
something that doesn't make my eyes bleed. If anyone feels more
strongly about these formatting issues, I'm glad to turn this over to
you but you must act quickly.

Regards,
Alex
From 74e8ec80bb50f3ecaa1918155c3cb83b1783ea51 Mon Sep 17 00:00:00 2001
From: Alex Converse aconve...@google.com
Date: Tue, 10 May 2011 16:58:01 -0700
Subject: [PATCH 3/3] cosmetics: Fix crazy formatting in resample.

---
 libavcodec/resample.c |  101 +
 1 files changed, 52 insertions(+), 49 deletions(-)

diff --git a/libavcodec/resample.c b/libavcodec/resample.c
index 2fe2e46..1cc7799 100644
--- a/libavcodec/resample.c
+++ b/libavcodec/resample.c
@@ -39,7 +39,9 @@ static const char *context_to_name(void *ptr)
 }
 
 static const AVOption options[] = {{NULL}};
-static const AVClass audioresample_context_class = { ReSampleContext, context_to_name, options, LIBAVUTIL_VERSION_INT };
+static const AVClass audioresample_context_class = {
+ReSampleContext, context_to_name, options, LIBAVUTIL_VERSION_INT
+};
 
 struct ReSampleContext {
 struct AVResampleContext *resample_context;
@@ -50,9 +52,9 @@ struct ReSampleContext {
 int input_channels, output_channels, filter_channels;
 AVAudioConvert *convert_ctx[2];
 enum AVSampleFormat sample_fmt[2]; /// input and output sample format
-unsigned sample_size[2]; /// size of one sample in sample_fmt
-short *buffer[2];/// buffers used for conversion to S16
-unsigned buffer_size[2]; /// sizes of allocated buffers
+unsigned sample_size[2];   /// size of one sample in sample_fmt
+short *buffer[2];  /// buffers used for conversion to S16
+unsigned buffer_size[2];   /// sizes of allocated buffers
 };
 
 /* n1: number of samples */
@@ -131,17 +133,17 @@ static void interleave(short *output, short **input, int channels, int samples)
 static void ac3_5p1_mux(short *output, short *input1, short *input2, int n)
 {
 int i;
-short l,r;
-
-for(i=0;in;i++) {
-  l=*input1++;
-  r=*input2++;
-  *output++ = l;   /* left */
-  *output++ = (l/2)+(r/2); /* center */
-  *output++ = r;   /* right */
-  *output++ = 0;   /* left surround */
-  *output++ = 0;   /* right surroud */
-  *output++ = 0;   /* low freq */
+short l, r;
+
+for (i = 0; i  n; i++) {
+l = *input1++;
+r = *input2++;
+*output++ = l;  /* left */
+*output++ = (l / 2) + (r / 2);  /* center */
+*output++ = r;  /* right */
+*output++ = 0;  /* left surround */
+*output++ = 0;  /* right surroud */
+*output++ = 0;  /* low freq */
 }
 }
 
@@ -154,27 +156,25 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
 {
 ReSampleContext *s;
 
-if (input_channels  MAX_CHANNELS)
-  {
+if (input_channels  MAX_CHANNELS) {
 av_log(NULL, AV_LOG_ERROR,
Resampling with input channels greater than %d unsupported.\n,
MAX_CHANNELS);
 return NULL;
-  }
-if (  output_channels  2 
+}
+if (output_channels  2 
 !(output_channels == 6  input_channels == 2) 
-  output_channels != input_channels) {
+output_channels != input_channels) {
 av_log(NULL, AV_LOG_ERROR,
Resampling output channel count must 1 or 2 for mono input; 1, 2 or 6 for stereo input; or N for N channel input.\n);
 return NULL;
 }
 
 s = av_mallocz(sizeof(ReSampleContext));
-if (!s)
-  {
+if (!s) {
 av_log(NULL, AV_LOG_ERROR, Can't allocate memory for resample context.\n);
 return NULL;
-  }
+}
 
 s-ratio = (float)output_rate / (float)input_rate;
 
@@ -185,10 +185,10 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
 if (s-output_channels  s-filter_channels)
 s-filter_channels = s-output_channels;
 
-s-sample_fmt [0] = sample_fmt_in;
-s-sample_fmt [1] = sample_fmt_out;
-s-sample_size[0] = av_get_bits_per_sample_fmt(s-sample_fmt[0])3;
-s-sample_size[1] = av_get_bits_per_sample_fmt(s-sample_fmt[1])3;
+s-sample_fmt[0]  = sample_fmt_in;
+s-sample_fmt[1]  = sample_fmt_out;
+s-sample_size[0] = av_get_bits_per_sample_fmt(s-sample_fmt[0])  3;
+s-sample_size[1] = av_get_bits_per_sample_fmt(s-sample_fmt[1])  3;
 
 if (s-sample_fmt[0] != AV_SAMPLE_FMT_S16) {
 if (!(s-convert_ctx[0] = av_audio_convert_alloc(AV_SAMPLE_FMT_S16, 1,
@@ -214,8 +214,9 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
 }
 
 #define TAPS 16
-s-resample_context= av_resample_init(output_rate, input_rate,
- filter_length, log2_phase_count, 

Re: [libav-devel] [PATCH 1/2] Don't allow unsupported resampling configurations.

2011-05-10 Thread Aℓex Converse
On Tue, May 10, 2011 at 4:01 PM, Alex Converse aconve...@google.com wrote:
 ---
  libavcodec/resample.c |    5 +
  1 files changed, 5 insertions(+), 0 deletions(-)


Updated based on comments from [patch 2/2]
From d1309ce9ffd71d74b3e59efdd50375f8612f2262 Mon Sep 17 00:00:00 2001
From: Alex Converse aconve...@google.com
Date: Tue, 10 May 2011 15:10:31 -0700
Subject: [PATCH 1/3] Don't allow unsupported resampling configurations.

---
 libavcodec/resample.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/libavcodec/resample.c b/libavcodec/resample.c
index 2185a11..9f0599f 100644
--- a/libavcodec/resample.c
+++ b/libavcodec/resample.c
@@ -156,6 +156,11 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
 av_log(NULL, AV_LOG_ERROR, Resampling with input channels greater than 2 unsupported.\n);
 return NULL;
   }
+if (output_channels  2  !(output_channels == 6  input_channels == 2)) {
+av_log(NULL, AV_LOG_ERROR,
+   Resampling output channel count must be 1 or 2 for mono input and 1, 2 or 6 for stereo input.\n);
+return NULL;
+}
 
 s = av_mallocz(sizeof(ReSampleContext));
 if (!s)
-- 
1.7.3.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/2] Allow resampling with no channel count change for up to 8 channels.

2011-05-10 Thread Aℓex Converse
On Tue, May 10, 2011 at 6:15 PM, Justin Ruggles
justin.rugg...@gmail.com wrote:
 On 05/10/2011 08:00 PM, Aℓex Converse wrote:


[...]

 From 5bcc724fd3a3b69c37d0419626c7b17913a09c9d Mon Sep 17 00:00:00 2001
 From: Alex Converse aconve...@google.com
 Date: Tue, 10 May 2011 14:24:05 -0700
 Subject: [PATCH 2/3] Allow resampling with no channel count change for up to 
 8 channels.

 ---
  libavcodec/resample.c |   84 
 -
  1 files changed, 41 insertions(+), 43 deletions(-)

 diff --git a/libavcodec/resample.c b/libavcodec/resample.c

[...]


 @@ -151,14 +154,18 @@ ReSampleContext *av_audio_resample_init(int 
 output_channels, int input_channels,
  {
      ReSampleContext *s;

 -    if ( input_channels  2)
 +    if (input_channels  MAX_CHANNELS)
        {
 -        av_log(NULL, AV_LOG_ERROR, Resampling with input channels greater 
 than 2 unsupported.\n);
 +        av_log(NULL, AV_LOG_ERROR,
 +               Resampling with input channels greater than %d 
 unsupported.\n,
 +               MAX_CHANNELS);


 add is before unsupported to make it a complete sentence.

Fixed


          return NULL;
        }
 -    if (output_channels  2  !(output_channels == 6  input_channels == 
 2)) {
 +    if (  output_channels  2 
 +        !(output_channels == 6  input_channels == 2) 
 +          output_channels != input_channels) {
          av_log(NULL, AV_LOG_ERROR,
 -               Resampling output channel count must 1 or 2 for mono input 
 and 1, 2 or 6 for stereo input.\n);
 +               Resampling output channel count must 1 or 2 for mono input; 
 1, 2 or 6 for stereo input; or N for N channel input.\n);
          return NULL;
      }

 ...channel count must be 1 or 2...

Fixed in 1, propagated into this patch.


 @@ -206,14 +213,6 @@ ReSampleContext *av_audio_resample_init(int 
 output_channels, int input_channels,
          }
      }

 -/*
 - * AC-3 output is the only case where filter_channels could be greater than 
 2.
 - * input channels can't be greater than 2, so resample the 2 channels and 
 then
 - * expand to 6 channels after the resampling.
 - */
 -    if(s-filter_channels2)
 -      s-filter_channels = 2;
 -
  #define TAPS 16
      s-resample_context= av_resample_init(output_rate, input_rate,
                           filter_length, log2_phase_count, linear, cutoff);
 @@ -228,9 +227,9 @@ ReSampleContext *av_audio_resample_init(int 
 output_channels, int input_channels,
  int audio_resample(ReSampleContext *s, short *output, short *input, int 
 nb_samples)
  {
      int i, nb_samples1;
 -    short *bufin[2];
 -    short *bufout[2];
 -    short *buftmp2[2], *buftmp3[2];
 +    short *bufin[MAX_CHANNELS];
 +    short *bufout[MAX_CHANNELS];
 +    short *buftmp2[MAX_CHANNELS], *buftmp3[MAX_CHANNELS];
      short *output_bak = NULL;
      int lenout;

 @@ -291,12 +290,9 @@ int audio_resample(ReSampleContext *s, short *output, 
 short *input, int nb_sampl
          bufin[i]= av_malloc( (nb_samples + s-temp_len) * sizeof(short) );
          memcpy(bufin[i], s-temp[i], s-temp_len * sizeof(short));
          buftmp2[i] = bufin[i] + s-temp_len;
 +        bufout[i] = av_malloc( lenout * sizeof(short) );


 remove the extra spaces inside the (). unless you're just matching style
 which is then corrected by your style patch...


It was bad copypasta. Fixed.

[...]


 rest looks ok.


Awesome!
From 29bec80098ef42c252efc4f9bd29b116dd57b395 Mon Sep 17 00:00:00 2001
From: Alex Converse aconve...@google.com
Date: Tue, 10 May 2011 14:24:05 -0700
Subject: [PATCH 2/3] Allow resampling with no channel count change for up to 8 channels.

---
 libavcodec/resample.c |   84 -
 1 files changed, 41 insertions(+), 43 deletions(-)

diff --git a/libavcodec/resample.c b/libavcodec/resample.c
index 9f0599f..5388ec7 100644
--- a/libavcodec/resample.c
+++ b/libavcodec/resample.c
@@ -29,6 +29,8 @@
 #include libavutil/opt.h
 #include libavutil/samplefmt.h
 
+#define MAX_CHANNELS 8
+
 struct AVResampleContext;
 
 static const char *context_to_name(void *ptr)
@@ -41,7 +43,7 @@ static const AVClass audioresample_context_class = { ReSampleContext, context_
 
 struct ReSampleContext {
 struct AVResampleContext *resample_context;
-short *temp[2];
+short *temp[MAX_CHANNELS];
 int temp_len;
 float ratio;
 /* channel convert */
@@ -104,24 +106,25 @@ static void mono_to_stereo(short *output, short *input, int n1)
 }
 }
 
-/* XXX: should use more abstract 'N' channels system */
-static void stereo_split(short *output1, short *output2, short *input, int n)
+static void deinterleave(short **output, short *input, int channels, int samples)
 {
-int i;
+int i, j;
 
-for(i=0;in;i++) {
-*output1++ = *input++;
-*output2++ = *input++;
+for (i = 0; i  samples; i++) {
+for (j = 0; j  channels; j++) {
+*output[j]++ = *input++;
+}
 }
 }
 
-static void stereo_mux(short *output

Re: [libav-devel] [PATCH 3/2] cosmetics: Fix crazy formatting in resample.

2011-05-10 Thread Aℓex Converse
On Tue, May 10, 2011 at 6:05 PM, Justin Ruggles
justin.rugg...@gmail.com wrote:
 On 05/10/2011 08:04 PM, Aℓex Converse wrote:

 I used indent. This is not perfect but it is good enough. I just need
 something that doesn't make my eyes bleed. If anyone feels more
 strongly about these formatting issues, I'm glad to turn this over to
 you but you must act quickly.


 looks good.


Updated with changes from 1 and 2 for my reference.
From 9ef87f06c546b4a56a2167573b900ca35fd15a6a Mon Sep 17 00:00:00 2001
From: Alex Converse aconve...@google.com
Date: Tue, 10 May 2011 16:58:01 -0700
Subject: [PATCH 3/3] cosmetics: Fix crazy formatting in resample.

---
 libavcodec/resample.c |   99 +
 1 files changed, 51 insertions(+), 48 deletions(-)

diff --git a/libavcodec/resample.c b/libavcodec/resample.c
index 5388ec7..75c6302 100644
--- a/libavcodec/resample.c
+++ b/libavcodec/resample.c
@@ -39,7 +39,9 @@ static const char *context_to_name(void *ptr)
 }
 
 static const AVOption options[] = {{NULL}};
-static const AVClass audioresample_context_class = { ReSampleContext, context_to_name, options, LIBAVUTIL_VERSION_INT };
+static const AVClass audioresample_context_class = {
+ReSampleContext, context_to_name, options, LIBAVUTIL_VERSION_INT
+};
 
 struct ReSampleContext {
 struct AVResampleContext *resample_context;
@@ -50,9 +52,9 @@ struct ReSampleContext {
 int input_channels, output_channels, filter_channels;
 AVAudioConvert *convert_ctx[2];
 enum AVSampleFormat sample_fmt[2]; /// input and output sample format
-unsigned sample_size[2]; /// size of one sample in sample_fmt
-short *buffer[2];/// buffers used for conversion to S16
-unsigned buffer_size[2]; /// sizes of allocated buffers
+unsigned sample_size[2];   /// size of one sample in sample_fmt
+short *buffer[2];  /// buffers used for conversion to S16
+unsigned buffer_size[2];   /// sizes of allocated buffers
 };
 
 /* n1: number of samples */
@@ -131,17 +133,17 @@ static void interleave(short *output, short **input, int channels, int samples)
 static void ac3_5p1_mux(short *output, short *input1, short *input2, int n)
 {
 int i;
-short l,r;
-
-for(i=0;in;i++) {
-  l=*input1++;
-  r=*input2++;
-  *output++ = l;   /* left */
-  *output++ = (l/2)+(r/2); /* center */
-  *output++ = r;   /* right */
-  *output++ = 0;   /* left surround */
-  *output++ = 0;   /* right surroud */
-  *output++ = 0;   /* low freq */
+short l, r;
+
+for (i = 0; i  n; i++) {
+l = *input1++;
+r = *input2++;
+*output++ = l;  /* left */
+*output++ = (l / 2) + (r / 2);  /* center */
+*output++ = r;  /* right */
+*output++ = 0;  /* left surround */
+*output++ = 0;  /* right surroud */
+*output++ = 0;  /* low freq */
 }
 }
 
@@ -154,27 +156,25 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
 {
 ReSampleContext *s;
 
-if (input_channels  MAX_CHANNELS)
-  {
+if (input_channels  MAX_CHANNELS) {
 av_log(NULL, AV_LOG_ERROR,
Resampling with input channels greater than %d is unsupported.\n,
MAX_CHANNELS);
 return NULL;
-  }
-if (  output_channels  2 
+}
+if (output_channels  2 
 !(output_channels == 6  input_channels == 2) 
-  output_channels != input_channels) {
+output_channels != input_channels) {
 av_log(NULL, AV_LOG_ERROR,
Resampling output channel count must be 1 or 2 for mono input; 1, 2 or 6 for stereo input; or N for N channel input.\n);
 return NULL;
 }
 
 s = av_mallocz(sizeof(ReSampleContext));
-if (!s)
-  {
+if (!s) {
 av_log(NULL, AV_LOG_ERROR, Can't allocate memory for resample context.\n);
 return NULL;
-  }
+}
 
 s-ratio = (float)output_rate / (float)input_rate;
 
@@ -185,10 +185,10 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
 if (s-output_channels  s-filter_channels)
 s-filter_channels = s-output_channels;
 
-s-sample_fmt [0] = sample_fmt_in;
-s-sample_fmt [1] = sample_fmt_out;
-s-sample_size[0] = av_get_bits_per_sample_fmt(s-sample_fmt[0])3;
-s-sample_size[1] = av_get_bits_per_sample_fmt(s-sample_fmt[1])3;
+s-sample_fmt[0]  = sample_fmt_in;
+s-sample_fmt[1]  = sample_fmt_out;
+s-sample_size[0] = av_get_bits_per_sample_fmt(s-sample_fmt[0])  3;
+s-sample_size[1] = av_get_bits_per_sample_fmt(s-sample_fmt[1])  3;
 
 if (s-sample_fmt[0] != AV_SAMPLE_FMT_S16) {
 if (!(s-convert_ctx[0] = av_audio_convert_alloc(AV_SAMPLE_FMT_S16, 1,
@@ -214,8 +214,9 @@ ReSampleContext *av_audio_resample_init(int

Re: [libav-devel] [PATCH] Port SMPTE S302M audio decoder from FFmbc 0.3.

2011-05-09 Thread Aℓex Converse
On Mon, May 9, 2011 at 7:02 AM, Diego Biurrun di...@biurrun.de wrote:
 On Mon, May 09, 2011 at 03:34:03PM +0200, Diego Biurrun wrote:
 On Thu, May 05, 2011 at 09:41:27AM -0700, Aℓex Converse wrote:
  On Thu, May 5, 2011 at 2:39 AM, Diego Biurrun di...@biurrun.de wrote:
   Please trim your quotes, thank you.
 
  Maybe if you sent a patch on top of the patch you hijacked there would
  be less to trim.

 For your perusal I attached the output of

   git diff -w s302m_alex:libavcodec/s302m.c s302m:libavcodec/s302m.c

 Scratch that broken one, here comes the real deal.


  const uint8_t *buf = avpkt-data;
 -int frame_size, buf_size = avpkt-size;
 +int buf_size   = avpkt-size, frame_size;

 frame_size = s302m_parse_frame_header(avctx, buf, buf_size);

I really don't think this is any more readable. In fact I think it's
arguably less readable.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Port SMPTE S302M audio decoder from FFmbc 0.3.

2011-05-09 Thread Aℓex Converse
2011/5/9 Aℓex Converse aconve...@google.com:
 On Mon, May 9, 2011 at 7:02 AM, Diego Biurrun di...@biurrun.de wrote:
 On Mon, May 09, 2011 at 03:34:03PM +0200, Diego Biurrun wrote:
 On Thu, May 05, 2011 at 09:41:27AM -0700, Aℓex Converse wrote:
  On Thu, May 5, 2011 at 2:39 AM, Diego Biurrun di...@biurrun.de wrote:
   Please trim your quotes, thank you.
 
  Maybe if you sent a patch on top of the patch you hijacked there would
  be less to trim.

 For your perusal I attached the output of

   git diff -w s302m_alex:libavcodec/s302m.c s302m:libavcodec/s302m.c

 Scratch that broken one, here comes the real deal.


      const uint8_t *buf = avpkt-data;
 -    int frame_size, buf_size = avpkt-size;
 +    int buf_size       = avpkt-size, frame_size;

     frame_size = s302m_parse_frame_header(avctx, buf, buf_size);

 I really don't think this is any more readable. In fact I think it's
 arguably less readable.


Anyway I really don't car. Looks good enough to me. Someone please
commit this so I can be done with this nightmare.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 09/18] cmdutils: add OPT_INT check in parse_number_or_die()

2011-05-09 Thread Aℓex Converse
On Mon, May 9, 2011 at 10:49 AM, Anton Khirnov an...@khirnov.net wrote:
 From: Stefano Sabatini stefano.sabatini-l...@poste.it

 Check that the value passed for an OPT_INT option is an int, fail
 otherwise.

 Signed-off-by: Anton Khirnov an...@khirnov.net
 ---
  cmdutils.c |    2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)


OK
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/6] In libx264 wrapper, add -preset and -tune options (cherry picked from commit 0140d3f0921e5cbb6ea8706acb0307f7ff57a133)

2011-05-09 Thread Aℓex Converse
On Wed, Apr 27, 2011 at 10:49 PM, Anton Khirnov an...@khirnov.net wrote:
 On Wed, 20 Apr 2011 15:53:48 -0700, Alex Converse alex.conve...@gmail.com 
 wrote:
 diff --git a/cmdutils.c b/cmdutils.c
 index f1cbd55..4aef03d 100644
 --- a/cmdutils.c
 +++ b/cmdutils.c
 @@ -361,8 +361,9 @@ void set_context_opts(void *ctx, void *opts_ctx, int 
 flags, AVCodec *codec)
          /* We need to use a differnt system to pass options to the private 
 context because
             it is not known which codec and thus context kind that will be 
 when parsing options
             we thus use opt_values directly instead of opts_ctx */
 -        if(!str  priv_ctx  av_get_string(priv_ctx, opt_names[i], opt, 
 buf, sizeof(buf))){
 -            av_set_string3(priv_ctx, opt_names[i], opt_values[i], 1, NULL);
 +        if(!str  priv_ctx) {
 +            if (av_find_opt(priv_ctx, opt_names[i], NULL, flags, flags))
 +                av_set_string3(priv_ctx, opt_names[i], opt_values[i], 0, 
 NULL);
          }
      }

 This part looks unrelated.


I will fold it into 2/6

  }
 diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
 index 5825945..df4c577 100644
 --- a/libavcodec/libx264.c
 +++ b/libavcodec/libx264.c
 @@ -19,6 +19,7 @@
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
 USA
   */

 +#include libavutil/opt.h
  #include avcodec.h
  #include x264.h
  #include math.h
 @@ -27,12 +28,17 @@
  #include string.h

  typedef struct X264Context {
 +    AVClass        *class;
      x264_param_t    params;
      x264_t         *enc;
      x264_picture_t  pic;
      uint8_t        *sei;
      int             sei_size;
      AVFrame         out_pic;
 +    const char *preset;
 +    const char *tune;
 +    const char *profile;
 +    int fastfirstpass;

 The strings are leaked.


I'm not sure where in the options goop this is freed but if I free it
myself I get a double free.

  } X264Context;

  static void X264_log(void *p, int level, const char *fmt, va_list args)
 @@ -163,32 +169,7 @@ static av_cold int X264_init(AVCodecContext *avctx)
      x4-sei_size = 0;
      x264_param_default(x4-params);

 -    x4-params.pf_log               = X264_log;
 -    x4-params.p_log_private        = avctx;
 -
      x4-params.i_keyint_max         = avctx-gop_size;
 -    x4-params.b_intra_refresh      = avctx-flags2  
 CODEC_FLAG2_INTRA_REFRESH;
 -    x4-params.rc.i_bitrate         = avctx-bit_rate       / 1000;
 -    x4-params.rc.i_vbv_buffer_size = avctx-rc_buffer_size / 1000;
 -    x4-params.rc.i_vbv_max_bitrate = avctx-rc_max_rate    / 1000;
 -    x4-params.rc.b_stat_write      = avctx-flags  CODEC_FLAG_PASS1;
 -    if (avctx-flags  CODEC_FLAG_PASS2) {
 -        x4-params.rc.b_stat_read = 1;
 -    } else {
 -        if (avctx-crf) {
 -            x4-params.rc.i_rc_method   = X264_RC_CRF;
 -            x4-params.rc.f_rf_constant = avctx-crf;
 -            x4-params.rc.f_rf_constant_max = avctx-crf_max;
 -        } else if (avctx-cqp  -1) {
 -            x4-params.rc.i_rc_method   = X264_RC_CQP;
 -            x4-params.rc.i_qp_constant = avctx-cqp;
 -        }
 -    }
 -
 -    // if neither crf nor cqp modes are selected we have to enable the RC
 -    // we do it this way because we cannot check if the bitrate has been set
 -    if (!(avctx-crf || (avctx-cqp  -1)))
 -        x4-params.rc.i_rc_method = X264_RC_ABR;

      x4-params.i_bframe          = avctx-max_b_frames;
      x4-params.b_cabac           = avctx-coder_type == FF_CODER_TYPE_AC;
 @@ -217,13 +198,6 @@ static av_cold int X264_init(AVCodecContext *avctx)

      x4-params.i_frame_reference    = avctx-refs;

 -    x4-params.i_width              = avctx-width;
 -    x4-params.i_height             = avctx-height;
 -    x4-params.vui.i_sar_width      = avctx-sample_aspect_ratio.num;
 -    x4-params.vui.i_sar_height     = avctx-sample_aspect_ratio.den;
 -    x4-params.i_fps_num = x4-params.i_timebase_den = avctx-time_base.den;
 -    x4-params.i_fps_den = x4-params.i_timebase_num = avctx-time_base.num;
 -
      x4-params.analyse.inter    = 0;
      if (avctx-partitions) {
          if (avctx-partitions  X264_PART_I4X4)
 @@ -277,20 +251,65 @@ static av_cold int X264_init(AVCodecContext *avctx)
      if (avctx-level  0)
          x4-params.i_level_idc = avctx-level;

 +    x4-params.rc.b_mb_tree               = !!(avctx-flags2  
 CODEC_FLAG2_MBTREE);
 +    x4-params.rc.f_ip_factor             = 1 / fabs(avctx-i_quant_factor);
 +    x4-params.rc.f_pb_factor             = avctx-b_quant_factor;
 +    x4-params.analyse.i_chroma_qp_offset = avctx-chromaoffset;
 +

 So those parameters can be overwritten by preset/profile? Do we really
 want that?


[See below]

 +    if (x4-preset || x4-tune) {
 +        if (x264_param_default_preset(x4-params, x4-preset, x4-tune)  
 0)
 +            return -1;
 +    }
 +
 +    if (x4-fastfirstpass)
 +        x264_param_apply_fastfirstpass(x4-params);
 +
 +    if (x4-profile)
 +        if (x264_param_apply_profile(x4-params, x4-profile)  

Re: [libav-devel] [PATCH] Port SMPTE S302M audio decoder from FFmbc 0.3.

2011-05-05 Thread Aℓex Converse
On Thu, May 5, 2011 at 2:39 AM, Diego Biurrun di...@biurrun.de wrote:
 Please trim your quotes, thank you.


Maybe if you sent a patch on top of the patch you hijacked there would
be less to trim.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] Re: wmavoice: sizeof() applied on array function argument

2011-05-05 Thread Aℓex Converse
2011/5/5 Jindřich Makovička makov...@gmail.com

 Hi,

 although I don't know much about wma voice, I think this piece of code
 doesn't do what is expected (sizeof returns the size of pointer in
 this case, i.e. 4 or 8 based on arch, not 25).

 decode_vbmtree(GetBitContext *gb, int8_t vbm_tree[25])
 {
 ...
    memset(vbm_tree, 0xff, sizeof(vbm_tree));


Thanks.
From 0c4f2497d51632607b8eeb060a1abc3a9ec73712 Mon Sep 17 00:00:00 2001
From: Alex Converse aconve...@google.com
Date: Thu, 5 May 2011 11:10:19 -0700
Subject: [PATCH] wmavoice: Use proper size in memeset().
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=1

This is a multi-part message in MIME format.
--1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


sizeof(array_functrion_argument) gives the size of the pointer type not
the size of the array to which it points.
---
 libavcodec/wmavoice.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


--1
Content-Type: text/x-patch; name=0001-wmavoice-Use-proper-size-in-memeset.patch
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=0001-wmavoice-Use-proper-size-in-memeset.patch

diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index 8dea30c..4e69b83 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -315,7 +315,7 @@ static av_cold int decode_vbmtree(GetBitContext *gb, int8_t vbm_tree[25])
 };
 int cntr[8], n, res;
 
-memset(vbm_tree, 0xff, sizeof(vbm_tree));
+memset(vbm_tree, 0xff, sizeof(vbm_tree[0]) * 25);
 memset(cntr, 0,sizeof(cntr));
 for (n = 0; n  17; n++) {
 res = get_bits(gb, 3);

--1--


___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Re: wmavoice: sizeof() applied on array function argument

2011-05-05 Thread Aℓex Converse
On Thu, May 5, 2011 at 11:15 AM, Ronald S. Bultje rsbul...@gmail.com wrote:
 Hi,

 2011/5/5 Aℓex Converse aconve...@google.com:
 2011/5/5 Jindřich Makovička makov...@gmail.com

 Hi,

 although I don't know much about wma voice, I think this piece of code
 doesn't do what is expected (sizeof returns the size of pointer in
 this case, i.e. 4 or 8 based on arch, not 25).

 decode_vbmtree(GetBitContext *gb, int8_t vbm_tree[25])
 {
 ...
    memset(vbm_tree, 0xff, sizeof(vbm_tree));


 Thanks.

 Did you confirm that the code indeed doesn't do what it's supposed to do?

 (In that case, I'm surprised it works at all, but that's probably just me...)


I confirmed that I know that detail of C.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/2] Replace strncpy() with av_strlcpy().

2011-05-03 Thread Aℓex Converse
On Tue, May 3, 2011 at 11:45 AM, Justin Ruggles
justin.rugg...@gmail.com wrote:
 On 05/03/2011 02:21 PM, Alex Converse wrote:

      memset(compressor_name,0,32);
      /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */
      if (track-mode == MODE_MOV  track-enc-codec  
 track-enc-codec-name)
 -        strncpy(compressor_name,track-enc-codec-name,31);
 +        av_strlcpy(compressor_name,track-enc-codec-name,32);


 Can't that memset be replaced with compressor_name[0] = '\0' now that
 the result will be null-terminated?


avio_w8(pb, strlen(compressor_name));
avio_write(pb, compressor_name, 31);

avio_write() is a mem-function not a str-function so we still want it
zerofilled to the end. Still I can't help but notice that this looks
like a pascal string and wonder if

avio_w8(pb, strlen(compressor_name));
avio_write(pb, compressor_name, strlen(compressor_name));

would be better.

On Tue, May 3, 2011 at 11:46 AM, Justin Ruggles
justin.rugg...@gmail.com wrote:
 On 05/03/2011 02:21 PM, Alex Converse wrote:

 @@ -1099,4 +1100,3 @@ void  pp_postprocess(const uint8_t * src[3], const int 
 srcStride[3],
          }
      }
  }
 -


 stray cosmetic change


Fixed
From 116210e7040cfaaba58234945263468e3801e48d Mon Sep 17 00:00:00 2001
From: Alex Converse aconve...@google.com
Date: Tue, 3 May 2011 11:19:31 -0700
Subject: [PATCH 1/2] Replace strncpy() with av_strlcpy().
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=1

This is a multi-part message in MIME format.
--1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 ffmpeg.c  |3 +--
 libavcodec/ac3enc.c   |   43 ++-
 libavcodec/ass.c  |4 ++--
 libavformat/movenc.c  |2 +-
 libavformat/mp3enc.c  |3 ++-
 libavutil/log.c   |3 ++-
 libpostproc/postprocess.c |3 ++-
 7 files changed, 32 insertions(+), 29 deletions(-)


--1
Content-Type: text/x-patch; name=0001-Replace-strncpy-with-av_strlcpy.patch
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=0001-Replace-strncpy-with-av_strlcpy.patch

diff --git a/ffmpeg.c b/ffmpeg.c
index d728f14..c586811 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3695,8 +3695,7 @@ static int opt_streamid(const char *opt, const char *arg)
 char *p;
 char idx_str[16];
 
-strncpy(idx_str, arg, sizeof(idx_str));
-idx_str[sizeof(idx_str)-1] = '\0';
+av_strlcpy(idx_str, arg, sizeof(idx_str));
 p = strchr(idx_str, ':');
 if (!p) {
 fprintf(stderr,
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index bf106eb..a35ff29 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -33,6 +33,7 @@
 
 #include libavutil/audioconvert.h
 #include libavutil/avassert.h
+#include libavutil/avstring.h
 #include libavutil/crc.h
 #include libavutil/opt.h
 #include avcodec.h
@@ -1578,10 +1579,10 @@ static void dprint_options(AVCodecContext *avctx)
 char strbuf[32];
 
 switch (s-bitstream_id) {
-case  6:  strncpy(strbuf, AC-3 (alt syntax), 32);  break;
-case  8:  strncpy(strbuf, AC-3 (standard), 32);break;
-case  9:  strncpy(strbuf, AC-3 (dnet half-rate), 32);  break;
-case 10:  strncpy(strbuf, AC-3 (dnet quater-rate, 32); break;
+case  6:  av_strlcpy(strbuf, AC-3 (alt syntax), 32);  break;
+case  8:  av_strlcpy(strbuf, AC-3 (standard), 32);break;
+case  9:  av_strlcpy(strbuf, AC-3 (dnet half-rate), 32);  break;
+case 10:  av_strlcpy(strbuf, AC-3 (dnet quater-rate, 32); break;
 default: snprintf(strbuf, 32, ERROR);
 }
 av_dlog(avctx, bitstream_id: %s (%d)\n, strbuf, s-bitstream_id);
@@ -1608,9 +1609,9 @@ static void dprint_options(AVCodecContext *avctx)
 if (opt-audio_production_info) {
 av_dlog(avctx, mixing_level: %ddB\n, opt-mixing_level);
 switch (opt-room_type) {
-case 0:  strncpy(strbuf, notindicated, 32); break;
-case 1:  strncpy(strbuf, large, 32);break;
-case 2:  strncpy(strbuf, small, 32);break;
+case 0:  av_strlcpy(strbuf, notindicated, 32); break;
+case 1:  av_strlcpy(strbuf, large, 32);break;
+case 2:  av_strlcpy(strbuf, small, 32);break;
 default: snprintf(strbuf, 32, ERROR (%d), opt-room_type);
 }
 av_dlog(avctx, room_type: %s\n, strbuf);
@@ -1622,9 +1623,9 @@ static void dprint_options(AVCodecContext *avctx)
 av_dlog(avctx, dialnorm: %ddB\n, opt-dialogue_level);
 if (s-channel_mode == AC3_CHMODE_STEREO) {
 switch (opt-dolby_surround_mode) {
-case 0:  strncpy(strbuf, notindicated, 32); break;
-case 1:  strncpy(strbuf, on, 32);   break;
-case 2:  strncpy(strbuf, off, 32);  break;
+case 0:  av_strlcpy(strbuf, notindicated, 32); break;
+case 1:  av_strlcpy(strbuf, on, 32);   break;
+case 

Re: [libav-devel] [PATCH] AMV: Fix possibly exploitable crash.

2011-04-29 Thread Aℓex Converse
On Thu, Apr 28, 2011 at 12:09 PM, Reinhard Tartler siret...@tauware.de wrote:
 On Thu, Apr 28, 2011 at 02:36:45PM -0400, Justin Ruggles wrote:
 On 04/28/2011 01:20 PM, Aℓex Converse wrote:

  On Thu, Apr 28, 2011 at 4:32 AM, Reinhard Tartler siret...@tauware.de 
  wrote:
  On Wed, Apr 27, 2011 at 03:37:27PM -0400, Justin Ruggles wrote:
  On 04/27/2011 03:25 PM, Reinhard Tartler wrote:
 
  From: Michael Niedermayer michae...@gmx.at
 
  Reported-at: Thu, 21 Apr 2011 14:38:25 +
  Reported-by: Dominic Chell dominic.ch...@ngssecure.com
  Signed-off-by: Michael Niedermayer michae...@gmx.at
  (cherry picked from commit 89f903b3d5ec38c9c5d90fba7e626fa0eda61a32)
  (cherry picked from commit 9b919571e506fbb72b81a35ca1e7c1bd6efc4209)
  ---
   libavcodec/sp5xdec.c |    3 +--
   1 files changed, 1 insertions(+), 2 deletions(-)
 
  diff --git a/libavcodec/sp5xdec.c b/libavcodec/sp5xdec.c
  index e2c371a..3d01020 100644
  --- a/libavcodec/sp5xdec.c
  +++ b/libavcodec/sp5xdec.c
  @@ -86,7 +86,6 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
       recoded[j++] = 0xFF;
       recoded[j++] = 0xD9;
 
  -    avctx-flags = ~CODEC_FLAG_EMU_EDGE;
       av_init_packet(avpkt_recoded);
       avpkt_recoded.data = recoded;
       avpkt_recoded.size = j;
  @@ -121,6 +120,6 @@ AVCodec ff_amv_decoder = {
       NULL,
       ff_mjpeg_decode_end,
       sp5x_decode_frame,
  -    CODEC_CAP_DR1,
  +    0,
       .long_name = NULL_IF_CONFIG_SMALL(AMV Video),
   };
 
 
  The log message explains nothing.  What was the issue?  How is it
  related to CODEC_CAP_DR1 and CODEC_FLAG_EMU_EDGE?  Why change
  ff_amv_decoder and not ff_sp5x_decoder?
 
  No idea, and I'm not able to fill in the missing information. What shall
  we do about this patch now? It seems that it has been picked up by 
  Bugtraq:
  http://seclists.org/bugtraq/2011/Apr/257
 
  And I have a request from the Debian security team to include this
  patch: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=624339
 
 
  NGS Secure is going to withhold details of this flaw for three months.
  This three month window will allow users the time needed to apply the
  patch before the details are released to the general public. This
  reflects the NGS Secure approach to responsible disclosure.
 
  I would complain to NGS about their responsible disclosure policy.

 I've already asked them nicely for additional information a few hours
 ago. Let's hope they react.

 The EMU_EDGE part looks correct.  We should go ahead and commit that.  I
 can't find any reason why CODEC_CAP_DR1 is being turned off for AMV
 though.  I suggest we either ask Michael why this was done or for more
 information, or we go ahead and comment-out that line (and backport to
 the 0.6 branch) until NGS Secure releases details of the flaw.

 20:52 siretart michaelni: could you please elaborate a bit what the
                 dropping of CODEC_CAP_DR1 from the AMV codec actually
                 fixes?
 20:02 michaelni siretart, no. A patch that fixes the security bug is
                  available, details will not be released before people
                  had a chance to apply the patch, because these details
                  would possibly help people exlpoit it. That is normal
                   common practice and dominiks bugtraq post also
                  explains when details will be released.

I've said this before and I'll say it again, what an asshole!
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] mov: Fix composition timestamps on movie fragments.

2011-04-29 Thread Aℓex Converse
On Fri, Apr 29, 2011 at 9:37 AM, Yusuke Nakamura
muken.the.vfrman...@gmail.com wrote:
 Sorry, I missed the case that moov atom has any samples and doesn't have
 ctts atom.

 I attached a new patch.


have you tried running the fate regression tests with this patch?
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] AMV: Fix possibly exploitable crash.

2011-04-29 Thread Aℓex Converse
On Fri, Apr 29, 2011 at 10:24 AM, Sean McGovern gsean...@gmail.com wrote:
 Much though I think we dislike the way this has been reported, I believe 
 Michael's behaviour in this instance is correct. Publication of the 
 vulnerability has a potentially negative effect on _both_ projects. 
 Additionally, a patch has been committed to FFmpeg that while it is not 
 really my say, should still be committed to LibAV a.s.a.p. if it mitigates a 
 security issue.


Letting the Libav developers know details of the slow has a
potentially negative effect on _both_ projects. Really?

No one asked for a widespread publication of the details.

--Alex
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/3] vorbis: Replace sized int_fast integer types with plain int/unsigned.

2011-04-29 Thread Aℓex Converse
On Fri, Apr 29, 2011 at 11:17 AM, Diego Biurrun di...@biurrun.de wrote:
 int/unsigned is the natural memory access type for CPUs, using sized types
 for temporary variables, counters and similar just increases code size and
 can possibly cause a slowdown.
 ---
  libavcodec/vorbis.c    |    9 +-
  libavcodec/vorbis.h    |    2 +-
  libavcodec/vorbisdec.c |  227 
 +++-
  3 files changed, 113 insertions(+), 125 deletions(-)


OK
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Fix compilation under FreeBSD

2011-04-29 Thread Aℓex Converse
On Fri, Apr 29, 2011 at 12:51 PM, Luca Barbato lu_z...@gentoo.org wrote:
 On 4/29/11 8:30 PM, Diogo Franco wrote:

 FreeBSD, unlike (whatever OS the default -D are trying to fix),
 defines every symbol by default; conformance defines are supposed to
 restrict FreeBSD's definitions to only the requested specification.

 Undeffing the flags prevents them from disabling __BSD_VISIBLE, which
 is only defined when no conformance flags are defined. It should not be
 defined by the user.

 seems sort of a solution, even if would be great if upstream would provide a
 way to require just the features needed as it happens on the rest of the
 world...


In the past I've considered the concept of a
--disable-maintainer-mode flag to be far less strict about this sort
of thing.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Remove commented-out printf/av_log invocations.

2011-04-29 Thread Aℓex Converse
 @@ -2334,8 +2328,6 @@ int av_find_stream_info(AVFormatContext *ic)

                 for (j=1; jFF_ARRAY_ELEMS(st-info-duration_error); j++) {
                     double error = st-info-duration_error[j] * 
 get_std_framerate(j);
 -//                    if(st-codec-codec_type == AVMEDIA_TYPE_VIDEO)
 -//                        av_log(NULL, AV_LOG_ERROR, %f %f\n, 
 get_std_framerate(j) / 12.0/1001, error);
                     if(error  best_error){
                         best_error= error;
                         num = get_std_framerate(j);

I used this today!
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Port s302m decoder from FFmbc 0.3.

2011-04-28 Thread Aℓex Converse
On Thu, Apr 28, 2011 at 7:35 AM, Justin Ruggles
justin.rugg...@gmail.com wrote:
 Hi,

 On 04/27/2011 08:19 PM, Aℓex Converse wrote:

 +    frame_size = (h  16)  0x;
 +    channels = 2 + 2*((h  14)  0x03);
 +    id = (h  6)  0xff;
 +    bits = 16 + 4*((h  4)  0x03);


 This would be easier to read if aligned. like this:

 frame_size =  (h  16)  0x;
 channels   = ((h  14)  0x0003) * 2 + 2;
 id         =  (h   6)  0x00ff;
 bits       = ((h   4)  0x0003) * 4 + 16;

 +    int frame_size, buf_size = avpkt-size;
 +
 +    frame_size = s302m_parse_frame_header(avctx, buf, buf_size);
 +    if (frame_size  0)
 +        return -1;


 frame_size isn't used anywhere else in this function, so it is not needed.

 +    if (avctx-bits_per_coded_sample == 24) {
 ...
 +        *data_size = (uint8_t*)o - (uint8_t*)data;
 +    } else if (avctx-bits_per_coded_sample == 20) {
 ...
 +        *data_size = (uint8_t*)o - (uint8_t*)data;
 +    } else {
 ...
 +        *data_size = (uint8_t*)o - (uint8_t*)data;
 +    }


 the 3 duplicate lines can be moved to after the if/else.


This gets messy because o is a different type in the final else.


 The reset looks good after Diego's comments are addressed.
 And a fate test would be nice.

 Thanks,
 Justin
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] AMV: Fix possibly exploitable crash.

2011-04-28 Thread Aℓex Converse
On Thu, Apr 28, 2011 at 4:32 AM, Reinhard Tartler siret...@tauware.de wrote:
 On Wed, Apr 27, 2011 at 03:37:27PM -0400, Justin Ruggles wrote:
 On 04/27/2011 03:25 PM, Reinhard Tartler wrote:

  From: Michael Niedermayer michae...@gmx.at
 
  Reported-at: Thu, 21 Apr 2011 14:38:25 +
  Reported-by: Dominic Chell dominic.ch...@ngssecure.com
  Signed-off-by: Michael Niedermayer michae...@gmx.at
  (cherry picked from commit 89f903b3d5ec38c9c5d90fba7e626fa0eda61a32)
  (cherry picked from commit 9b919571e506fbb72b81a35ca1e7c1bd6efc4209)
  ---
   libavcodec/sp5xdec.c |    3 +--
   1 files changed, 1 insertions(+), 2 deletions(-)
 
  diff --git a/libavcodec/sp5xdec.c b/libavcodec/sp5xdec.c
  index e2c371a..3d01020 100644
  --- a/libavcodec/sp5xdec.c
  +++ b/libavcodec/sp5xdec.c
  @@ -86,7 +86,6 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
       recoded[j++] = 0xFF;
       recoded[j++] = 0xD9;
 
  -    avctx-flags = ~CODEC_FLAG_EMU_EDGE;
       av_init_packet(avpkt_recoded);
       avpkt_recoded.data = recoded;
       avpkt_recoded.size = j;
  @@ -121,6 +120,6 @@ AVCodec ff_amv_decoder = {
       NULL,
       ff_mjpeg_decode_end,
       sp5x_decode_frame,
  -    CODEC_CAP_DR1,
  +    0,
       .long_name = NULL_IF_CONFIG_SMALL(AMV Video),
   };


 The log message explains nothing.  What was the issue?  How is it
 related to CODEC_CAP_DR1 and CODEC_FLAG_EMU_EDGE?  Why change
 ff_amv_decoder and not ff_sp5x_decoder?

 No idea, and I'm not able to fill in the missing information. What shall
 we do about this patch now? It seems that it has been picked up by Bugtraq:
 http://seclists.org/bugtraq/2011/Apr/257

 And I have a request from the Debian security team to include this
 patch: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=624339


 NGS Secure is going to withhold details of this flaw for three months.
 This three month window will allow users the time needed to apply the
 patch before the details are released to the general public. This
 reflects the NGS Secure approach to responsible disclosure.

I would complain to NGS about their responsible disclosure policy.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Port s302m decoder from FFmbc 0.3.

2011-04-28 Thread Aℓex Converse
2011/4/28 Aℓex Converse aconve...@google.com:
 On Thu, Apr 28, 2011 at 7:35 AM, Justin Ruggles
 justin.rugg...@gmail.com wrote:
 Hi,

 On 04/27/2011 08:19 PM, Aℓex Converse wrote:

 +    frame_size = (h  16)  0x;
 +    channels = 2 + 2*((h  14)  0x03);
 +    id = (h  6)  0xff;
 +    bits = 16 + 4*((h  4)  0x03);


 This would be easier to read if aligned. like this:

 frame_size =  (h  16)  0x;
 channels   = ((h  14)  0x0003) * 2 + 2;
 id         =  (h   6)  0x00ff;
 bits       = ((h   4)  0x0003) * 4 + 16;

 +    int frame_size, buf_size = avpkt-size;
 +
 +    frame_size = s302m_parse_frame_header(avctx, buf, buf_size);
 +    if (frame_size  0)
 +        return -1;


 frame_size isn't used anywhere else in this function, so it is not needed.

 +    if (avctx-bits_per_coded_sample == 24) {
 ...
 +        *data_size = (uint8_t*)o - (uint8_t*)data;
 +    } else if (avctx-bits_per_coded_sample == 20) {
 ...
 +        *data_size = (uint8_t*)o - (uint8_t*)data;
 +    } else {
 ...
 +        *data_size = (uint8_t*)o - (uint8_t*)data;
 +    }


 the 3 duplicate lines can be moved to after the if/else.


 This gets messy because o is a different type in the final else.


Updated patch attached with this unfixed.
From ae6ab08ce8032bf1068283b21b6383968675d186 Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier baptiste.coudur...@gmail.com
Date: Tue, 12 Apr 2011 15:29:09 -0700
Subject: [PATCH] Port s302m decoder from FFmbc 0.3.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=1

This is a multi-part message in MIME format.
--1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


Ported-by: Alex Converse aconve...@google.com
---
 Changelog  |1 +
 libavcodec/Makefile|1 +
 libavcodec/allcodecs.c |1 +
 libavcodec/avcodec.h   |1 +
 libavcodec/s302m.c |  141 
 libavcodec/version.h   |4 +-
 libavformat/mpegts.c   |1 +
 7 files changed, 148 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/s302m.c


--1
Content-Type: text/x-patch; name=0001-Port-s302m-decoder-from-FFmbc-0.3.patch
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=0001-Port-s302m-decoder-from-FFmbc-0.3.patch

diff --git a/Changelog b/Changelog
index 144f55c..19dfd23 100644
--- a/Changelog
+++ b/Changelog
@@ -6,6 +6,7 @@ version next:
 
 - Lots of deprecated API cruft removed
 - fft and imdct optimizations for AVX (Sandy Bridge) processors
+- s302m AES3 audio decoder
 
 version 0.7_beta1:
 
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index fad435d..47dbfe1 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -323,6 +323,7 @@ OBJS-$(CONFIG_RV30_DECODER)+= rv30.o rv34.o rv30dsp.o\
   mpegvideo.o error_resilience.o
 OBJS-$(CONFIG_RV40_DECODER)+= rv40.o rv34.o rv40dsp.o\
   mpegvideo.o error_resilience.o
+OBJS-$(CONFIG_S302M_DECODER)   += s302m.o
 OBJS-$(CONFIG_SGI_DECODER) += sgidec.o
 OBJS-$(CONFIG_SGI_ENCODER) += sgienc.o rle.o
 OBJS-$(CONFIG_SHORTEN_DECODER) += shorten.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 40a7e23..aa2e7dc 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -177,6 +177,7 @@ void avcodec_register_all(void)
 REGISTER_ENCDEC  (RV20, rv20);
 REGISTER_DECODER (RV30, rv30);
 REGISTER_DECODER (RV40, rv40);
+REGISTER_DECODER (S302M, s302m);
 REGISTER_ENCDEC  (SGI, sgi);
 REGISTER_DECODER (SMACKER, smacker);
 REGISTER_DECODER (SMC, smc);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index eb5c5b3..b362909 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -232,6 +232,7 @@ enum CodecID {
 CODEC_ID_PCM_F64LE,
 CODEC_ID_PCM_BLURAY,
 CODEC_ID_PCM_LXF,
+CODEC_ID_S302M,
 
 /* various ADPCM codecs */
 CODEC_ID_ADPCM_IMA_QT= 0x11000,
diff --git a/libavcodec/s302m.c b/libavcodec/s302m.c
new file mode 100644
index 000..e6980ce
--- /dev/null
+++ b/libavcodec/s302m.c
@@ -0,0 +1,141 @@
+/*
+ * SMPTE 302M decoder
+ * Copyright (c) 2008 Laurent Aimar fen...@videolan.org
+ * Copyright (c) 2009 Baptiste Coudurier baptiste.coudur...@gmail.com
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public

Re: [libav-devel] [PATCH] Port s302m decoder from FFmbc 0.3.

2011-04-28 Thread Aℓex Converse
On Thu, Apr 28, 2011 at 11:08 AM, Diego Biurrun di...@biurrun.de wrote:

 From: Baptiste Coudurier baptiste.coudur...@gmail.com

 Ported-by: Alex Converse aconve...@google.com
 ---

 This includes all review comments so far, plus a documentation entry
 and random prettyprinting.

  Changelog              |    2 +
  doc/general.texi       |    1 +
  libavcodec/Makefile    |    1 +
  libavcodec/allcodecs.c |    1 +
  libavcodec/avcodec.h   |    1 +
  libavcodec/s302m.c     |  141 
 
  libavcodec/version.h   |    4 +-
  libavformat/mpegts.c   |    1 +
  8 files changed, 150 insertions(+), 2 deletions(-)
  create mode 100644 libavcodec/s302m.c

 diff --git a/Changelog b/Changelog
 index 144f55c..2e3ed9f 100644
 --- a/Changelog
 +++ b/Changelog
 @@ -6,6 +6,8 @@ version next:

  - Lots of deprecated API cruft removed
  - fft and imdct optimizations for AVX (Sandy Bridge) processors
 +- SMPTE 302M AES3 audio decoder
 +

  version 0.7_beta1:

 diff --git a/doc/general.texi b/doc/general.texi
 index e68e83e..675791d 100644
 --- a/doc/general.texi
 +++ b/doc/general.texi
 @@ -673,6 +673,7 @@ following image formats are supported:
  @item Sierra VMD audio       @tab     @tab  X
     @tab Used in Sierra VMD files.
  @item Smacker audio          @tab     @tab  X
 +@item SMPTE 302M AES3 audio  @tab     @tab  X
  @item Speex                  @tab     @tab  E
     @tab supported through external library libspeex
  @item True Audio (TTA)       @tab     @tab  X
 diff --git a/libavcodec/Makefile b/libavcodec/Makefile
 index fad435d..47dbfe1 100644
 --- a/libavcodec/Makefile
 +++ b/libavcodec/Makefile
 @@ -323,6 +323,7 @@ OBJS-$(CONFIG_RV30_DECODER)            += rv30.o rv34.o 
 rv30dsp.o        \
                                           mpegvideo.o error_resilience.o
  OBJS-$(CONFIG_RV40_DECODER)            += rv40.o rv34.o rv40dsp.o        \
                                           mpegvideo.o error_resilience.o
 +OBJS-$(CONFIG_S302M_DECODER)           += s302m.o
  OBJS-$(CONFIG_SGI_DECODER)             += sgidec.o
  OBJS-$(CONFIG_SGI_ENCODER)             += sgienc.o rle.o
  OBJS-$(CONFIG_SHORTEN_DECODER)         += shorten.o
 diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
 index 40a7e23..aa2e7dc 100644
 --- a/libavcodec/allcodecs.c
 +++ b/libavcodec/allcodecs.c
 @@ -177,6 +177,7 @@ void avcodec_register_all(void)
     REGISTER_ENCDEC  (RV20, rv20);
     REGISTER_DECODER (RV30, rv30);
     REGISTER_DECODER (RV40, rv40);
 +    REGISTER_DECODER (S302M, s302m);
     REGISTER_ENCDEC  (SGI, sgi);
     REGISTER_DECODER (SMACKER, smacker);
     REGISTER_DECODER (SMC, smc);
 diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
 index eb5c5b3..b362909 100644
 --- a/libavcodec/avcodec.h
 +++ b/libavcodec/avcodec.h
 @@ -232,6 +232,7 @@ enum CodecID {
     CODEC_ID_PCM_F64LE,
     CODEC_ID_PCM_BLURAY,
     CODEC_ID_PCM_LXF,
 +    CODEC_ID_S302M,

     /* various ADPCM codecs */
     CODEC_ID_ADPCM_IMA_QT= 0x11000,
 diff --git a/libavcodec/s302m.c b/libavcodec/s302m.c
 new file mode 100644
 index 000..1b3ca2e
 --- /dev/null
 +++ b/libavcodec/s302m.c
 @@ -0,0 +1,141 @@
 +/*
 + * SMPTE 302M decoder
 + * Copyright (c) 2008 Laurent Aimar fen...@videolan.org
 + * Copyright (c) 2009 Baptiste Coudurier baptiste.coudur...@gmail.com
 + *
 + * This file is part of Libav.
 + *
 + * Libav is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU Lesser General Public
 + * License as published by the Free Software Foundation; either
 + * version 2.1 of the License, or (at your option) any later version.
 + *
 + * Libav is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 + * Lesser General Public License for more details.
 + *
 + * You should have received a copy of the GNU Lesser General Public
 + * License along with Libav; if not, write to the Free Software
 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
 USA
 + */
 +
 +#include libavutil/intreadwrite.h
 +#include avcodec.h
 +
 +#define AES3_HEADER_LEN 4
 +
 +static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t 
 *buf,
 +                                    int buf_size)
 +{
 +    uint32_t h;
 +    int frame_size, channels, id, bits;
 +
 +    if (buf_size = AES3_HEADER_LEN) {
 +        av_log(avctx, AV_LOG_ERROR, frame is too short\n);
 +        return AVERROR_INVALIDDATA;
 +    }
 +
 +    /*
 +     * AES3 header :
 +     * size:            16
 +     * number channels   2
 +     * channel_id        8
 +     * bits per samples  2
 +     * alignments        4
 +     */
 +
 +    h = AV_RB32(buf);
 +    frame_size =  (h  16)  0x;
 +    channels   = ((h  14)  0x0003) * 2 +  2;
 +    id         =  (h   6)  0x00ff;
 +    bits       = ((h   4)  0x0003) * 4 + 16;
 +
 +    if (AES3_HEADER_LEN + frame_size != 

Re: [libav-devel] [PATCH] Port s302m decoder from FFmbc 0.3.

2011-04-28 Thread Aℓex Converse
On Thu, Apr 28, 2011 at 11:25 AM, Justin Ruggles
justin.rugg...@gmail.com wrote:
 Hi,

 On 04/28/2011 02:08 PM, Diego Biurrun wrote:

 +    if (*data_size  4 * buf_size * 8 / (avctx-bits_per_coded_sample + 4))
 +        return -1;


 I think this can cause invalid writes if buf_size  INT_MAX/32

Can't happen buf_size can be at most 65539.

if (AES3_HEADER_LEN + frame_size != buf_size || bits  24) {
av_log(avctx, AV_LOG_ERROR, frame has invalid header\n);
return AVERROR_INVALIDDATA;
}

--Alex
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Port s302m decoder from FFmbc 0.3.

2011-04-28 Thread Aℓex Converse
On Thu, Apr 28, 2011 at 11:08 AM, Diego Biurrun di...@biurrun.de wrote:
 From: Baptiste Coudurier baptiste.coudur...@gmail.com

 Ported-by: Alex Converse aconve...@google.com
 --- /dev/null
 +++ b/libavcodec/s302m.c
 @@ -0,0 +1,141 @@
 +/*
 + * SMPTE 302M decoder
 + * Copyright (c) 2008 Laurent Aimar fen...@videolan.org
 + * Copyright (c) 2009 Baptiste Coudurier baptiste.coudur...@gmail.com
 + *
 + * This file is part of Libav.
 + *

Please take my name off any versions that have a changed copyright header.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/3] mpegvideo: don't av_malloc(0).

2011-04-27 Thread Aℓex Converse
2011/4/27 Måns Rullgård m...@mansr.com:
 Ronald S. Bultje rsbul...@gmail.com writes:

 ---
  libavcodec/mpegvideo.c |   12 
  1 files changed, 12 insertions(+), 0 deletions(-)

 diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
 index c48b30f..48f25b3 100644
 --- a/libavcodec/mpegvideo.c
 +++ b/libavcodec/mpegvideo.c
 @@ -520,6 +520,8 @@ av_cold int MPV_common_init(MpegEncContext *s)
      s-flags= s-avctx-flags;
      s-flags2= s-avctx-flags2;

 +    if (s-width  s-height) {

 Why?  malloc(0) is fine according to all standards.  Presumably this
 only happens in some degenerate case where performance is irrelevant,
 but testing for it here imposes a (small) penalty on every case.


Well the code is hardcoded to fail for for a valid non-error return
value of malloc(0).

We could add the overhead to FF_ALLOCZ_OR_GOTO() if you prefer.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/4] indeo3: Eliminate use of long.

2011-04-27 Thread Aℓex Converse

From 7129b732b75acdf828a563103103d397a64f61e0 Mon Sep 17 00:00:00 2001
From: Alex Converse alex.conve...@gmail.com
Date: Sun, 24 Apr 2011 17:33:37 -0700
Subject: [PATCH 1/4] indeo3: Eliminate use of long.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=1

This is a multi-part message in MIME format.
--1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 libavcodec/indeo3.c |   22 +++---
 1 files changed, 11 insertions(+), 11 deletions(-)


--1
Content-Type: text/x-patch; name=0001-indeo3-Eliminate-use-of-long.patch
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=0001-indeo3-Eliminate-use-of-long.patch

diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c
index 29a8d4a..30b7085 100644
--- a/libavcodec/indeo3.c
+++ b/libavcodec/indeo3.c
@@ -149,13 +149,13 @@ static av_cold void iv_free_func(Indeo3DecodeContext *s)
 }
 
 struct ustr {
-long xpos;
-long ypos;
-long width;
-long height;
-long split_flag;
-long split_direction;
-long usl7;
+int xpos;
+int ypos;
+int width;
+int height;
+int split_flag;
+int split_direction;
+int usl7;
 };
 
 
@@ -203,12 +203,12 @@ struct ustr {
 
 static void iv_Decode_Chunk(Indeo3DecodeContext *s,
 uint8_t *cur, uint8_t *ref, int width, int height,
-const uint8_t *buf1, long cb_offset, const uint8_t *hdr,
+const uint8_t *buf1, int cb_offset, const uint8_t *hdr,
 const uint8_t *buf2, int min_width_160)
 {
 uint8_t bit_buf;
-unsigned long bit_pos, lv, lv1, lv2;
-long *width_tbl, width_tbl_arr[10];
+unsigned int bit_pos, lv, lv1, lv2;
+int *width_tbl, width_tbl_arr[10];
 const signed char *ref_vectors;
 uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2;
 uint32_t *cur_lp, *ref_lp;
@@ -982,7 +982,7 @@ static int iv_decode_frame(AVCodecContext *avctx,
 Indeo3DecodeContext *s = avctx-priv_data;
 unsigned int image_width, image_height,
  chroma_width, chroma_height;
-unsigned long flags, cb_offset, data_size,
+unsigned int flags, cb_offset, data_size,
   y_offset, v_offset, u_offset, mc_vector_count;
 const uint8_t *hdr_pos, *buf_pos;
 

--1--


___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 3/4] bitstream: Properly promote av_reverse values before shifting.

2011-04-27 Thread Aℓex Converse

From ae62aa2fca3b2cf45a98dc2f9777065bcb452797 Mon Sep 17 00:00:00 2001
From: Alex Converse aconve...@google.com
Date: Tue, 26 Apr 2011 09:08:26 -0700
Subject: [PATCH 3/4] bitstream: Properly promote av_reverse values before shifting.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=1

This is a multi-part message in MIME format.
--1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 libavcodec/bitstream.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)


--1
Content-Type: text/x-patch; name=0003-bitstream-Properly-promote-av_reverse-values-before-.patch
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=0003-bitstream-Properly-promote-av_reverse-values-before-.patch

diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index 329ec95..14c3eaa 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -118,10 +118,10 @@ static int alloc_table(VLC *vlc, int size, int use_static)
 }
 
 static av_always_inline uint32_t bitswap_32(uint32_t x) {
-return av_reverse[x0xFF]24
- | av_reverse[(x8)0xFF]16
- | av_reverse[(x16)0xFF]8
- | av_reverse[x24];
+return (uint32_t)av_reverse[x0xFF]24
+ | (uint32_t)av_reverse[(x8)0xFF]16
+ | (uint32_t)av_reverse[(x16)0xFF]8
+ | (uint32_t)av_reverse[x24];
 }
 
 typedef struct {

--1--


___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 4/4] get_bits: make cache unsigned to eliminate undefined signed overflow.

2011-04-27 Thread Aℓex Converse

From 859f6de86ee7359942a9aece8d92eea141d421d0 Mon Sep 17 00:00:00 2001
From: Alex Converse aconve...@google.com
Date: Tue, 26 Apr 2011 09:09:05 -0700
Subject: [PATCH 4/4] get_bits: make cache unsigned to eliminate undefined signed overflow.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=1

This is a multi-part message in MIME format.
--1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 libavcodec/get_bits.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


--1
Content-Type: text/x-patch; name=0004-get_bits-make-cache-unsigned-to-eliminate-undefined-.patch
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=0004-get_bits-make-cache-unsigned-to-eliminate-undefined-.patch

diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 2d36b81..185ff31 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -127,7 +127,7 @@ for examples see get_bits, show_bits, skip_bits, get_vlc
 
 #   define OPEN_READER(name, gb)\
 unsigned int name##_index = (gb)-index;\
-int name##_cache  = 0
+unsigned int name##_cache = 0
 
 #   define CLOSE_READER(name, gb) (gb)-index = name##_index
 

--1--


___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] Port s302m decoder from FFmbc 0.3.

2011-04-27 Thread Aℓex Converse
It's a little ugly but without chain demux it isn't something we can
do particularly cleanly. This is similar to how we do LATM.

Let me know if you think the git metadata should be different.
From ea084bdc985766ed323232cb22bdf4b04edd40b5 Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier baptiste.coudur...@gmail.com
Date: Tue, 12 Apr 2011 15:29:09 -0700
Subject: [PATCH] Port s302m decoder from FFmbc 0.3.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=1

This is a multi-part message in MIME format.
--1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


Ported-by: Alex Converse aconve...@google.com
---
 libavcodec/Makefile|1 +
 libavcodec/allcodecs.c |1 +
 libavcodec/avcodec.h   |1 +
 libavcodec/s302m.c |  142 
 libavformat/mpegts.c   |1 +
 5 files changed, 146 insertions(+), 0 deletions(-)
 create mode 100644 libavcodec/s302m.c


--1
Content-Type: text/x-patch; name=0001-Port-s302m-decoder-from-FFmbc-0.3.patch
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=0001-Port-s302m-decoder-from-FFmbc-0.3.patch

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 1cdae2c..03c96ed 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -324,6 +324,7 @@ OBJS-$(CONFIG_RV30_DECODER)+= rv30.o rv34.o rv30dsp.o\
   mpegvideo.o error_resilience.o
 OBJS-$(CONFIG_RV40_DECODER)+= rv40.o rv34.o rv40dsp.o\
   mpegvideo.o error_resilience.o
+OBJS-$(CONFIG_S302M_DECODER)   += s302m.o
 OBJS-$(CONFIG_SGI_DECODER) += sgidec.o
 OBJS-$(CONFIG_SGI_ENCODER) += sgienc.o rle.o
 OBJS-$(CONFIG_SHORTEN_DECODER) += shorten.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 40a7e23..aa2e7dc 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -177,6 +177,7 @@ void avcodec_register_all(void)
 REGISTER_ENCDEC  (RV20, rv20);
 REGISTER_DECODER (RV30, rv30);
 REGISTER_DECODER (RV40, rv40);
+REGISTER_DECODER (S302M, s302m);
 REGISTER_ENCDEC  (SGI, sgi);
 REGISTER_DECODER (SMACKER, smacker);
 REGISTER_DECODER (SMC, smc);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 109d2a4..d06d21f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -241,6 +241,7 @@ enum CodecID {
 CODEC_ID_PCM_F64LE,
 CODEC_ID_PCM_BLURAY,
 CODEC_ID_PCM_LXF,
+CODEC_ID_S302M,
 
 /* various ADPCM codecs */
 CODEC_ID_ADPCM_IMA_QT= 0x11000,
diff --git a/libavcodec/s302m.c b/libavcodec/s302m.c
new file mode 100644
index 000..4820db6
--- /dev/null
+++ b/libavcodec/s302m.c
@@ -0,0 +1,142 @@
+/*
+ * SMPTE 302M decoder
+ * Copyright (c) 2008 Laurent Aimar fen...@videolan.org
+ * Copyright (c) 2009 Baptiste Coudurier baptiste.coudur...@gmail.com
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include avcodec.h
+#include libavutil/intreadwrite.h
+
+#define AES3_HEADER_LEN 4
+
+static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
+{
+uint32_t h;
+int frame_size, channels, id, bits;
+
+if (buf_size = AES3_HEADER_LEN) {
+av_log(avctx, AV_LOG_ERROR, frame is too short\n);
+return -1;
+}
+
+/*
+ * AES3 header :
+ * size:16
+ * number channels   2
+ * channel_id8
+ * bits per samples  2
+ * alignments4
+ */
+
+h = AV_RB32(buf);
+frame_size = (h  16)  0x;
+channels = 2 + 2*((h  14)  0x03);
+id = (h  6)  0xff;
+bits = 16 + 4*((h  4)  0x03);
+
+if (AES3_HEADER_LEN + frame_size != buf_size || bits  24) {
+av_log(avctx, AV_LOG_ERROR, frame has invalid header\n);
+return -1;
+}
+
+/* Set output properties */
+avctx-bits_per_coded_sample = bits;
+if (bits  16)
+avctx-sample_fmt = SAMPLE_FMT_S32;
+else
+avctx-sample_fmt = SAMPLE_FMT_S16;
+
+avctx-channels = channels;
+avctx-sample_rate = 48000;
+avctx-bit_rate = 48000*avctx-channels*(avctx-bits_per_coded_sample+4) +
+

Re: [libav-devel] [PATCH] Remove commented-out printf/av_log invocations.

2011-04-26 Thread Aℓex Converse
On Tue, Apr 26, 2011 at 11:05 AM, Diego Biurrun di...@biurrun.de wrote:

 ---
  cmdutils.c                        |    2 --
  ffmpeg.c                          |   12 
  ffserver.c                        |    1 -
  libavcodec/aaccoder.c             |    3 ---
  libavcodec/adpcm.c                |    1 -
  libavcodec/adxdec.c               |    3 ---
  libavcodec/adxenc.c               |    1 -
  libavcodec/cook.c                 |    7 +--
  libavcodec/dca.c                  |    3 ---
  libavcodec/dnxhddec.c             |    7 ---
  libavcodec/dv.c                   |    1 -
  libavcodec/error_resilience.c     |    4 
  libavcodec/ffv1.c                 |   13 -
  libavcodec/flashsvenc.c           |    1 -
  libavcodec/flicvideo.c            |    1 -
  libavcodec/golomb.h               |    2 --
  libavcodec/h263dec.c              |    4 +---
  libavcodec/h264.c                 |    3 ---
  libavcodec/h264_cabac.c           |    7 ---
  libavcodec/h264_parser.c          |    2 --
  libavcodec/huffyuv.c              |    7 ---
  libavcodec/imc.c                  |    3 ---
  libavcodec/jpegls.c               |    1 -
  libavcodec/jpeglsdec.c            |    3 ---
  libavcodec/libmp3lame.c           |    2 --
  libavcodec/libvorbis.c            |    2 --
  libavcodec/libxvid_rc.c           |    1 -
  libavcodec/ljpegenc.c             |    1 -
  libavcodec/mjpegdec.c             |   10 --
  libavcodec/mjpegenc.c             |    1 -
  libavcodec/motion_est.c           |   12 
  libavcodec/motion_est_template.c  |   12 
  libavcodec/mpeg12.c               |    3 ---
  libavcodec/mpegaudiodec.c         |    6 --
  libavcodec/mpegvideo.c            |    6 --
  libavcodec/mpegvideo_enc.c        |   16 
  libavcodec/msmpeg4.c              |   14 --
  libavcodec/parser.c               |    1 -
  libavcodec/put_bits.h             |    5 -
  libavcodec/ratecontrol.c          |   25 +++--
  libavcodec/rv10.c                 |    7 +--
  libavcodec/shorten.c              |    1 -
  libavcodec/snow.c                 |    2 --
  libavcodec/svq1dec.c              |    3 ---
  libavcodec/truemotion2.c          |    1 -
  libavcodec/utils.c                |    1 -
  libavcodec/vc1.c                  |    4 
  libavcodec/vc1dec.c               |    1 -
  libavcodec/vorbis.c               |    1 -
  libavcodec/vp3.c                  |    1 -
  libavcodec/w32thread.c            |    6 --
  libavcodec/wmadec.c               |    5 -
  libavcodec/wmaenc.c               |    1 -
  libavcodec/wmv2dec.c              |    8 
  libavcodec/x86/mpegvideo_mmx.c    |    2 --
  libavdevice/v4l.c                 |    1 -
  libavformat/asfdec.c              |   26 --
  libavformat/assdec.c              |    2 --
  libavformat/avidec.c              |   12 
  libavformat/avienc.c              |    2 --
  libavformat/ffmdec.c              |    3 ---
  libavformat/flvdec.c              |    2 --
  libavformat/flvenc.c              |    2 --
  libavformat/h263dec.c             |    2 --
  libavformat/movenc.c              |    1 -
  libavformat/mpeg.c                |    2 --
  libavformat/mpegenc.c             |    2 --
  libavformat/mpegts.c              |    2 --
  libavformat/mpegtsenc.c           |    1 -
  libavformat/mxfenc.c              |    1 -
  libavformat/nutenc.c              |    4 
  libavformat/rmdec.c               |    3 ---
  libavformat/rtsp.c                |    2 --
  libavformat/swfdec.c              |    1 -
  libavformat/utils.c               |    9 -
  libavutil/lfg.c                   |    1 -
  libswscale/ppc/swscale_template.c |    2 --
  libswscale/swscale-test.c         |    6 --
  libswscale/swscale_template.c     |    2 --
  libswscale/utils.c                |    1 -
  libswscale/x86/swscale_template.c |    1 -
  tools/pktdumper.c                 |    1 -
  82 files changed, 6 insertions(+), 341 deletions(-)


Again I plead, please don't remove debug code unless it really is bogus.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 4/4] aacdec: remove sf_scale and sf_offset.

2011-04-26 Thread Aℓex Converse
On Tue, Apr 26, 2011 at 2:10 PM, Justin Ruggles
justin.rugg...@gmail.com wrote:

 Instead, scalefactors are adjusted by the offset amount, removing the need
 for sf_scale, and the MDCT scales are adjusted to compensate for the higher
 scalefactors. Floating-point output will be handled by modifying the MDCT
 scales.

OK
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 3/4] aacdec: use a scale of 2 in the LTP MDCT rather than doubling the coefficient table values from the spec.

2011-04-26 Thread Aℓex Converse
On Tue, Apr 26, 2011 at 2:10 PM, Justin Ruggles
justin.rugg...@gmail.com wrote:
 ---
  libavcodec/aacdec.c    |    2 +-
  libavcodec/aacdectab.h |    6 +++---
  2 files changed, 4 insertions(+), 4 deletions(-)


OK
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Eliminate [u]int_fast[8/16/32/64]_t integer types.

2011-04-25 Thread Aℓex Converse
On Mon, Apr 25, 2011 at 7:35 AM, Diego Biurrun di...@biurrun.de wrote:
 The _fast integer types provide no realworld benefits, but may
 introduce portability issues and are just plain ugly.
 ---

If anyone is unconvinced that these types are a huge pain in the ass consider:

int foo () {
uint8_fast_t x = 5;
int y = -2;
return (x  y);
}

And this is not hypothetical. It really did bite us:

http://git.libav.org/?p=libav.git;a=commitdiff;h=51aaf51143825112b0c499a48212e6f086c1a580
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Remove stray libavcore and _g binary references.

2011-04-25 Thread Aℓex Converse
On Sun, Apr 24, 2011 at 2:21 AM, Reinhard Tartler siret...@tauware.de wrote:
 On Sun, Apr 24, 2011 at 10:53:31 (CEST), Diego Biurrun wrote:

 On Sat, Apr 23, 2011 at 11:50:00AM -0700, Alex Converse wrote:
 On Sat, Apr 23, 2011 at 5:16 AM, Diego Biurrun di...@biurrun.de wrote:
 
  --- a/Changelog
  +++ b/Changelog
  @@ -27,7 +27,6 @@ version 0.7_beta1:
   - ANSI/ASCII art playback system
   - Lego Mindstorms RSO de/muxer
  -- libavcore added
   - SubRip subtitle file muxer and demuxer
   - Chinese AVS encoding via libxavs

 please don't remove this. Libavcore did exist for a time.

 IMO this can only serve to confuse the reader (that does not follow
 development closely).  The removal of libavcore was not mentioned in
 the changelog, so whoever looks at it (a year from now) will be kept
 wondering what this libavcore thing is and where it went to.

 I tend to agree with Diego. The Changelog file serves primarily for
 reference what's different from the latest releases. If libavcore was
 already in the 0.6 series, then its removal should of course be
 mentioned. However like this, it's rather confusing IMO.


How about libavcore added and subsequently removed. It was present
for a non-trivial amount of time.

That way if someone had a snapshot with libavcore and they upgrade
they aren't left wondering what happened.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Add floating-point sample format support to the ac3, eac3, dca, aac, and vorbis decoders.

2011-04-25 Thread Aℓex Converse
On Sat, Apr 23, 2011 at 1:35 PM, Ronald S. Bultje rsbul...@gmail.com wrote:
 Hi,

 On Sat, Apr 23, 2011 at 4:00 PM, Justin Ruggles
 justin.rugg...@gmail.com wrote:
 On 04/23/2011 03:55 PM, Justin Ruggles wrote:


 Based on patches by clsid2 in ffdshow-tryout.
 ---
  configure               |    2 ++
  libavcodec/aac.h        |    2 +-
  libavcodec/aacdec.c     |   37 ++---
  libavcodec/aacsbr.c     |    7 +--
  libavcodec/ac3dec.c     |   33 -
  libavcodec/dca.c        |   28 +---
  libavcodec/vorbis_dec.c |   23 ++-
  7 files changed, 117 insertions(+), 15 deletions(-)


 This updated patch fixes decoding AAC w/ SBR.  But one of the fate aac
 samples doesn't pass due to being slightly off.  I don't know the best
 way to fix that...

 TEST    aac-am00_88
 stddev:    1.91 PSNR: 90.69 MAXDIFF:   64 bytes: 11563008/ 11563008

 For float, just increase the amount by which it is allowed to be off
 in the test specs.


64 seems fairly large. Are you sure scale isn't off somewhere in the
main predictor?
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 14/35] yadif: Fix assert() failure

2011-04-21 Thread Aℓex Converse
On Thu, Apr 21, 2011 at 8:46 AM, Diego Biurrun di...@biurrun.de wrote:
 On Wed, Apr 20, 2011 at 09:45:21PM +0200, Anton Khirnov wrote:
 From: Michael Niedermayer michae...@gmx.at

 The log message for this commit is in need of improvement.


We're going in circles here. Feel free to *suggest* a message.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] swscale: Add missing const qualifiers in sws_scale() / check_image_pointers().

2011-04-21 Thread Aℓex Converse
On Thu, Apr 21, 2011 at 7:44 AM, Diego Biurrun di...@biurrun.de wrote:
 This fixes the following warnings:
 libswscale/swscale.c:1836: warning: passing argument 1 of 
 ‘check_image_pointers’ from incompatible pointer type
 libswscale/swscale.c:1806: note: expected ‘uint8_t **’ but argument is of 
 type ‘const uint8_t * const*’
 libswscale/swscale.c:1840: warning: passing argument 1 of 
 ‘check_image_pointers’ discards qualifiers from pointer target type
 libswscale/swscale.c:1806: note: expected ‘uint8_t **’ but argument is of 
 type ‘uint8_t * const*’
 ---
  libswscale/swscale.c |    4 ++--
  libswscale/swscale.h |    5 +++--
  2 files changed, 5 insertions(+), 4 deletions(-)

 diff --git a/libswscale/swscale.c b/libswscale/swscale.c
 index f4f4bcb..d70c5ea 100644
 --- a/libswscale/swscale.c
 +++ b/libswscale/swscale.c
 @@ -1803,7 +1803,7 @@ static void reset_ptr(const uint8_t* src[], int format)
     }
  }

 -static int check_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt,
 +static int check_image_pointers(const uint8_t * const data[4], enum 
 PixelFormat pix_fmt,
                                 const int linesizes[4])
  {
     const AVPixFmtDescriptor *desc = av_pix_fmt_descriptors[pix_fmt];
 @@ -1823,7 +1823,7 @@ static int check_image_pointers(uint8_t *data[4], enum 
 PixelFormat pix_fmt,
  * Assumes planar YUV to be in YUV order instead of YVU.
  */
  int sws_scale(SwsContext *c, const uint8_t* const src[], const int 
 srcStride[], int srcSliceY,
 -              int srcSliceH, uint8_t* const dst[], const int dstStride[])
 +              int srcSliceH, const uint8_t* const dst[], const int 
 dstStride[])
  {
     int i;
     const uint8_t* src2[4]= {src[0], src[1], src[2], src[3]};
 diff --git a/libswscale/swscale.h b/libswscale/swscale.h
 index 672e30b..7a4d98e 100644
 --- a/libswscale/swscale.h
 +++ b/libswscale/swscale.h
 @@ -220,8 +220,9 @@ struct SwsContext *sws_getContext(int srcW, int srcH, 
 enum PixelFormat srcFormat
  *                  the destination image
  * @return          the height of the output slice
  */
 -int sws_scale(struct SwsContext *context, const uint8_t* const srcSlice[], 
 const int srcStride[],
 -              int srcSliceY, int srcSliceH, uint8_t* const dst[], const int 
 dstStride[]);
 +int sws_scale(struct SwsContext *context, const uint8_t * const srcSlice[],
 +              const int srcStride[], int srcSliceY, int srcSliceH,
 +              const uint8_t * const dst[], const int dstStride[]);


declare dst as array of const pointer to const uint8_t?
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 20/35] scale: implement interlaced scaling.

2011-04-21 Thread Aℓex Converse
On Thu, Apr 21, 2011 at 8:57 AM, Diego Biurrun di...@biurrun.de wrote:
 On Wed, Apr 20, 2011 at 09:45:27PM +0200, Anton Khirnov wrote:
 From: Michael Niedermayer michae...@gmx.at

 Please reformat as KR, poor Stefano is getting his pet project
 uglified.  Let's keep it proper on our side.


I object to this objection.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] AVX FFT

2011-04-21 Thread Aℓex Converse
On Thu, Apr 21, 2011 at 9:47 AM, Vitor Sessak vitor1...@gmail.com wrote:
 $subj

 -Vitor


 libavcodec/binkaudio.c |2 +-
 libavcodec/fft.c   |   57 +-
 libavcodec/fft.h   |3 +-
 libavcodec/imc.c   |2 +-
 libavcodec/qdm2.c  |2 +-
 libavcodec/wmavoice.c  |6 +-
 libavcodec/x86/fft.c   |9 +-
 libavcodec/x86/fft.h   |1 +
 libavcodec/x86/fft_mmx.asm |  488 +---
 libavcodec/x86/fft_sse.c   |   12 +


 libavcodec/x86/x86inc.asm  |  259 +++-
 libavutil/mem.c|   16 +-

These last two seem like they belong in their own patch.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Decouple av_log_missing_feature() and av_log_ask_for_sample().

2011-04-21 Thread Aℓex Converse
On Thu, Apr 21, 2011 at 10:10 AM, Diego Biurrun di...@biurrun.de wrote:
 Do not call av_log_ask_for_sample() from av_log_missing_feature() depending on
 the value of a flag parameter. Instead, call av_log_ask_for_sample() directly
 where this is desired. This simplifies av_log_missing_feature() and makes for
 a nicer API.
 ---
  libavcodec/aac_adtstoasc_bsf.c |    5 +++--
  libavcodec/aacdec.c            |   20 +---
  libavcodec/aacsbr.c            |    5 +++--
  libavcodec/ac3dec.c            |    3 ++-
  libavcodec/alsdec.c            |    2 +-
  libavcodec/amrnbdec.c          |    3 ++-
  libavcodec/amrwbdec.c          |    6 --
  libavcodec/avcodec.h           |    6 +-
  libavcodec/eac3dec.c           |   12 
  libavcodec/flacdec.c           |    2 +-
  libavcodec/mpc8.c              |    3 ++-
  libavcodec/utils.c             |   11 +++
  libavcodec/vc1.c               |    2 +-
  libavcodec/vp8.c               |    6 --
  libavcodec/wmavoice.c          |    3 ++-
  libavformat/rtpdec_latm.c      |    8 +---
  libavformat/rtpdec_qt.c        |    9 ++---
  libavformat/spdifdec.c         |    5 +++--
  18 files changed, 64 insertions(+), 47 deletions(-)

 diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c
 index fbb86f8..6071b5c 100644

[...]

 diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
 index 7727ad0..e6bcc80 100644
 --- a/libavcodec/avcodec.h
 +++ b/libavcodec/avcodec.h
 @@ -4097,12 +4097,8 @@ unsigned int av_xiphlacing(unsigned char *s, unsigned 
 int v);
  * @param[in] avc a pointer to an arbitrary struct of which the first field is
  * a pointer to an AVClass struct
  * @param[in] feature string containing the name of the missing feature
 - * @param[in] want_sample indicates if samples are wanted which exhibit this 
 feature.
 - * If want_sample is non-zero, additional verbage will be added to the log
 - * message which tells the user how to report samples to the development
 - * mailing list.
  */
 -void av_log_missing_feature(void *avc, const char *feature, int want_sample);
 +void av_log_missing_feature(void *avc, const char *feature);

  /**
  * Log a generic warning message asking for a sample. This function is

[...]

This is a public header.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/4] Add request_sample_fmt field to AVCodecContext.

2011-04-21 Thread Aℓex Converse
On Thu, Apr 21, 2011 at 10:23 AM, Justin Ruggles
justin.rugg...@gmail.com wrote:

 This will allow audio decoders to support output of different sample formats
 as a runtime option.
 ---
  libavcodec/avcodec.h |    7 +++
  libavcodec/options.c |    6 ++
  libavcodec/version.h |    2 +-
  3 files changed, 14 insertions(+), 1 deletions(-)


+1
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Decouple av_log_missing_feature() and av_log_ask_for_sample().

2011-04-21 Thread Aℓex Converse
On Thu, Apr 21, 2011 at 11:02 AM, Diego Biurrun di...@biurrun.de wrote:
 On Thu, Apr 21, 2011 at 10:56:07AM -0700, Aℓex Converse wrote:
 On Thu, Apr 21, 2011 at 10:10 AM, Diego Biurrun di...@biurrun.de wrote:
  Do not call av_log_ask_for_sample() from av_log_missing_feature() 
  depending on
  the value of a flag parameter. Instead, call av_log_ask_for_sample() 
  directly
  where this is desired. This simplifies av_log_missing_feature() and makes 
  for
  a nicer API.
  ---
   libavcodec/aac_adtstoasc_bsf.c |    5 +++--
   libavcodec/aacdec.c            |   20 +---
   libavcodec/aacsbr.c            |    5 +++--
   libavcodec/ac3dec.c            |    3 ++-
   libavcodec/alsdec.c            |    2 +-
   libavcodec/amrnbdec.c          |    3 ++-
   libavcodec/amrwbdec.c          |    6 --
   libavcodec/avcodec.h           |    6 +-
   libavcodec/eac3dec.c           |   12 
   libavcodec/flacdec.c           |    2 +-
   libavcodec/mpc8.c              |    3 ++-
   libavcodec/utils.c             |   11 +++
   libavcodec/vc1.c               |    2 +-
   libavcodec/vp8.c               |    6 --
   libavcodec/wmavoice.c          |    3 ++-
   libavformat/rtpdec_latm.c      |    8 +---
   libavformat/rtpdec_qt.c        |    9 ++---
   libavformat/spdifdec.c         |    5 +++--
   18 files changed, 64 insertions(+), 47 deletions(-)
 
  --- a/libavcodec/avcodec.h
  +++ b/libavcodec/avcodec.h
  @@ -4097,12 +4097,8 @@ unsigned int av_xiphlacing(unsigned char *s, 
  unsigned int v);
   * @param[in] avc a pointer to an arbitrary struct of which the first 
  field is
   * a pointer to an AVClass struct
   * @param[in] feature string containing the name of the missing feature
  - * @param[in] want_sample indicates if samples are wanted which exhibit 
  this feature.
  - * If want_sample is non-zero, additional verbage will be added to the log
  - * message which tells the user how to report samples to the development
  - * mailing list.
   */
  -void av_log_missing_feature(void *avc, const char *feature, int 
  want_sample);
  +void av_log_missing_feature(void *avc, const char *feature);
 
   /**
   * Log a generic warning message asking for a sample. This function is

 [...]

 This is a public header.

 You mean that this would require a major/minor bump?  We're in the period
 fter the bump that is officially declared unstable API time, plus those
 functions are not supposed to be used outside of libav* as the Doxygen
 explains:

  /**
  * Logs a generic warning message about a missing feature. This function is
  * intended to be used internally by Libav (libavcodec, libavformat, etc.)
  * only, and would normally not be used by applications.

 I didn't make this up, don't shoot the messenger :)


Since libavformat and libavcodec were bumped at the same time and the
API is declared unstable I suppose this is ok. For extra karma
consider moving it to a not-installed header.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/4] Add APIchanges entry for request_sample_fmt.

2011-04-21 Thread Aℓex Converse
On Thu, Apr 21, 2011 at 10:23 AM, Justin Ruggles
justin.rugg...@gmail.com wrote:
 ---
  doc/APIchanges |    3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)


+1 assuming values are filled in before pushing.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Decouple av_log_missing_feature() and av_log_ask_for_sample().

2011-04-21 Thread Aℓex Converse
On Thu, Apr 21, 2011 at 11:09 AM, Ronald S. Bultje rsbul...@gmail.com wrote:
 Hi,

 2011/4/21 Aℓex Converse aconve...@google.com:
 On Thu, Apr 21, 2011 at 11:02 AM, Diego Biurrun di...@biurrun.de wrote:
 On Thu, Apr 21, 2011 at 10:56:07AM -0700, Aℓex Converse wrote:
 On Thu, Apr 21, 2011 at 10:10 AM, Diego Biurrun di...@biurrun.de wrote:
  Do not call av_log_ask_for_sample() from av_log_missing_feature() 
  depending on
  the value of a flag parameter. Instead, call av_log_ask_for_sample() 
  directly
  where this is desired. This simplifies av_log_missing_feature() and 
  makes for
  a nicer API.
  ---
   libavcodec/aac_adtstoasc_bsf.c |    5 +++--
   libavcodec/aacdec.c            |   20 +---
   libavcodec/aacsbr.c            |    5 +++--
   libavcodec/ac3dec.c            |    3 ++-
   libavcodec/alsdec.c            |    2 +-
   libavcodec/amrnbdec.c          |    3 ++-
   libavcodec/amrwbdec.c          |    6 --
   libavcodec/avcodec.h           |    6 +-
   libavcodec/eac3dec.c           |   12 
   libavcodec/flacdec.c           |    2 +-
   libavcodec/mpc8.c              |    3 ++-
   libavcodec/utils.c             |   11 +++
   libavcodec/vc1.c               |    2 +-
   libavcodec/vp8.c               |    6 --
   libavcodec/wmavoice.c          |    3 ++-
   libavformat/rtpdec_latm.c      |    8 +---
   libavformat/rtpdec_qt.c        |    9 ++---
   libavformat/spdifdec.c         |    5 +++--
   18 files changed, 64 insertions(+), 47 deletions(-)
 
  --- a/libavcodec/avcodec.h
  +++ b/libavcodec/avcodec.h
  @@ -4097,12 +4097,8 @@ unsigned int av_xiphlacing(unsigned char *s, 
  unsigned int v);
   * @param[in] avc a pointer to an arbitrary struct of which the first 
  field is
   * a pointer to an AVClass struct
   * @param[in] feature string containing the name of the missing feature
  - * @param[in] want_sample indicates if samples are wanted which exhibit 
  this feature.
  - * If want_sample is non-zero, additional verbage will be added to the 
  log
  - * message which tells the user how to report samples to the development
  - * mailing list.
   */
  -void av_log_missing_feature(void *avc, const char *feature, int 
  want_sample);
  +void av_log_missing_feature(void *avc, const char *feature);
 
   /**
   * Log a generic warning message asking for a sample. This function is

 [...]

 This is a public header.

 You mean that this would require a major/minor bump?  We're in the period
 fter the bump that is officially declared unstable API time, plus those
 functions are not supposed to be used outside of libav* as the Doxygen
 explains:

  /**
  * Logs a generic warning message about a missing feature. This function is
  * intended to be used internally by Libav (libavcodec, libavformat, etc.)
  * only, and would normally not be used by applications.

 I didn't make this up, don't shoot the messenger :)

 Since libavformat and libavcodec were bumped at the same time and the
 API is declared unstable I suppose this is ok. For extra karma
 consider moving it to a not-installed header.

 It needs to remain av_*() prefixed since it's shared between avf/avc, though.


We keep flip-flopping on this. There are plenty of ff_ symbols shard
between the two.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Use av_log_ask_for_sample() where appropriate.

2011-04-21 Thread Aℓex Converse
On Thu, Apr 21, 2011 at 10:39 AM, Diego Biurrun di...@biurrun.de wrote:
 ---
  libavcodec/cook.c        |   12 ++--
  libavcodec/truemotion1.c |    4 ++--
  libavcodec/tta.c         |    5 +++--
  libavcodec/v210x.c       |    2 +-
  4 files changed, 12 insertions(+), 11 deletions(-)

 diff --git a/libavcodec/cook.c b/libavcodec/cook.c
 index 7717c4b..0e792af 100644
 --- a/libavcodec/cook.c
 +++ b/libavcodec/cook.c
 @@ -1136,7 +1136,7 @@ static av_cold int cook_decode_init(AVCodecContext 
 *avctx)
         switch (q-subpacket[s].cookversion) {
             case MONO:
                 if (q-nb_channels != 1) {
 -                    av_log(avctx,AV_LOG_ERROR,Container channels != 1, 
 report sample!\n);
 +                    av_log_ask_for_sample(avctx, Container channels != 
 1.!\n);

[...]

 -                    av_log(avctx,AV_LOG_ERROR,Container channels != 2, 
 report sample!\n);
 +                    av_log_ask_for_sample(avctx, Container channels != 
 2.\n);

This is inconsistent.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] Remove RDFT dependency from AAC decoder.

2011-04-21 Thread Aℓex Converse
$subj
From 557176d961c70604c2a96d81aff4bd6faa670d8a Mon Sep 17 00:00:00 2001
From: Alex Converse aconve...@google.com
Date: Thu, 21 Apr 2011 12:11:42 -0700
Subject: [PATCH] Remove RDFT dependency from AAC decoder.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=1

This is a multi-part message in MIME format.
--1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


It was used for an old implementation of the SBR filterbank.

./configure --disable-everything --disable-ffplay --enable-decoder=aac works.
---
 configure |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


--1
Content-Type: text/x-patch; name=0001-Remove-RDFT-dependency-from-AAC-decoder.patch
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=0001-Remove-RDFT-dependency-from-AAC-decoder.patch

diff --git a/configure b/configure
index dd44ba4..c01c551 100755
--- a/configure
+++ b/configure
@@ -1237,7 +1237,7 @@ mdct_select=fft
 rdft_select=fft
 
 # decoders / encoders / hardware accelerators
-aac_decoder_select=mdct rdft sinewin
+aac_decoder_select=mdct sinewin
 aac_encoder_select=mdct sinewin
 aac_latm_decoder_select=aac_decoder aac_latm_parser
 ac3_decoder_select=mdct ac3dsp ac3_parser

--1--


___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] Add some debug log messages to AAC extradata

2011-04-20 Thread Aℓex Converse
On Wed, Apr 20, 2011 at 11:39 AM, Justin Ruggles
justin.rugg...@gmail.com wrote:
 On 04/20/2011 02:26 PM, Alex Converse wrote:

 ---
  libavcodec/aacdec.c |   10 +-
  1 files changed, 9 insertions(+), 1 deletions(-)



 0002-Add-some-Debug-log-messages-to-AAC-extradata.patch


 diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
 index c9761a1..3ec274f 100644
 --- a/libavcodec/aacdec.c
 +++ b/libavcodec/aacdec.c
 @@ -79,7 +79,6 @@
             Parametric Stereo.
   */

 -
  #include avcodec.h
  #include internal.h
  #include get_bits.h


 stray whitespace change


oops, fixed
From 94e8d0eea77480630f84368c97646cabc0f50628 Mon Sep 17 00:00:00 2001
From: Alex Converse aconve...@google.com
Date: Wed, 20 Apr 2011 11:23:34 -0700
Subject: [PATCH] Add some debug log messages to AAC extradata
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=1

This is a multi-part message in MIME format.
--1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 libavcodec/aacdec.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)


--1
Content-Type: text/x-patch; name=0002-Add-some-debug-log-messages-to-AAC-extradata.patch
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=0002-Add-some-debug-log-messages-to-AAC-extradata.patch

diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index c9761a1..a92be0a 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -464,6 +464,11 @@ static int decode_audio_specific_config(AACContext *ac,
 GetBitContext gb;
 int i;
 
+av_dlog(avctx, extradata size %d\n, avctx-extradata_size);
+for (i = 0; i  avctx-extradata_size; i++)
+ av_dlog(avctx, %02x , avctx-extradata[i]);
+av_dlog(avctx, \n);
+
 init_get_bits(gb, data, data_size * 8);
 
 if ((i = ff_mpeg4audio_get_config(m4ac, data, data_size))  0)
@@ -490,6 +495,10 @@ static int decode_audio_specific_config(AACContext *ac,
 return -1;
 }
 
+av_dlog(avctx, AOT %d chan config %d sampling index %d (%d) SBR %d PS %d\n,
+m4ac-object_type, m4ac-chan_config, m4ac-sampling_index,
+m4ac-sample_rate, m4ac-sbr, m4ac-ps);
+
 return get_bits_count(gb);
 }
 

--1--


___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 21/35] scale: don't leak sws contexts.

2011-04-20 Thread Aℓex Converse
On Wed, Apr 20, 2011 at 12:45 PM, Anton Khirnov an...@khirnov.net wrote:
 From: Michael Niedermayer michae...@gmx.at

 Signed-off-by: Anton Khirnov an...@khirnov.net
 ---
  libavfilter/vf_scale.c |    2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)

 diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
 index ae04802..831196c 100644
 --- a/libavfilter/vf_scale.c
 +++ b/libavfilter/vf_scale.c
 @@ -144,6 +144,8 @@ static int config_props(AVFilterLink *outlink)

     scale-input_is_pal = av_pix_fmt_descriptors[inlink-format].flags  
 PIX_FMT_PAL;

 +    if(scale-sws)
 +        sws_freeContext(scale-sws);
     scale-sws = sws_getContext(inlink -w, inlink -h, inlink -format,
                                 outlink-w, outlink-h, outlink-format,
                                 scale-flags, NULL, NULL, NULL);

Why can this context leak but not the next two?
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/6] Prefer codec specific options over global ones, allowing codec to override global options. (cherry picked from commit d319064465e148b8adb53d1ea5d38c09f987056e)

2011-04-20 Thread Aℓex Converse
On Wed, Apr 20, 2011 at 3:40 PM, Alex Converse aconve...@google.com wrote:
 ---
  cmdutils.c |   79 
 
  1 files changed, 42 insertions(+), 37 deletions(-)


From 480dd6ea23b6f8f4c88e92c6cf02c49255c613d3 Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier baptiste.coudur...@gmail.com
Date: Tue, 19 Apr 2011 12:57:46 -0700
Subject: [PATCH 2/6] Prefer codec specific options over global ones, allowing codec
 to override global options.
 (cherry picked from commit d319064465e148b8adb53d1ea5d38c09f987056e)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=1

This is a multi-part message in MIME format.
--1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 cmdutils.c |   79 
 1 files changed, 42 insertions(+), 37 deletions(-)


--1
Content-Type: text/x-patch; name=0002-Prefer-codec-specific-options-over-global-ones-allow.patch
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=0002-Prefer-codec-specific-options-over-global-ones-allow.patch

diff --git a/cmdutils.c b/cmdutils.c
index 4aef03d..cd4c05b 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -79,12 +79,8 @@ void uninit_opts(void)
 av_freep(sws_opts);
 #endif
 for (i = 0; i  opt_name_count; i++) {
-//opt_values are only stored for codec-specific options in which case
-//both the name and value are dup'd
-if (opt_values[i]) {
-av_freep(opt_names[i]);
-av_freep(opt_values[i]);
-}
+av_freep(opt_names[i]);
+av_freep(opt_values[i]);
 }
 av_freep(opt_names);
 av_freep(opt_values);
@@ -231,6 +227,23 @@ int opt_default(const char *opt, const char *arg){
 int ret= 0;
 const AVOption *o= NULL;
 int opt_types[]={AV_OPT_FLAG_VIDEO_PARAM, AV_OPT_FLAG_AUDIO_PARAM, 0, AV_OPT_FLAG_SUBTITLE_PARAM, 0};
+AVCodec *p = NULL;
+AVOutputFormat *oformat = NULL;
+
+while ((p = av_codec_next(p))) {
+AVClass *c = p-priv_class;
+if (c  av_find_opt(c, opt, NULL, 0, 0))
+break;
+}
+if (p)
+goto out;
+while ((oformat = av_oformat_next(oformat))) {
+const AVClass *c = oformat-priv_class;
+if (c  av_find_opt(c, opt, NULL, 0, 0))
+break;
+}
+if (oformat)
+goto out;
 
 for(type=0; *avcodec_opts  typeAVMEDIA_TYPE_NB  ret= 0; type++){
 const AVOption *o2 = av_find_opt(avcodec_opts[0], opt, NULL, opt_types[type], opt_types[type]);
@@ -248,39 +261,25 @@ int opt_default(const char *opt, const char *arg){
 ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_VIDEO], opt+1, arg, 1, o);
 else if(opt[0] == 's'  avcodec_opts[AVMEDIA_TYPE_SUBTITLE])
 ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], opt+1, arg, 1, o);
+if (ret = 0)
+opt += 1;
 }
 if (o  ret  0) {
 fprintf(stderr, Invalid value '%s' for option '%s'\n, arg, opt);
 exit(1);
 }
 if (!o) {
-AVCodec *p = NULL;
-AVOutputFormat *oformat = NULL;
-while ((p=av_codec_next(p))){
-AVClass *c= p-priv_class;
-if(c  av_find_opt(c, opt, NULL, 0, 0))
-break;
-}
-if (!p) {
-while ((oformat = av_oformat_next(oformat))) {
-const AVClass *c = oformat-priv_class;
-if (c  av_find_opt(c, opt, NULL, 0, 0))
-break;
-}
-}
-if(!p  !oformat){
-fprintf(stderr, Unrecognized option '%s'\n, opt);
-exit(1);
-}
+fprintf(stderr, Unrecognized option '%s'\n, opt);
+exit(1);
 }
 
+ out:
 //av_log(NULL, AV_LOG_ERROR, %s:%s: %f 0x%0X\n, opt, arg, av_get_double(avcodec_opts, opt, NULL), (int)av_get_int(avcodec_opts, opt, NULL));
 
-//FIXME we should always use avcodec_opts, ... for storing options so there will not be any need to keep track of what i set over this
 opt_values= av_realloc(opt_values, sizeof(void*)*(opt_name_count+1));
-opt_values[opt_name_count]= o ? NULL : av_strdup(arg);
+opt_values[opt_name_count] = av_strdup(arg);
 opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1));
-opt_names[opt_name_count++]= o ? o-name : av_strdup(opt);
+opt_names[opt_name_count++] = av_strdup(opt);
 
 if ((*avcodec_opts  avcodec_opts[0]-debug) || (avformat_opts  avformat_opts-debug))
 av_log_set_level(AV_LOG_DEBUG);
@@ -354,16 +353,22 @@ void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec)
 for(i=0; iopt_name_count; i++){
 char buf[256];
 const AVOption *opt;
-const char *str= av_get_string(opts_ctx, opt_names[i], opt, buf, sizeof(buf));
-/* if an option with name opt_names[i] is present in opts_ctx then str is non-NULL */
-

Re: [libav-devel] [PATCH 3/6] In libx264 wrapper, do not set pic quality if no frame is output, avoids uninitialized reads. (cherry picked from commit 46f83e5b3c17a46fa9c86421e7b511cd00cb5d60)

2011-04-20 Thread Aℓex Converse
On Wed, Apr 20, 2011 at 3:40 PM, Alex Converse aconve...@google.com wrote:
 ---
  libavcodec/libx264.c |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


From 8f0f1bbd47e38a1303cd969399d34168d15f33ca Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier baptiste.coudur...@gmail.com
Date: Sat, 29 Jan 2011 17:05:42 -0800
Subject: [PATCH 3/6] In libx264 wrapper, do not set pic quality if no frame is output, avoids
 uninitialized reads.
 (cherry picked from commit 46f83e5b3c17a46fa9c86421e7b511cd00cb5d60)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=1

This is a multi-part message in MIME format.
--1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 libavcodec/libx264.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)


--1
Content-Type: text/x-patch; name=0003-In-libx264-wrapper-do-not-set-pic-quality-if-no-fram.patch
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=0003-In-libx264-wrapper-do-not-set-pic-quality-if-no-fram.patch

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index df4c577..82f769a 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -144,7 +144,8 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf,
 }
 
 x4-out_pic.key_frame = pic_out.b_keyframe;
-x4-out_pic.quality   = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA;
+if (bufsize)
+x4-out_pic.quality = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA;
 
 return bufsize;
 }

--1--


___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 4/6] Fix libx264 fastfirstpass, move apply_fastfirstpass after user customized options. (cherry picked from commit 37c0a443f9aa01fcf33215b3cde06961f1e9df5c)

2011-04-20 Thread Aℓex Converse
On Wed, Apr 20, 2011 at 3:40 PM, Alex Converse aconve...@google.com wrote:
 ---
  libavcodec/libx264.c |   14 +++---
  1 files changed, 7 insertions(+), 7 deletions(-)


From abb44bdc8e25a75c3beaf47fd23bc9ca48490ccc Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier baptiste.coudur...@gmail.com
Date: Tue, 19 Apr 2011 15:23:36 -0700
Subject: [PATCH 4/6] Fix libx264 fastfirstpass, move apply_fastfirstpass after user customized options.
 (cherry picked from commit 37c0a443f9aa01fcf33215b3cde06961f1e9df5c)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=1

This is a multi-part message in MIME format.
--1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 libavcodec/libx264.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)


--1
Content-Type: text/x-patch; name=0004-Fix-libx264-fastfirstpass-move-apply_fastfirstpass-a.patch
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=0004-Fix-libx264-fastfirstpass-move-apply_fastfirstpass-a.patch

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 82f769a..5971b74 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -262,13 +262,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
 return -1;
 }
 
-if (x4-fastfirstpass)
-x264_param_apply_fastfirstpass(x4-params);
-
-if (x4-profile)
-if (x264_param_apply_profile(x4-params, x4-profile)  0)
-return -1;
-
 x4-params.pf_log   = X264_log;
 x4-params.p_log_private= avctx;
 x4-params.i_log_level  = X264_LOG_DEBUG;
@@ -302,6 +295,13 @@ static av_cold int X264_init(AVCodecContext *avctx)
 (float)avctx-rc_initial_buffer_occupancy / avctx-rc_buffer_size;
 }
 
+if (x4-fastfirstpass)
+x264_param_apply_fastfirstpass(x4-params);
+
+if (x4-profile)
+if (x264_param_apply_profile(x4-params, x4-profile)  0)
+return -1;
+
 x4-params.i_width  = avctx-width;
 x4-params.i_height = avctx-height;
 x4-params.vui.i_sar_width  = avctx-sample_aspect_ratio.num;

--1--


___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 6/6] cmdutils: add OPT_INT check in parse_number_or_die()

2011-04-20 Thread Aℓex Converse
On Wed, Apr 20, 2011 at 3:40 PM, Alex Converse aconve...@google.com wrote:

 Check that the value passed for an OPT_INT option is an int, fail
 otherwise.
 (cherry picked from commit 584c2f1db82fbb8024ba2b6b4c48397efedcc125)
 ---
  cmdutils.c |    2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)



git send-email fail
From 7e1eca967dc812e74b2b34f6d69a734ecc1d0337 Mon Sep 17 00:00:00 2001
From: Stefano Sabatini stefano.sabatini-l...@poste.it
Date: Sat, 16 Apr 2011 13:41:53 +0200
Subject: [PATCH 6/6] cmdutils: add OPT_INT check in parse_number_or_die()
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=1

This is a multi-part message in MIME format.
--1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


Check that the value passed for an OPT_INT option is an int, fail
otherwise.
(cherry picked from commit 584c2f1db82fbb8024ba2b6b4c48397efedcc125)
---
 cmdutils.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)


--1
Content-Type: text/x-patch; name=0006-cmdutils-add-OPT_INT-check-in-parse_number_or_die.patch
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=0006-cmdutils-add-OPT_INT-check-in-parse_number_or_die.patch

diff --git a/cmdutils.c b/cmdutils.c
index cd4c05b..25b32ca 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -102,6 +102,8 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do
 error= The value for %s was %s which is not within %f - %f\n;
 else if(type == OPT_INT64  (int64_t)d != d)
 error= Expected int64 for %s but found %s\n;
+else if (type == OPT_INT  (int)d != d)
+error= Expected int for %s but found %s\n;
 else
 return d;
 fprintf(stderr, error, context, numstr, min, max);

--1--


___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] swscale: simplify rgb2rgb templating

2011-04-14 Thread Aℓex Converse
On Thu, Apr 14, 2011 at 2:01 PM, Stefano Sabatini
stefano.sabatini-l...@poste.it wrote:
 On date Thursday 2011-04-14 22:50:40 +0200, Diego Biurrun wrote:
 On Thu, Apr 14, 2011 at 10:43:50PM +0200, Stefano Sabatini wrote:
  On date Thursday 2011-04-14 22:12:36 +0200, Luca Barbato wrote:
   MMX is always built. Drop the ifdefs
   ---
    libswscale/x86/rgb2rgb.c          |    3 -
    libswscale/x86/rgb2rgb_template.c |  300 
   +
    2 files changed, 1 insertions(+), 302 deletions(-)
 
  Highly uninformative message for a committ removing 300 lines of code.

 Well, I think we have already improved in the log message quality
 department, but I agree there sure is still a way to go.

 This should likely better have been folded into one of the other
 patches - hindsight is striking back ..

  Also how if the #ifdef HAVE_BIGENDIAN removal related?


 x86 is little-endian, so the big-endian case has no place in the
 directory for x86 code.

 Ah OK, so I suppose the same is for the other #ifdef ARCH_ALPHA 
 HAVE_MVI etc. A mention in the log may be useful.

Perhaps in exchange you can tell us why only the first context can leak?

http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=bbd1c43fa3231cae594e9103a0e041977eafa244

Thanks,

Alex
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/2] Add an -apad option to ffmpeg to pad audio to video length.

2011-04-12 Thread Aℓex Converse
On Mon, Mar 28, 2011 at 6:02 PM, Justin Ruggles
justin.rugg...@gmail.com wrote:
 On 03/28/2011 06:14 PM, Alex Converse wrote:

 On Mon, Mar 28, 2011 at 2:37 PM, Justin Ruggles
 justin.rugg...@gmail.com wrote:
 On 03/28/2011 05:27 PM, Alex Converse wrote:

 On Mon, Mar 28, 2011 at 2:19 PM, Justin Ruggles
 justin.rugg...@gmail.com wrote:
 On 03/28/2011 04:54 PM, Alex Converse wrote:

 ---
  doc/ffmpeg.texi |    2 ++
  ffmpeg.c        |   47 +--
  2 files changed, 47 insertions(+), 2 deletions(-)



 0001-Add-an-apad-option-to-ffmpeg-to-pad-audio-to-video-l.patch


 diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
 index 21c6f2c..2927017 100644
 --- a/doc/ffmpeg.texi
 +++ b/doc/ffmpeg.texi
 @@ -579,6 +579,8 @@ ffmpeg -i file.mpg -vcodec copy -acodec ac3 -ab 384k 
 test.mpg -acodec mp2 -ab 19
  @end example
  @item -alang @var{code}
  Set the ISO 639 language code (3 letters) of the current audio stream.
 +@item -apad
 +Pad audio to video length.
  @end table

  @section Advanced Audio options:
 diff --git a/ffmpeg.c b/ffmpeg.c
 index 5e50db3..84a278e 100644
 --- a/ffmpeg.c
 +++ b/ffmpeg.c
 @@ -176,6 +176,7 @@ static int64_t channel_layout = 0;
  #define QSCALE_NONE -9
  static float audio_qscale = QSCALE_NONE;
  static int audio_disable = 0;
 +static int audio_pad = 0;
  static int audio_channels = 1;
  static char  *audio_codec_name = NULL;
  static unsigned int audio_codec_tag = 0;
 @@ -297,6 +298,7 @@ typedef struct AVOutputStream {
      int reformat_pair;
      AVAudioConvert *reformat_ctx;
      AVFifoBuffer *fifo;     /* for compression: one audio fifo per 
 codec */
 +
      FILE *logfile;
  } AVOutputStream;

 @@ -702,7 +704,8 @@ static void write_frame(AVFormatContext *s, AVPacket 
 *pkt, AVCodecContext *avctx
  static void do_audio_out(AVFormatContext *s,
                           AVOutputStream *ost,
                           AVInputStream *ist,
 -                         unsigned char *buf, int size)
 +                         unsigned char *buf, int size,
 +                         int skip_resample_reformat)
  {
      uint8_t *buftmp;
      int64_t audio_out_size, audio_buf_size;
 @@ -739,6 +742,7 @@ need_realloc:
          ffmpeg_exit(1);
      }

 +    if (!skip_resample_reformat) {
      if (enc-channels != dec-channels)
          ost-audio_resample = 1;

 @@ -871,6 +875,10 @@ need_realloc:
          buftmp = audio_buf;
          size_out = len*osize;
      }
 +    } else {
 +        buftmp = buf;
 +        size_out = size;
 +    }

      /* now encode as many frames as possible */
      if (enc-frame_size  1) {
 @@ -1603,7 +1611,7 @@ static int output_packet(AVInputStream *ist, int 
 ist_index,
                          av_assert0(ist-decoding_needed);
                          switch(ost-st-codec-codec_type) {
                          case AVMEDIA_TYPE_AUDIO:
 -                            do_audio_out(os, ost, ist, 
 decoded_data_buf, decoded_data_size);
 +                            do_audio_out(os, ost, ist, 
 decoded_data_buf, decoded_data_size, 0);
                              break;
                          case AVMEDIA_TYPE_VIDEO:
  #if CONFIG_AVFILTER
 @@ -1697,8 +1705,18 @@ static int output_packet(AVInputStream *ist, int 
 ist_index,
   discard_packet:
      if (pkt == NULL) {
          /* EOF handling */
 +        double vpts = 0.0;
 +
 +        for(i=0;inb_ostreams;i++) {
 +            ost = ost_table[i];
 +            if(ost-st-codec-codec_type == AVMEDIA_TYPE_VIDEO) {
 +                double opts = ost-st-pts.val * 
 av_q2d(ost-st-time_base);
 +                vpts = FFMAX(opts, vpts);
 +            }
 +        }

          for(i=0;inb_ostreams;i++) {
 +            int ost_pad_audio = audio_pad;
              ost = ost_table[i];
              if (ost-source_index == ist_index) {
                  AVCodecContext *enc= ost-st-codec;
 @@ -1713,13 +1731,37 @@ static int output_packet(AVInputStream *ist, int 
 ist_index,
                      for(;;) {
                          AVPacket pkt;
                          int fifo_bytes;
 +                        double opts;
                          av_init_packet(pkt);
                          pkt.stream_index= ost-index;

                          switch(ost-st-codec-codec_type) {
                          case AVMEDIA_TYPE_AUDIO:
 +                            opts = ost-st-pts.val * 
 av_q2d(ost-st-time_base);
                              fifo_bytes = av_fifo_size(ost-fifo);
                              ret = 0;
 +
 +                            if (ost_pad_audio  opts  vpts) {
 +                                int osize = 
 av_get_bits_per_sample_fmt(enc-sample_fmt)  3;
 +                                int frame_bytes = 
 enc-frame_size*osize*enc-channels;
 +                                ost_pad_audio = 0;
 +                                if (samples_size  frame_bytes)
 +                                    ffmpeg_exit(1);
 +                                memset(samples, 

Re: [libav-devel] [PATCH 05/14] Switch x86_reg to int for the C code

2011-04-11 Thread Aℓex Converse
On Mon, Apr 11, 2011 at 3:06 AM, Diego Biurrun di...@biurrun.de wrote:
 On Mon, Apr 11, 2011 at 11:07:38AM +0200, Luca Barbato wrote:
 ---
  libswscale/rgb2rgb_template.c |   28 ++--
  1 files changed, 14 insertions(+), 14 deletions(-)

 Why?  The log message is descriptive, but not explanatory...

I think descriptive is fine in this case. The explanation should be obvious.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/5] swscale: factorize FAST_BGR2YV12

2011-04-11 Thread Aℓex Converse
On Mon, Apr 11, 2011 at 1:01 PM, Luca Barbato lu_z...@gentoo.org wrote:
 It is used only for x86 so it will be moved once the code is moved in
 the arch dir

 Question: should we build an accurate BGR2YV12 variant?
 ---
  libswscale/rgb2rgb.c          |    4 ++--
  libswscale/swscale.c          |    2 --
  libswscale/swscale_internal.h |    2 ++
  3 files changed, 4 insertions(+), 4 deletions(-)

 diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
 index bc0ed63..e5a6e71 100644
 --- a/libswscale/rgb2rgb.c
 +++ b/libswscale/rgb2rgb.c
 @@ -30,8 +30,6 @@
  #include swscale.h
  #include swscale_internal.h

 -#define FAST_BGR2YV12 // use 7-bit instead of 15-bit coefficients
 -
  void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long src_size);
  void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
  void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
 @@ -98,6 +96,8 @@ void (*yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t 
 *vdst, const uint8_t
                      long lumStride, long chromStride, long srcStride);


 +
 +

These new lines seem unnecessary

  #if ARCH_X86
  DECLARE_ASM_CONST(8, uint64_t, mmx_ff)       = 0x00FFULL;
  DECLARE_ASM_CONST(8, uint64_t, mmx_null)     = 0xULL;
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH]AAC audio: Skip ADTS Header when copied from TS container to Non-TS containers

2011-04-11 Thread Aℓex Converse
On Mon, Apr 11, 2011 at 2:24 PM, Luca Barbato lu_z...@gentoo.org wrote:
 On 04/11/2011 11:14 PM, Manjunath Siddaiah wrote:
 Hi,

 When we do -acodec  copy if input is mpegts and output is non-mpegts
 ( MOV, MP4, 3GP, FLV, ISM) ADTS header also got copied.
 AAC audio do not need ADTS header in MOV, MP4, 3GP, FLV, ISM containers.
 This patch skips the ADTS header copying to non-mpegts formats.

 Does forcing the global header solve it ? The proposed patch looks
 wrong, the reported bug is real though.


-absf aac_adtstoasc

Once upon a time there was a patch pending to automatically insert
BSFs when needed.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] daud: Don't write packets that are too large to have their size expressed in the bytestream.

2011-04-08 Thread Aℓex Converse
On Fri, Apr 8, 2011 at 2:38 PM, Alex Converse aconve...@google.com wrote:
 ---
  libavformat/daud.c |    5 +
  1 files changed, 5 insertions(+), 0 deletions(-)


Let's try it again with the words in the correct order.
From bd42249155271af2127a00260b6eb3d36d08891c Mon Sep 17 00:00:00 2001
From: Alex Converse aconve...@google.com
Date: Fri, 8 Apr 2011 14:35:17 -0700
Subject: [PATCH] daud: Don't write packets that are too large to have their size expressed in the bytestream.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=1

This is a multi-part message in MIME format.
--1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 libavformat/daud.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)


--1
Content-Type: text/x-patch; name=0001-daud-Don-t-write-packets-that-are-too-large-to-have-.patch
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=0001-daud-Don-t-write-packets-that-are-too-large-to-have-.patch

diff --git a/libavformat/daud.c b/libavformat/daud.c
index ca9be27..1b3cfcf 100644
--- a/libavformat/daud.c
+++ b/libavformat/daud.c
@@ -57,6 +57,11 @@ static int daud_write_header(struct AVFormatContext *s)
 
 static int daud_write_packet(struct AVFormatContext *s, AVPacket *pkt)
 {
+if (pkt-size  65535) {
+av_log(s, AV_LOG_ERROR,
+   Packet size too large for s302m. (%d  65535)\n, pkt-size);
+return -1;
+}
 avio_wb16(s-pb, pkt-size);
 avio_wb16(s-pb, 0x8010); // unknown
 avio_write(s-pb, pkt-data, pkt-size);

--1--


___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel