[libav-devel] [PATCH] [0.8] x86: ac3dsp: Drop mmx variant of ac3_max_msb_abs_int16

2013-10-28 Thread Diego Biurrun
The function accidentally uses mmxext instructions, so it causes sigill
on mmx-only CPUs and provides no benefit on CPUs with mmxext available.
---

Given that this is for 0.8, more elaborate solutions don't seem worth
the trouble.

 libavcodec/x86/ac3dsp.asm   |9 -
 libavcodec/x86/ac3dsp_mmx.c |2 --
 2 files changed, 11 deletions(-)

diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm
index 9312ff6..1bfa0e4 100644
--- a/libavcodec/x86/ac3dsp.asm
+++ b/libavcodec/x86/ac3dsp.asm
@@ -86,7 +86,6 @@ AC3_EXPONENT_MIN sse2
 ; This function uses 2 different methods to calculate a valid result.
 ; 1) logical 'or' of abs of each element
 ;This is used for ssse3 because of the pabsw instruction.
-;It is also used for mmx because of the lack of min/max instructions.
 ; 2) calculate min/max for the array, then or(abs(min),abs(max))
 ;This is used for mmxext and sse2 because they have pminsw/pmaxsw.
 ;-
@@ -104,15 +103,9 @@ cglobal ac3_max_msb_abs_int16_%1, 2,2,5, src, len
 pmaxsw  m3, m0
 pmaxsw  m3, m1
 %else ; or_abs
-%ifidn %1, mmx
-movam0, [srcq]
-movam1, [srcq+mmsize]
-ABS2m0, m1, m3, m4
-%else ; ssse3
 ; using memory args is faster for ssse3
 pabsw   m0, [srcq]
 pabsw   m1, [srcq+mmsize]
-%endif
 por m2, m0
 por m2, m1
 %endif
@@ -137,9 +130,7 @@ cglobal ac3_max_msb_abs_int16_%1, 2,2,5, src, len
 %endmacro
 
 INIT_MMX
-%define ABS2 ABS2_MMX
 %define PSHUFLW pshufw
-AC3_MAX_MSB_ABS_INT16 mmx, or_abs
 %define ABS2 ABS2_MMX2
 AC3_MAX_MSB_ABS_INT16 mmxext, min_max
 INIT_XMM
diff --git a/libavcodec/x86/ac3dsp_mmx.c b/libavcodec/x86/ac3dsp_mmx.c
index d6bb469..a8c5054 100644
--- a/libavcodec/x86/ac3dsp_mmx.c
+++ b/libavcodec/x86/ac3dsp_mmx.c
@@ -27,7 +27,6 @@ extern void ff_ac3_exponent_min_mmx   (uint8_t *exp, int 
num_reuse_blocks, int n
 extern void ff_ac3_exponent_min_mmxext(uint8_t *exp, int num_reuse_blocks, int 
nb_coefs);
 extern void ff_ac3_exponent_min_sse2  (uint8_t *exp, int num_reuse_blocks, int 
nb_coefs);
 
-extern int ff_ac3_max_msb_abs_int16_mmx   (const int16_t *src, int len);
 extern int ff_ac3_max_msb_abs_int16_mmxext(const int16_t *src, int len);
 extern int ff_ac3_max_msb_abs_int16_sse2  (const int16_t *src, int len);
 extern int ff_ac3_max_msb_abs_int16_ssse3 (const int16_t *src, int len);
@@ -55,7 +54,6 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int 
bit_exact)
 
 if (mm_flags & AV_CPU_FLAG_MMX) {
 c->ac3_exponent_min = ff_ac3_exponent_min_mmx;
-c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx;
 c->ac3_lshift_int16 = ff_ac3_lshift_int16_mmx;
 c->ac3_rshift_int32 = ff_ac3_rshift_int32_mmx;
 }
-- 
1.7.10.4

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


Re: [libav-devel] [PATCH] configure: Move gcc-only -W option where it belongs

2013-10-28 Thread Luca Barbato
On 28/10/13 12:57, Vittorio Giovara wrote:
> On Mon, Oct 28, 2013 at 12:46 PM, Luca Barbato  wrote:
>> ---
>>
>> This should make clang users happier.
>>
> 
> Maybe unrelated but gcc-4.6.3 users are unaffected and still see the warning
> 
> cc1: warning: unrecognized command line option
> "-Wno-maybe-uninitialized" [enabled by default]
> 

lu_zero@nyx ~ $ gcc-4.6.3 -Wno-maybe-uninitialized -c e.c -o /tmp/t.o
lu_zero@nyx ~ $

lu_zero@nyx ~ $ clang -Wno-maybe-uninitialized -c e.c -o /tmp/t.o
warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean
  '-Wno-uninitialized'? [-Wunknown-warning-option]
1 warning generated.

I'd go with this patch.

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


Re: [libav-devel] [PATCH 3/3] avfilter: use the new const attribute for avfilter_get_by_name

2013-10-28 Thread Vittorio Giovara
On Mon, Oct 28, 2013 at 8:01 AM, Anton Khirnov  wrote:
>
> On Mon, 28 Oct 2013 02:58:14 +0100, Vittorio Giovara 
>  wrote:
>> ---
>>  libavfilter/avfilter.c  | 4 
>>  libavfilter/avfiltergraph.c | 6 ++
>>  libavfilter/graphparser.c   | 3 +++
>>  3 files changed, 13 insertions(+)
>>
>> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
>> index b18c0cb..c2691e5 100644
>> --- a/libavfilter/avfilter.c
>> +++ b/libavfilter/avfilter.c
>> @@ -284,7 +284,11 @@ AVFilter *avfilter_get_by_name(const char *name)
>>
>>  while ((f = avfilter_next(f)))
>>  if (!strcmp(f->name, name))
>> +#if !FF_API_NOCONST_GET_NAME
>>  return f;
>> +#else
>> +return (AVFilter *)f;
>> +#endif
>
> This probably won't solve anything, at least gcc still warns when you strip
> const like this.

So gotta wait for version bump i guess.

>
>>
>>  return NULL;
>>  }
>> diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
>> index 0fc385c..6414816 100644
>> --- a/libavfilter/avfiltergraph.c
>> +++ b/libavfilter/avfiltergraph.c
>> @@ -316,6 +316,9 @@ static int query_formats(AVFilterGraph *graph, AVClass 
>> *log_ctx)
>>
>>  if (convert_needed) {
>>  AVFilterContext *convert;
>> +#if !FF_API_NOCONST_GET_NAME
>> +const
>> +#endif
>>  AVFilter *filter;
>>  AVFilterLink *inlink, *outlink;
>>  char scale_args[256];
>> @@ -782,6 +785,9 @@ static int graph_insert_fifos(AVFilterGraph *graph, 
>> AVClass *log_ctx)
>>  for (j = 0; j < f->nb_inputs; j++) {
>>  AVFilterLink *link = f->inputs[j];
>>  AVFilterContext *fifo_ctx;
>> +#if !FF_API_NOCONST_GET_NAME
>> +const
>> +#endif
>>  AVFilter *fifo;
>>  char name[32];
>>
>> diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c
>> index 00764b6..88cc254 100644
>> --- a/libavfilter/graphparser.c
>> +++ b/libavfilter/graphparser.c
>> @@ -94,6 +94,9 @@ static char *parse_link_name(const char **buf, void 
>> *log_ctx)
>>  static int create_filter(AVFilterContext **filt_ctx, AVFilterGraph *ctx, 
>> int index,
>>   const char *filt_name, const char *args, void 
>> *log_ctx)
>>  {
>> +#if !FF_API_NOCONST_GET_NAME
>> +const
>> +#endif
>
> All those #ifs should be unnecessary. You can assign a non-const variable to a
> const one (after all it's just saying you won't modify it, even though you are
> allowed to), just not the other way around.

Well with clang it does reduce the number of warnings, but yeah, this
clutters the code quite a bit, so I'm fine with dropping it.

Vittorio

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


[libav-devel] [PATCH] avformat: AviSynth demuxer rewrite

2013-10-28 Thread Stephen Hutchinson
From: d s 

Directly loads AviSynth through LoadLibrary instead of relying on
Video for Windows, and supports using AvxSynth (via dlopen) to
open scripts on Linux and OS X.

Error messages from AviSynth/AvxSynth are now reported through
av_log and exit, rather than the traditional behavior of generating
an error video that the user would need to watch to diagnose.

The main rewrite was authored by d s 
from the AvxSynth team, with additional contributions by

Oka Motofumi 
Stephen Hutchinson 
---
 configure  |   4 +-
 libavformat/avisynth.c | 791 ++---
 2 files changed, 628 insertions(+), 167 deletions(-)

diff --git a/configure b/configure
index 9c2e7fc..597266d 100755
--- a/configure
+++ b/configure
@@ -3778,7 +3778,9 @@ for func in $MATH_FUNCS; do
 done
 
 # these are off by default, so fail if requested and not available
-enabled avisynth  && require2 vfw32 "windows.h vfw.h" AVIFileInit 
-lavifil32
+enabled avisynth  && { { check_header "avisynth/avisynth_c.h" && 
check_lib2 "windows.h" LoadLibrary; } ||
+   { check_header "avxsynth/avxsynth_c.h" && 
check_lib2 "dlfcn.h" dlopen -ldl; } ||
+   die "ERROR: LoadLibrary/dlopen not found for 
avisynth"; }
 enabled frei0r&& { check_header frei0r.h || die "ERROR: frei0r.h 
header not found"; }
 enabled gnutls&& require_pkg_config gnutls gnutls/gnutls.h 
gnutls_global_init
 enabled libfaac   && require2 libfaac "stdint.h faac.h" 
faacEncGetVersion -lfaac
diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index e411d35..06357e0 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -1,6 +1,6 @@
 /*
- * AviSynth support
- * Copyright (c) 2006 DivX, Inc.
+ * Avi/AvxSynth support
+ * Copyright (c) 2012 AvxSynth Team.
  *
  * This file is part of Libav.
  *
@@ -19,211 +19,670 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include 
-#include 
-
 #include "libavutil/internal.h"
+#include "libavcodec/internal.h"
 #include "avformat.h"
 #include "internal.h"
-#include "riff.h"
-
-typedef struct {
-PAVISTREAM handle;
-AVISTREAMINFO info;
-DWORD read;
-LONG chunck_size;
-LONG chunck_samples;
-} AviSynthStream;
-
-typedef struct {
-PAVIFILE file;
-AviSynthStream *streams;
-int nb_streams;
-int next_stream;
+
+/* Enable function pointer definitions for runtime loading. */
+#define AVSC_NO_DECLSPEC
+
+/* Platform-specific directives for AviSynth vs AvxSynth. */
+#ifdef _WIN32
+  #include 
+  #undef EXTERN_C
+  #include 
+  #define AVISYNTH_LIB "avisynth"
+  #define USING_AVISYNTH
+#else
+  #include 
+  #include 
+#if defined (__APPLE__)
+  #define AVISYNTH_LIB "libavxsynth.dylib"
+#else
+  #define AVISYNTH_LIB "libavxsynth.so"
+#endif
+
+  #define LoadLibrary(x) dlopen(x, RTLD_NOW | RTLD_GLOBAL)
+  #define GetProcAddress dlsym
+  #define FreeLibrary dlclose
+#endif
+
+typedef struct AviSynthLibrary {
+void *library;
+#define AVSC_DECLARE_FUNC(name) name ## _func name
+AVSC_DECLARE_FUNC(avs_bit_blt);
+AVSC_DECLARE_FUNC(avs_clip_get_error);
+AVSC_DECLARE_FUNC(avs_create_script_environment);
+AVSC_DECLARE_FUNC(avs_delete_script_environment);
+AVSC_DECLARE_FUNC(avs_get_audio);
+AVSC_DECLARE_FUNC(avs_get_error);
+AVSC_DECLARE_FUNC(avs_get_frame);
+AVSC_DECLARE_FUNC(avs_get_version);
+AVSC_DECLARE_FUNC(avs_get_video_info);
+AVSC_DECLARE_FUNC(avs_invoke);
+AVSC_DECLARE_FUNC(avs_release_clip);
+AVSC_DECLARE_FUNC(avs_release_value);
+AVSC_DECLARE_FUNC(avs_release_video_frame);
+AVSC_DECLARE_FUNC(avs_take_clip);
+#undef AVSC_DECLARE_FUNC
+} AviSynthLibrary;
+
+typedef struct AviSynthContext {
+AVS_ScriptEnvironment *env;
+AVS_Clip *clip;
+const AVS_VideoInfo *vi;
+
+/* avisynth_read_packet_video() iterates over this. */
+int n_planes;
+const int *planes;
+
+int curr_stream;
+int curr_frame;
+int64_t curr_sample;
+
+int error;
+
+/* Linked list pointers. */
+struct AviSynthContext *next;
 } AviSynthContext;
 
-static int avisynth_read_header(AVFormatContext *s)
+static const int avs_planes_packed[1] = { 0 };
+static const int avs_planes_grey[1]   = { AVS_PLANAR_Y };
+static const int avs_planes_yuv[3]= { AVS_PLANAR_Y, AVS_PLANAR_U,
+  AVS_PLANAR_V };
+
+/* A conflict between C++ global objects, atexit, and dynamic loading requires
+ * us to register our own atexit handler to prevent double freeing. */
+static AviSynthLibrary *avs_library = NULL;
+static int avs_atexit_called= 0;
+
+/* Linked list of AviSynthContexts. An atexit handler destroys this list. */
+static AviSynthContext *avs_ctx_list = NULL;
+
+static av_cold void avisynth_atexit_handler(void);
+
+static av_cold int avisynth_load_library(void)
+{
+avs_library = av_mallocz(sizeof(AviS

Re: [libav-devel] [PATCH] avformat: AviSynth demuxer rewrite

2013-10-28 Thread Stephen Hutchinson
On Mon, Oct 28, 2013 at 6:16 AM, Diego Biurrun  wrote:
> On Thu, Sep 12, 2013 at 04:09:52PM -0400, Stephen Hutchinson wrote:
>> I've shot off an email to them.
>
> Tried again?

I pinged them on Github this morning, since there was a commit pushed
to AvxSynth in the last few days.  Maybe the mail got lost, but on
Github it should show up in the notifications.  Still don't know if
I'll get any response back.

>> > > --- a/libavformat/avisynth.c
>> > > +++ b/libavformat/avisynth.c
>> > > @@ -19,211 +19,672 @@
>> > > +
>> > > +// AvxSynth doesn't have these colorspaces, so disable them
>> > > +#ifndef _WIN32
>> > > +#define avs_is_yv24(vi) 0
>> > > +#define avs_is_yv16(vi) 0
>> > > +#define avs_is_yv411(vi) 0
>> > > +#define avs_is_y8(vi) 0
>> > > +#endif
>> >
>> > The comment contradicts the ifdef condition.  How is the support of
>> > colorspaces related to the operating system?
>>
>> The support of those four colorspaces is conditional on whether AviSynth or
>> AvxSynth is being used, and the divide between the two is where the OS
>> comes in.  If Windows is not defined (and therefore AvxSynth is being
>> used), those get forcibly disabled.
>
> You are making an indirect argument here, which shows how brittle the
> assumption is.  The condition should check which of the two libs is
> used, or - better yet - check if the colorspaces are actually supported.

The next version of the patch gets rid of that block entirely.  It's
an artifact from x264's AvxSynth support patch, and so there's now a
USING_AVISYNTH macro that gets set only when AviSynth is used.  All
but the first of the _WIN32 ifdefs are now USING_AVISYNTH instead,
since the two are synonymous, and the bits-per-pixel if/else that the
block was originally there for (to stop implicit declaration errors
when using AvxSynth) is now activated only when AviSynth is used.

>> > > +static int avisynth_read_packet(AVFormatContext *s, AVPacket *pkt)
>> > > +{
>> > > +AviSynthContext *avs = s->priv_data;
>> > > +AVStream *st;
>> > > +int discard = 0;
>> > > +int ret;
>> > > +
>> > > +if (avs->error)
>> > > +return AVERROR_UNKNOWN;
>> > > +
>> > > +pkt->destruct = av_destruct_packet;
>> > > +
>> > > +// If either stream reaches EOF, try to read the other one before
>> > giving up.
>> > > +avisynth_next_stream(s, &st, pkt, &discard);
>> > > +if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
>> > > +ret = avisynth_read_packet_video(s, pkt, discard);
>> > > +if (ret == AVERROR_EOF && avs_has_audio(avs->vi)) {
>> > > +avisynth_next_stream(s, &st, pkt, &discard);
>> > > +return avisynth_read_packet_audio(s, pkt, discard);
>> > > +}
>> > > +return ret; // so that video-only scripts don't hang at end of
>> > read
>> > > +} else {
>> > > +ret = avisynth_read_packet_audio(s, pkt, discard);
>> > > +if (ret == AVERROR_EOF && avs_has_video(avs->vi)) {
>> > > +avisynth_next_stream(s, &st, pkt, &discard);
>> > > +return avisynth_read_packet_video(s, pkt, discard);
>> > > +}
>> > > +return ret; // so that audio-only scripts don't hang at end of
>> > read
>> > > +}
>> > > +}
>> >
>> > You can factor out the return.
>>
>> As mentioned above and noted in the comments, removing the return ret;
>> lines and replacing them with a single return 0; at the end of the function
>> cause video-only and audio-only scripts to not exit at the end of being
>> read, forcing the user to have to Ctrl+C.
>
> I never said you should remove the return.  I said you should factor it out.
> Just move it after the if-else block instead of having the same line inside
> of both branches.

The issue I stumbled across was that I'd used return 0, since I
wrongly assumed it wouldn't see the value of ret outside of the
if/else block.  That's what underlaid the hang.  Fixed.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] fate: add ffv1.0 test

2013-10-28 Thread Luca Barbato
On 28/10/13 18:38, Luca Barbato wrote:
>> - "make lcov": for generating HTML output
>> - "make lcov-reset": for resetting coverage measurements
>>
>> Do these also work in Libav?
> 

Forgot to say, yes they work =)

lu


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


Re: [libav-devel] [PATCH] configure: Provide an hardened toolchain option

2013-10-28 Thread Diego Biurrun
On Mon, Oct 28, 2013 at 01:23:29PM +0100, Luca Barbato wrote:
> ---
>  configure | 4 
>  1 file changed, 4 insertions(+)

s/an/a/

Diego

> --- a/configure
> +++ b/configure
> @@ -2288,6 +2288,10 @@ case "$toolchain" in
>  add_cflags  -fprofile-arcs -ftest-coverage
>  add_ldflags -fprofile-arcs -ftest-coverage
>  ;;
> +hardened)
> +add_cflags -D_FORTIFY_SOURCE=2 -fno-strict-overflow 
> -fstack-protector-all
> +add_ldflags -Wl,-z,relro -Wl,-z,now

Vertically align the arguments.

OK otherwise.

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


Re: [libav-devel] [PATCH] fate: add ffv1.0 test

2013-10-28 Thread Luca Barbato
On 28/10/13 15:18, Peter B. wrote:
> Quoting Luca Barbato :
> 
>> On 27/10/13 10:14, Peter B. wrote:
>>> 1) How do I add the reference files, required for tests to be able to
>>> diff?
>>
>> You can upload to our local ftp[1] and drop me a note.
> 
> I'd like to keep the set of testvideos as small as possible, but I'm
> trying to improve the LCOV coverage of the FFV1 tests as high as possible.
> 
> I've seen that the current FFV1 tests were in "vcodec.mak", and if I
> understood it correctly, only encoding of 2 videos was tested. No
> decoding. Therefore, I've added additional FFV1 tests to
> "lossless-video.mak", and transcoded the files used for Lagarith
> FATE-tests to a new folder in "fate-suite/ffv1".
> 
> Next to the Lagarith testvideos, I've used 4 frames of a test-signal
> generated by us, because the Lagarith videos were mainly still images,
> and I wanted to have at least a few frames with a visual change in them.
> So far my files used for FFV1 testing are around 8,5 MiB in total. I
> have several files for different pix_fmts to test decoding as thoroughly
> as necessary.
> 
> 
> All the videos used for these tests could actually be generated, but I
> don't know how to add commands for generating the videos in FATE
> automatically so they are available for the actual tests. Could anyone
> point me at examples for doing so?
> 
> If there are any objections or suggestions regarding this approach, I'm
> happy to hear about them, so I can learn.
> 
> 
>>> 2) How do I get a LCOV HTML report locally?
>>
>> https://wiki.libav.org/GcovCoverageHowTo
> 
> Worked (almost) perfectly. Thank you very much!
> I had to add "-b ." to the command shown in your Wiki, in order for lcov
> to find the source. So my call looks as follows:

Thanks I fixed it.

> [quote]
> $ lcov -b . --directory . --capture --output-file coverage.info
> [/quote]
> 
> I've already used it with my new FFV1 set, and the line-coverage for
> ffv1dec.c already increased.
> 
> I've seen in FFmpeg's docs about "lcov" [1], that they've included
> Makefile-rules, such as:
> 
> - "make lcov": for generating HTML output
> - "make lcov-reset": for resetting coverage measurements
> 
> Do these also work in Libav?

Currently I'm still pondering which between lcov and gcovr is the best
(gcovr is easier as the text output goes, lcov html features are much
better)

lu





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


[libav-devel] [PATCH 4/4] mpeg4video_parser: K&R formatting cosmetics

2013-10-28 Thread Vittorio Giovara
---
 libavcodec/mpeg4video_parser.c |   68 
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
index e291262..f0f26f1 100644
--- a/libavcodec/mpeg4video_parser.c
+++ b/libavcodec/mpeg4video_parser.c
@@ -31,40 +31,41 @@ struct Mp4vParseContext {
 int first_picture;
 };
 
-int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int 
buf_size){
+int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
+{
 int vop_found, i;
 uint32_t state;
 
-vop_found= pc->frame_start_found;
-state= pc->state;
+vop_found = pc->frame_start_found;
+state = pc->state;
 
-i=0;
-if(!vop_found){
-for(i=0; iframe_start_found=0;
-pc->state=-1;
-return i-3;
+for (; i < buf_size; i++) {
+state = (state << 8) | buf[i];
+if ((state & 0xFF00) == 0x100) {
+pc->frame_start_found = 0;
+pc->state = -1;
+return i - 3;
 }
 }
 }
-pc->frame_start_found= vop_found;
-pc->state= state;
+pc->frame_start_found = vop_found;
+pc->state = state;
 return END_NOT_FOUND;
 }
 
@@ -74,15 +75,15 @@ static int av_mpeg4_decode_header(AVCodecParserContext *s1,
   const uint8_t *buf, int buf_size)
 {
 struct Mp4vParseContext *pc = s1->priv_data;
-MpegEncContext *s = &pc->enc;
+MpegEncContext *s   = &pc->enc;
 GetBitContext gb1, *gb = &gb1;
 int ret;
 
-s->avctx = avctx;
+s->avctx   = avctx;
 s->current_picture_ptr = &s->current_picture;
 
-if (avctx->extradata_size && pc->first_picture){
-init_get_bits(gb, avctx->extradata, avctx->extradata_size*8);
+if (avctx->extradata_size && pc->first_picture) {
+init_get_bits(gb, avctx->extradata, avctx->extradata_size * 8);
 ret = ff_mpeg4_decode_picture_header(s, gb);
 }
 
@@ -91,7 +92,7 @@ static int av_mpeg4_decode_header(AVCodecParserContext *s1,
 if (s->width && (!avctx->width || !avctx->height || !avctx->coded_width || 
!avctx->coded_height)) {
 avcodec_set_dimensions(avctx, s->width, s->height);
 }
-s1->pict_type= s->pict_type;
+s1->pict_type = s->pict_type;
 pc->first_picture = 0;
 return ret;
 }
@@ -100,38 +101,37 @@ static av_cold int 
mpeg4video_parse_init(AVCodecParserContext *s)
 {
 struct Mp4vParseContext *pc = s->priv_data;
 
-pc->first_picture = 1;
+pc->first_picture   = 1;
 pc->enc.slice_context_count = 1;
 return 0;
 }
 
 static int mpeg4video_parse(AVCodecParserContext *s,
-   AVCodecContext *avctx,
-   const uint8_t **poutbuf, int *poutbuf_size,
-   const uint8_t *buf, int buf_size)
+AVCodecContext *avctx,
+const uint8_t **poutbuf, int *poutbuf_size,
+const uint8_t *buf, int buf_size)
 {
 ParseContext *pc = s->priv_data;
 int next;
 
-if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){
-next= buf_size;
-}else{
-next= ff_mpeg4_find_frame_end(pc, buf, buf_size);
+if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
+next = buf_size;
+} else {
+next = ff_mpeg4_find_frame_end(pc, buf, buf_size);
 
 if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
-*poutbuf = NULL;
+*poutbuf  = NULL;
 *poutbuf_size = 0;
 return buf_size;
 }
 }
 av_mpeg4_decode_header(s, avctx, buf, buf_size);
 
-*poutbuf = buf;
+*poutbuf  = buf;
 *poutbuf_size = buf_size;
 return next;
 }
 
-
 AVCodecParser ff_mpeg4video_parser = {
 .codec_ids  = { AV_CODEC_ID_MPEG4 },
 .priv_data_size = sizeof(struct Mp4vParseContext),
-- 
1.7.9.5

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


[libav-devel] [PATCH 1/4] mpeg4video: K&R formatting cosmetics

2013-10-28 Thread Vittorio Giovara
---
 libavcodec/mpeg4video.c |  153 ---
 libavcodec/mpeg4video.h |   73 +++---
 2 files changed, 115 insertions(+), 111 deletions(-)

diff --git a/libavcodec/mpeg4video.c b/libavcodec/mpeg4video.c
index 628ca67..28a147b 100644
--- a/libavcodec/mpeg4video.c
+++ b/libavcodec/mpeg4video.c
@@ -24,19 +24,20 @@
 #include "mpeg4video.h"
 #include "mpeg4data.h"
 
-uint8_t ff_mpeg4_static_rl_table_store[3][2][2*MAX_RUN + MAX_LEVEL + 3];
-
-int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s){
-switch(s->pict_type){
-case AV_PICTURE_TYPE_I:
-return 16;
-case AV_PICTURE_TYPE_P:
-case AV_PICTURE_TYPE_S:
-return s->f_code+15;
-case AV_PICTURE_TYPE_B:
-return FFMAX3(s->f_code, s->b_code, 2) + 15;
-default:
-return -1;
+uint8_t ff_mpeg4_static_rl_table_store[3][2][2 * MAX_RUN + MAX_LEVEL + 3];
+
+int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s)
+{
+switch (s->pict_type) {
+case AV_PICTURE_TYPE_I:
+return 16;
+case AV_PICTURE_TYPE_P:
+case AV_PICTURE_TYPE_S:
+return s->f_code + 15;
+case AV_PICTURE_TYPE_B:
+return FFMAX3(s->f_code, s->b_code, 2) + 15;
+default:
+return -1;
 }
 }
 
@@ -44,70 +45,72 @@ void ff_mpeg4_clean_buffers(MpegEncContext *s)
 {
 int c_wrap, c_xy, l_wrap, l_xy;
 
-l_wrap= s->b8_stride;
-l_xy= (2*s->mb_y-1)*l_wrap + s->mb_x*2 - 1;
-c_wrap= s->mb_stride;
-c_xy= (s->mb_y-1)*c_wrap + s->mb_x - 1;
+l_wrap = s->b8_stride;
+l_xy   = (2 * s->mb_y - 1) * l_wrap + s->mb_x * 2 - 1;
+c_wrap = s->mb_stride;
+c_xy   = (s->mb_y - 1) * c_wrap + s->mb_x - 1;
 
 #if 0
 /* clean DC */
-memsetw(s->dc_val[0] + l_xy, 1024, l_wrap*2+1);
-memsetw(s->dc_val[1] + c_xy, 1024, c_wrap+1);
-memsetw(s->dc_val[2] + c_xy, 1024, c_wrap+1);
+memsetw(s->dc_val[0] + l_xy, 1024, l_wrap * 2 + 1);
+memsetw(s->dc_val[1] + c_xy, 1024, c_wrap + 1);
+memsetw(s->dc_val[2] + c_xy, 1024, c_wrap + 1);
 #endif
 
 /* clean AC */
-memset(s->ac_val[0] + l_xy, 0, (l_wrap*2+1)*16*sizeof(int16_t));
-memset(s->ac_val[1] + c_xy, 0, (c_wrap  +1)*16*sizeof(int16_t));
-memset(s->ac_val[2] + c_xy, 0, (c_wrap  +1)*16*sizeof(int16_t));
+memset(s->ac_val[0] + l_xy, 0, (l_wrap * 2 + 1) * 16 * sizeof(int16_t));
+memset(s->ac_val[1] + c_xy, 0, (c_wrap + 1) * 16 * sizeof(int16_t));
+memset(s->ac_val[2] + c_xy, 0, (c_wrap + 1) * 16 * sizeof(int16_t));
 
 /* clean MV */
 // we can't clear the MVs as they might be needed by a b frame
 //memset(s->motion_val + l_xy, 0, (l_wrap*2+1)*2*sizeof(int16_t));
 //memset(s->motion_val, 0, 2*sizeof(int16_t)*(2 + s->mb_width*2)*(2 + 
s->mb_height*2));
-s->last_mv[0][0][0]=
-s->last_mv[0][0][1]=
-s->last_mv[1][0][0]=
-s->last_mv[1][0][1]= 0;
+s->last_mv[0][0][0] =
+s->last_mv[0][0][1] =
+s->last_mv[1][0][0] =
+s->last_mv[1][0][1] = 0;
 }
 
 #define tab_size ((signed)FF_ARRAY_ELEMS(s->direct_scale_mv[0]))
-#define tab_bias (tab_size/2)
+#define tab_bias (tab_size / 2)
 
 //used by mpeg4 and rv10 decoder
-void ff_mpeg4_init_direct_mv(MpegEncContext *s){
+void ff_mpeg4_init_direct_mv(MpegEncContext *s)
+{
 int i;
-for(i=0; idirect_scale_mv[0][i] = (i-tab_bias)*s->pb_time/s->pp_time;
-s->direct_scale_mv[1][i] = 
(i-tab_bias)*(s->pb_time-s->pp_time)/s->pp_time;
+for (i = 0; i < tab_size; i++) {
+s->direct_scale_mv[0][i] = (i - tab_bias) * s->pb_time / s->pp_time;
+s->direct_scale_mv[1][i] = (i - tab_bias) * (s->pb_time - s->pp_time) 
/ s->pp_time;
 }
 }
 
-static inline void ff_mpeg4_set_one_direct_mv(MpegEncContext *s, int mx, int 
my, int i){
-int xy= s->block_index[i];
-uint16_t time_pp= s->pp_time;
-uint16_t time_pb= s->pb_time;
+static inline void ff_mpeg4_set_one_direct_mv(MpegEncContext *s, int mx, int 
my, int i)
+{
+int xy   = s->block_index[i];
+uint16_t time_pp = s->pp_time;
+uint16_t time_pb = s->pb_time;
 int p_mx, p_my;
 
 p_mx = s->next_picture.motion_val[0][xy][0];
-if((unsigned)(p_mx + tab_bias) < tab_size){
+if ((unsigned)(p_mx + tab_bias) < tab_size) {
 s->mv[0][i][0] = s->direct_scale_mv[0][p_mx + tab_bias] + mx;
-s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx
-: s->direct_scale_mv[1][p_mx + tab_bias];
-}else{
-s->mv[0][i][0] = p_mx*time_pb/time_pp + mx;
-s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx
-: p_mx*(time_pb - time_pp)/time_pp;
+s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx :
+  s->direct_scale_mv[1][p_mx + tab_bias];
+} else {
+s->mv[0][i][0] = p_mx * time_pb / time_pp + mx;
+s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx :
+  p_mx * (time_pb - time_pp) / time_pp;
 }
 p_my = s->next_p

Re: [libav-devel] [PATCH] mpeg4: K&R formatting cosmetics

2013-10-28 Thread Vittorio Giovara
Hi

On Mon, Oct 28, 2013 at 4:45 PM, Clément Bœsch  wrote:
[...]

You are right when you say there shouldn't be functional and cosmetics
changes in the same patch.
Thank you for spotting some artefacts, I'll revisit this set more appropriately.

Vittorio

> --
> Clément B.
>
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] h264: wait for initial complete frame before outputing frames

2013-10-28 Thread John Stebbins
On 10/17/2013 01:10 PM, John Stebbins wrote:
> Are there any more comments regarding this patch?  Is everyone ok with how I 
> implemented the AVFrame flags in
> AVFrameSideData?
>

Seems there are no more comments.  If this patch is now acceptable, could 
someone push it please?

-- 
John  GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7




signature.asc
Description: OpenPGP digital signature
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] h264: eliminate two triggerable asserts

2013-10-28 Thread Luca Barbato
On 28/10/13 17:06, Anton Khirnov wrote:
> None of them should be triggerable. If either of them is, it's a bug and needs
> to be fixed.

Take any incomplete h264 file (e.g download sintel from a torrent) and
seek over it. Missing a reference post-seek doesn't sound an impossible
condition to me.

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


[libav-devel] [PATCH] avconv: stop accessing AVStream.parser

2013-10-28 Thread Anton Khirnov
It is private and must not be touched from outside of lavf.
---
Now without forgetting to free the parser
---
 avconv.c |9 -
 avconv.h |2 ++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/avconv.c b/avconv.c
index 0c0f3bf..be47da0 100644
--- a/avconv.c
+++ b/avconv.c
@@ -182,6 +182,8 @@ static void avconv_cleanup(int ret)
 output_streams[i]->bitstream_filters = NULL;
 avcodec_free_frame(&output_streams[i]->filtered_frame);
 
+av_parser_close(output_streams[i]->parser);
+
 av_freep(&output_streams[i]->forced_keyframes);
 av_freep(&output_streams[i]->avfilter);
 av_freep(&output_streams[i]->logfile_prefix);
@@ -1013,7 +1015,10 @@ static void do_streamcopy(InputStream *ist, OutputStream 
*ost, const AVPacket *p
&& ost->st->codec->codec_id != AV_CODEC_ID_MPEG2VIDEO
&& ost->st->codec->codec_id != AV_CODEC_ID_VC1
) {
-if (av_parser_change(ist->st->parser, ost->st->codec, &opkt.data, 
&opkt.size, pkt->data, pkt->size, pkt->flags & AV_PKT_FLAG_KEY)) {
+if (av_parser_change(ost->parser, ost->st->codec,
+ &opkt.data, &opkt.size,
+ pkt->data, pkt->size,
+ pkt->flags & AV_PKT_FLAG_KEY)) {
 opkt.buf = av_buffer_create(opkt.data, opkt.size, 
av_buffer_default_free, NULL, 0);
 if (!opkt.buf)
 exit_program(1);
@@ -1546,6 +1551,8 @@ static int transcode_init(void)
 } else
 codec->time_base = ist->st->time_base;
 
+ost->parser = av_parser_init(codec->codec_id);
+
 switch (codec->codec_type) {
 case AVMEDIA_TYPE_AUDIO:
 if (audio_volume != 256) {
diff --git a/avconv.h b/avconv.h
index eb7e37f..cb3005d 100644
--- a/avconv.h
+++ b/avconv.h
@@ -305,6 +305,8 @@ typedef struct OutputStream {
 int copy_initial_nonkeyframes;
 
 enum AVPixelFormat pix_fmts[2];
+
+AVCodecParserContext *parser;
 } OutputStream;
 
 typedef struct OutputFile {
-- 
1.7.10.4

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


Re: [libav-devel] [PATCH] h264: eliminate two triggerable asserts

2013-10-28 Thread Anton Khirnov

On Mon, 28 Oct 2013 16:05:01 +0100, Luca Barbato  wrote:
> On 28/10/13 15:29, Anton Khirnov wrote:
> > 
> > On Mon, 28 Oct 2013 11:30:57 +0100, Luca Barbato  wrote:
> >> ---
> >>  libavcodec/h264.c | 6 --
> >>  1 file changed, 4 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> >> index 68f51a9..944fbc7 100644
> >> --- a/libavcodec/h264.c
> >> +++ b/libavcodec/h264.c
> >> @@ -289,8 +289,10 @@ static int ref_picture(H264Context *h, Picture *dst, 
> >> Picture *src)
> >>  {
> >>  int ret, i;
> >>  
> >> -av_assert0(!dst->f.buf[0]);
> >> -av_assert0(src->f.buf[0]);
> >> +if (dst->f.buf[0])
> >> +return AVERROR_BUG;
> >> +if (!src->f.buf[0])
> >> +goto fail;
> > 
> > Why are you treating them in different ways?
> 
> One is triggerable normally, so it is not something that should ever
> trigger an assert, the other warrants an AVERROR_BUG or move it to a
> normal assert.
> 

None of them should be triggerable. If either of them is, it's a bug and needs
to be fixed.

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


Re: [libav-devel] [PATCH] mpeg4: K&R formatting cosmetics

2013-10-28 Thread Clément Bœsch
On Mon, Oct 28, 2013 at 04:39:44PM +0100, Luca Barbato wrote:
> On 28/10/13 16:27, Clément Bœsch wrote:
> > On Mon, Oct 28, 2013 at 03:37:58PM +0100, Vittorio Giovara wrote:
> >> From: Luca Barbato 
> >>
> >> ---
> >> I did some more cleanup.
> >> Vittorio
> >>
> >>  libavcodec/mpeg4video.c|  153 +--
> >>  libavcodec/mpeg4videodec.c | 2801 
> >> +---
> >>  2 files changed, 1661 insertions(+), 1293 deletions(-)
> >>
> > [...]
> >> -mot_val[0   ]= mot_val[2   ]=
> >> -mot_val[0+stride]= mot_val[2+stride]= mx;
> >> -mot_val[1   ]= mot_val[3   ]=
> >> -mot_val[1+stride]= mot_val[3+stride]= my;
> >>  
> >> -if(s->mbintra_table[xy])
> >> +mot_val[0]  =
> >> +mot_val[0 + stride] =
> >> +mot_val[2]  =
> >> +mot_val[2 + stride] = mx;
> >> +
> >> +mot_val[1]  =
> >> +mot_val[1 + stride] =
> >> +mot_val[3]  =
> >> +mot_val[3 + stride] = my;
> >> +
> > 
> > Why do you make the code potentially less efficient in a "cosmetic"
> > commit?
> 
> Your assumptions regarding compilers and architectures are outstanding.
> 

[~]☭ cat a.c
int f1(int *t, int stride, int v) {
t[0 ] = t[2 ] =
t[0 + stride] = t[2 + stride] = v;
}

int f2(int *t, int stride, int v) {
t[0] = t[0 + stride] =
t[2] = t[2 + stride] = v;
}
[~]☭ gcc -O2 -c a.c
[~]☭ objdump -d -Mintel a.o

a.o: file format elf64-x86-64


Disassembly of section .text:

 :
   0:   48 63 f6movsxd rsi,esi
   3:   89 54 b7 08 movDWORD PTR [rdi+rsi*4+0x8],edx
   7:   89 14 b7movDWORD PTR [rdi+rsi*4],edx
   a:   89 57 08movDWORD PTR [rdi+0x8],edx
   d:   89 17   movDWORD PTR [rdi],edx
   f:   c3  ret

0010 :
  10:   48 63 f6movsxd rsi,esi
  13:   89 54 b7 08 movDWORD PTR [rdi+rsi*4+0x8],edx
  17:   89 57 08movDWORD PTR [rdi+0x8],edx
  1a:   89 14 b7movDWORD PTR [rdi+rsi*4],edx
  1d:   89 17   movDWORD PTR [rdi],edx
  1f:   c3  ret

What about yours?

This code potentially has performance matters.

> > BTW, it's always fun to look for hidden functional changes in 2.8k+ diff
> > cosmetics patches. Are you using those cosmetics commits to get functional
> > changes upstream without review?
> 
> The original patch states that is a refactor.

It doesn't say where the "refactor" is in 2.7k lines of diff. (are you calling
the progress variable a refactoring?)

How are you expecting the other developers to find that "refactoring"?
Hint: git show -w doesn't help because of your line breaks.

> 
> 
> Thanks for spotting one of the uncrustify artifacts remaining.
> 

Here is another one:

> -v= ff_mpeg4_default_non_intra_matrix[i];
> +v =
> +ff_mpeg4_default_non_intra_matrix[i];

-- 
Clément B.


pgp2DUvheWRdU.pgp
Description: PGP signature
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] mpeg4: K&R formatting cosmetics

2013-10-28 Thread Luca Barbato
On 28/10/13 15:37, Vittorio Giovara wrote:
> From: Luca Barbato 
> 
> ---
> I did some more cleanup.

The subject doesn't match what the patch does.

lu

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


Re: [libav-devel] [PATCH] mpeg4: K&R formatting cosmetics

2013-10-28 Thread Luca Barbato
On 28/10/13 16:27, Clément Bœsch wrote:
> On Mon, Oct 28, 2013 at 03:37:58PM +0100, Vittorio Giovara wrote:
>> From: Luca Barbato 
>>
>> ---
>> I did some more cleanup.
>> Vittorio
>>
>>  libavcodec/mpeg4video.c|  153 +--
>>  libavcodec/mpeg4videodec.c | 2801 
>> +---
>>  2 files changed, 1661 insertions(+), 1293 deletions(-)
>>
> [...]
>> -mot_val[0   ]= mot_val[2   ]=
>> -mot_val[0+stride]= mot_val[2+stride]= mx;
>> -mot_val[1   ]= mot_val[3   ]=
>> -mot_val[1+stride]= mot_val[3+stride]= my;
>>  
>> -if(s->mbintra_table[xy])
>> +mot_val[0]  =
>> +mot_val[0 + stride] =
>> +mot_val[2]  =
>> +mot_val[2 + stride] = mx;
>> +
>> +mot_val[1]  =
>> +mot_val[1 + stride] =
>> +mot_val[3]  =
>> +mot_val[3 + stride] = my;
>> +
> 
> Why do you make the code potentially less efficient in a "cosmetic"
> commit?

Your assumptions regarding compilers and architectures are outstanding.

> BTW, it's always fun to look for hidden functional changes in 2.8k+ diff
> cosmetics patches. Are you using those cosmetics commits to get functional
> changes upstream without review?

The original patch states that is a refactor.


Thanks for spotting one of the uncrustify artifacts remaining.

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

Re: [libav-devel] [PATCH] mpeg4: K&R formatting cosmetics

2013-10-28 Thread Clément Bœsch
On Mon, Oct 28, 2013 at 03:37:58PM +0100, Vittorio Giovara wrote:
> From: Luca Barbato 
> 
> ---
> I did some more cleanup.
> Vittorio
> 
>  libavcodec/mpeg4video.c|  153 +--
>  libavcodec/mpeg4videodec.c | 2801 
> +---
>  2 files changed, 1661 insertions(+), 1293 deletions(-)
> 
[...]
> -mot_val[0   ]= mot_val[2   ]=
> -mot_val[0+stride]= mot_val[2+stride]= mx;
> -mot_val[1   ]= mot_val[3   ]=
> -mot_val[1+stride]= mot_val[3+stride]= my;
>  
> -if(s->mbintra_table[xy])
> +mot_val[0]  =
> +mot_val[0 + stride] =
> +mot_val[2]  =
> +mot_val[2 + stride] = mx;
> +
> +mot_val[1]  =
> +mot_val[1 + stride] =
> +mot_val[3]  =
> +mot_val[3 + stride] = my;
> +

Why do you make the code potentially less efficient in a "cosmetic"
commit?

ditto below.

[...]
> -if (s->pict_type == AV_PICTURE_TYPE_P || 
> s->pict_type==AV_PICTURE_TYPE_S) {
> +if (s->pict_type == AV_PICTURE_TYPE_P || s->pict_type ==
> +AV_PICTURE_TYPE_S) {

lol

[...]
> +av_log(s->avctx, AV_LOG_ERROR,
> +   "texture corrupted at %d %d %d\n",
> +   s->mb_x,
> +   s->mb_y,
> +   s->mb_intra);

Here and dozens of times: why the nonsense breaks for every single
parameter?

[...]
> +mb_type = get_vlc2(&s->gb,
> +   mb_type_b_vlc.table,
> +   MB_TYPE_B_VLC_BITS,
> +   1);

another example.

[...]
> -/* per-MB end of slice check */
> -if(s->codec_id==AV_CODEC_ID_MPEG4){
> -if(mpeg4_is_resync(s)){
> -const int delta= s->mb_x + 1 == s->mb_width ? 2 : 1;
> -
> -if (s->pict_type == AV_PICTURE_TYPE_B && 
> s->next_picture.mbskip_table[xy + delta]) {
> -ff_thread_await_progress(&s->next_picture_ptr->tf,
> -(s->mb_x + delta >= s->mb_width) ? 
> FFMIN(s->mb_y+1, s->mb_height-1) : s->mb_y, 0);
> +/* per-MB end of slice check */
> +if (s->codec_id == AV_CODEC_ID_MPEG4) {
> +if (mpeg4_is_resync(s)) {
> +const int delta = s->mb_x + 1 == s->mb_width ? 2 : 1;
> +
> +if (s->pict_type == AV_PICTURE_TYPE_B &&
> +s->next_picture.mbskip_table[xy + delta]) {
> +int progress = (s->mb_x + delta >= s->mb_width) ?
> +   FFMIN(s->mb_y + 1, s->mb_height - 1) : 
> s->mb_y;
> +ff_thread_await_progress(&s->next_picture_ptr->tf, progress, 
> 0);

This is a joke right? So this is where the functional changes originally
mentioned in the topic were…

BTW, it's always fun to look for hidden functional changes in 2.8k+ diff
cosmetics patches. Are you using those cosmetics commits to get functional
changes upstream without review?

[...]

-- 
Clément B.


pgpYfD8g9WPKP.pgp
Description: PGP signature
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 39/50] rv34: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/rv34.c |6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 7eb97e7..8038f8f 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1667,7 +1667,11 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
  
  s->width  = si.width;

  s->height = si.height;
-avcodec_set_dimensions(s->avctx, s->width, s->height);
+
+err = ff_set_dimensions(s->avctx, s->width, s->height);
+if (err < 0)
+return err;
+
  if ((err = ff_MPV_common_frame_size_change(s)) < 0)
  return err;
  if ((err = rv34_decoder_realloc(r)) < 0)


Ok

-Justin

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


Re: [libav-devel] [PATCH 45/50] truemotion1: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/truemotion1.c |8 +---
  1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
index c1e0863..57b3d23 100644
--- a/libavcodec/truemotion1.c
+++ b/libavcodec/truemotion1.c
@@ -397,15 +397,17 @@ static int truemotion1_decode_header(TrueMotion1Context 
*s)
  new_pix_fmt = AV_PIX_FMT_RGB555; // RGB565 is supported as well
  
  s->w >>= width_shift;

-if ((ret = av_image_check_size(s->w, s->h, 0, s->avctx)) < 0)
-return ret;
  
  if (s->w != s->avctx->width || s->h != s->avctx->height ||

  new_pix_fmt != s->avctx->pix_fmt) {
  av_frame_unref(&s->frame);
  s->avctx->sample_aspect_ratio = (AVRational){ 1 << width_shift, 1 };
  s->avctx->pix_fmt = new_pix_fmt;
-avcodec_set_dimensions(s->avctx, s->w, s->h);
+
+ret = ff_set_dimensions(s->avctx, s->w, s->h);
+if (ret < 0)
+return ret;
+
  av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * 
sizeof(unsigned int));
  }
  


Ok

-Justin

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


Re: [libav-devel] [PATCH 47/50] vp3: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/vp3.c |   13 +
  1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 467dfd56..d596816 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2166,6 +2166,7 @@ static int theora_decode_header(AVCodecContext *avctx, 
GetBitContext *gb)
  Vp3DecodeContext *s = avctx->priv_data;
  int visible_width, visible_height, colorspace;
  int offset_x = 0, offset_y = 0;
+int ret;
  AVRational fps, aspect;
  
  s->theora = get_bits_long(gb, 24);

@@ -2182,12 +2183,6 @@ static int theora_decode_header(AVCodecContext *avctx, 
GetBitContext *gb)
  visible_width  = s->width  = get_bits(gb, 16) << 4;
  visible_height = s->height = get_bits(gb, 16) << 4;
  
-if(av_image_check_size(s->width, s->height, 0, avctx)){

-av_log(avctx, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n", s->width, 
s->height);
-s->width= s->height= 0;
-return -1;
-}
-
  if (s->theora >= 0x030200) {
  visible_width  = get_bits_long(gb, 24);
  visible_height = get_bits_long(gb, 24);
@@ -2234,9 +2229,11 @@ static int theora_decode_header(AVCodecContext *avctx, 
GetBitContext *gb)
  if (   visible_width  <= s->width  && visible_width  > s->width-16
  && visible_height <= s->height && visible_height > s->height-16
  && !offset_x && (offset_y == s->height - visible_height))
-avcodec_set_dimensions(avctx, visible_width, visible_height);
+ret = ff_set_dimensions(avctx, visible_width, visible_height);
  else
-avcodec_set_dimensions(avctx, s->width, s->height);
+ret = ff_set_dimensions(avctx, s->width, s->height);
+if (ret < 0)
+return ret;
  
  if (colorspace == 1) {

  avctx->color_primaries = AVCOL_PRI_BT470M;


Ok

-Justin

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


Re: [libav-devel] [PATCH 49/50] vp8: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/vp5.c |1 +
  libavcodec/vp6.c |1 +
  libavcodec/vp8.c |9 -
  3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavcodec/vp5.c b/libavcodec/vp5.c
index 5cab9b6..b609282 100644
--- a/libavcodec/vp5.c
+++ b/libavcodec/vp5.c
@@ -28,6 +28,7 @@
  
  #include "avcodec.h"

  #include "get_bits.h"
+#include "internal.h"
  
  #include "vp56.h"

  #include "vp56data.h"


Was this part supposed to be with patch 48/50?


diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
index 07560d0..d10a640 100644
--- a/libavcodec/vp6.c
+++ b/libavcodec/vp6.c
@@ -32,6 +32,7 @@
  #include "avcodec.h"
  #include "get_bits.h"
  #include "huffman.h"
+#include "internal.h"
  
  #include "vp56.h"

  #include "vp56data.h"
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 910ec20..b1b4f2d 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -114,16 +114,15 @@ static void vp8_decode_flush(AVCodecContext *avctx)
  static int update_dimensions(VP8Context *s, int width, int height)
  {
  AVCodecContext *avctx = s->avctx;
-int i;
+int i, ret;
  
  if (width  != s->avctx->width ||

  height != s->avctx->height) {
-if (av_image_check_size(width, height, 0, s->avctx))
-return AVERROR_INVALIDDATA;
-
  vp8_decode_flush_impl(s->avctx, 1);
  
-avcodec_set_dimensions(s->avctx, width, height);

+ret = ff_set_dimensions(s->avctx, width, height);
+if (ret < 0)
+return ret;
  }
  
  s->mb_width  = (s->avctx->coded_width +15) / 16;


Ok

-Justin

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


Re: [libav-devel] [PATCH 48/50] vp56: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/vp5.c  |4 +++-
  libavcodec/vp56.c |4 ++--
  libavcodec/vp6.c  |7 +--
  3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavcodec/vp5.c b/libavcodec/vp5.c
index f4d1c7f..5cab9b6 100644
--- a/libavcodec/vp5.c
+++ b/libavcodec/vp5.c
@@ -67,7 +67,9 @@ static int vp5_parse_header(VP56Context *s, const uint8_t 
*buf, int buf_size,
  if (!s->macroblocks || /* first frame */
  16*cols != s->avctx->coded_width ||
  16*rows != s->avctx->coded_height) {
-avcodec_set_dimensions(s->avctx, 16*cols, 16*rows);
+int ret = ff_set_dimensions(s->avctx, 16 * cols, 16 * rows);
+if (ret < 0)
+return ret;
  return VP56_SIZE_CHANGE;
  }
  } else if (!s->macroblocks)
diff --git a/libavcodec/vp56.c b/libavcodec/vp56.c
index 35df0e0..53a0271 100644
--- a/libavcodec/vp56.c
+++ b/libavcodec/vp56.c
@@ -470,7 +470,7 @@ static int vp56_size_changed(AVCodecContext *avctx)
  s->mb_height = (avctx->coded_height+15) / 16;
  
  if (s->mb_width > 1000 || s->mb_height > 1000) {

-avcodec_set_dimensions(avctx, 0, 0);
+ff_set_dimensions(avctx, 0, 0);
  av_log(avctx, AV_LOG_ERROR, "picture too big\n");
  return -1;
  }
@@ -528,7 +528,7 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
  for (i = 0; i < 4; i++)
  av_frame_unref(s->frames[i]);
  if (is_alpha) {
-avcodec_set_dimensions(avctx, 0, 0);
+ff_set_dimensions(avctx, 0, 0);
  return -1;
  }
  }
diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
index fddfc9d..07560d0 100644
--- a/libavcodec/vp6.c
+++ b/libavcodec/vp6.c
@@ -93,7 +93,10 @@ static int vp6_parse_header(VP56Context *s, const uint8_t 
*buf, int buf_size,
  s->avctx->coded_width  = 16 * cols;
  s->avctx->coded_height = 16 * rows;
  } else {
-avcodec_set_dimensions(s->avctx, 16 * cols, 16 * rows);
+int ret = ff_set_dimensions(s->avctx, 16 * cols, 16 * rows);
+if (ret < 0)
+return ret;
+
  if (s->avctx->extradata_size == 1) {
  s->avctx->width  -= s->avctx->extradata[0] >> 4;
  s->avctx->height -= s->avctx->extradata[0] & 0x0F;
@@ -154,7 +157,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t 
*buf, int buf_size,
  buf_size -= coeff_offset;
  if (buf_size < 0) {
  if (s->frames[VP56_FRAME_CURRENT]->key_frame)
-avcodec_set_dimensions(s->avctx, 0, 0);
+ff_set_dimensions(s->avctx, 0, 0);
  return AVERROR_INVALIDDATA;
  }
  if (s->use_huffman) {


Ok

-Justin

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


Re: [libav-devel] [PATCH 46/50] txd: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/txd.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/txd.c b/libavcodec/txd.c
index 0eca07f..3bd986e 100644
--- a/libavcodec/txd.c
+++ b/libavcodec/txd.c
@@ -63,10 +63,10 @@ static int txd_decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame,
  return AVERROR_PATCHWELCOME;
  }
  
-if ((ret = av_image_check_size(w, h, 0, avctx)) < 0)

+ret = ff_set_dimensions(avctx, w, h);
+if (ret < 0)
  return ret;
-if (w != avctx->width || h != avctx->height)
-avcodec_set_dimensions(avctx, w, h);
+
  if ((ret = ff_get_buffer(avctx, p, 0)) < 0) {
  av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
  return ret;


Ok

-Justin

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


Re: [libav-devel] [PATCH 38/50] rv10: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/rv10.c |9 ++---
  1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index f790c1f..f80625a 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -28,6 +28,7 @@
  #include "libavutil/imgutils.h"
  #include "avcodec.h"
  #include "error_resilience.h"
+#include "internal.h"
  #include "mpegvideo.h"
  #include "mpeg4video.h"
  #include "h263.h"
@@ -358,10 +359,12 @@ static int rv20_decode_picture_header(RVDecContext *rv)
  if (new_w != s->width || new_h != s->height) {
  av_log(s->avctx, AV_LOG_DEBUG,
 "attempting to change resolution to %dx%d\n", new_w, 
new_h);
-if (av_image_check_size(new_w, new_h, 0, s->avctx) < 0)
-return AVERROR_INVALIDDATA;
  ff_MPV_common_end(s);
-avcodec_set_dimensions(s->avctx, new_w, new_h);
+
+ret = ff_set_dimensions(s->avctx, new_w, new_h);
+if (ret < 0)
+return ret;
+
  s->width  = new_w;
  s->height = new_h;
  if ((ret = ff_MPV_common_init(s)) < 0)


Ok

-Justin

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


Re: [libav-devel] [PATCH 5/5] lavc: move AVCodecContext.pkt to AVCodecInternal

2013-10-28 Thread Vittorio Giovara
On Sun, Oct 27, 2013 at 1:17 PM, Anton Khirnov  wrote:
> It's a private field, not meant to be accessed from outside lavc.
> ---
>  libavcodec/avcodec.h   |8 +++-
>  libavcodec/internal.h  |6 ++
>  libavcodec/pthread_frame.c |2 +-
>  libavcodec/rawdec.c|3 ++-
>  libavcodec/utils.c |8 
>  libavcodec/version.h   |3 +++
>  6 files changed, 19 insertions(+), 11 deletions(-)
>
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index f5464d0..8ab2ebc 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -2662,14 +2662,12 @@ typedef struct AVCodecContext {
>   */
>  int error_rate;
>
> +#if FF_API_CODEC_PKT
>  /**
> - * Current packet as passed into the decoder, to avoid having
> - * to pass the packet into every function. Currently only valid
> - * inside lavc and get/release_buffer callbacks.
> - * - decoding: set by avcodec_decode_*, read by get_buffer() for setting 
> pkt_pts
> - * - encoding: unused
> + * @deprecated this field is not supposed to be accessed from outside 
> lavc
>   */
>  AVPacket *pkt;
> +#endif

I think there could be a deprecated attribute here

>
>  /**
>   * VBV delay coded in the last frame (in periods of a 27 MHz clock).
> diff --git a/libavcodec/internal.h b/libavcodec/internal.h
> index 9a57209..4648c02 100644
> --- a/libavcodec/internal.h
> +++ b/libavcodec/internal.h
> @@ -88,6 +88,12 @@ typedef struct AVCodecInternal {
>  FramePool *pool;
>
>  void *thread_ctx;
> +
> +/**
> + * Current packet as passed into the decoder, to avoid having to pass the
> + * packet into every function.
> + */
> +AVPacket *pkt;
>  } AVCodecInternal;

Since this is an internal struct there is no need of bump, right?

>
>  struct AVCodecDefault {

The rest seems ok
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] h264: eliminate two triggerable asserts

2013-10-28 Thread Luca Barbato
On 28/10/13 15:29, Anton Khirnov wrote:
> 
> On Mon, 28 Oct 2013 11:30:57 +0100, Luca Barbato  wrote:
>> ---
>>  libavcodec/h264.c | 6 --
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
>> index 68f51a9..944fbc7 100644
>> --- a/libavcodec/h264.c
>> +++ b/libavcodec/h264.c
>> @@ -289,8 +289,10 @@ static int ref_picture(H264Context *h, Picture *dst, 
>> Picture *src)
>>  {
>>  int ret, i;
>>  
>> -av_assert0(!dst->f.buf[0]);
>> -av_assert0(src->f.buf[0]);
>> +if (dst->f.buf[0])
>> +return AVERROR_BUG;
>> +if (!src->f.buf[0])
>> +goto fail;
> 
> Why are you treating them in different ways?

One is triggerable normally, so it is not something that should ever
trigger an assert, the other warrants an AVERROR_BUG or move it to a
normal assert.

lu

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


Re: [libav-devel] [PATCH 1/2] lavc: add a dummy field to AVStream to preserve ABI compatibility for avconv

2013-10-28 Thread Vittorio Giovara
On Mon, Oct 28, 2013 at 3:26 PM, Anton Khirnov  wrote:
> avconv abuses the API by accessing AVStream.parser (which is private).
> Removing AVStream.reference_dts in
> 2ba68dd044ca8fc591139c05563840f546a9c0c0 breaks ABI compatibility for an
> old avconv using a newer lavf. Fix this by adding a dummy field until
> the next bump.
> ---
>  libavformat/avformat.h |5 +
>  libavformat/version.h  |3 +++
>  2 files changed, 8 insertions(+)
>
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index a8e3a7d..cf327e9 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -729,6 +729,11 @@ typedef struct AVStream {
>
>  int pts_wrap_bits; /**< number of bits in pts (used for wrapping 
> control) */
>
> +#if FF_API_REFERENCE_DTS
> +/* a hack to keep ABI compatibility for avconv, which accesses parser 
> even
> + * though it should not */
> +int64_t unused;
> +#endif
>  // Timestamp generation support:
>  int64_t first_dts;
>  int64_t cur_dts;

I would suggest the name "do_not_use" and add a deprecated attribute maybe.
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 35/50] pgssubdec: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/pgssubdec.c |   25 -
  1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 874493c..2102a51 100644
--- a/libavcodec/pgssubdec.c
+++ b/libavcodec/pgssubdec.c
@@ -27,6 +27,8 @@
  #include "avcodec.h"
  #include "dsputil.h"
  #include "bytestream.h"
+#include "internal.h"
+
  #include "libavutil/colorspace.h"
  #include "libavutil/imgutils.h"
  
@@ -272,13 +274,13 @@ static void parse_palette_segment(AVCodecContext *avctx,

   * @todo TODO: Implement cropping
   * @todo TODO: Implement forcing of subtitles
   */
-static void parse_presentation_segment(AVCodecContext *avctx,
-   const uint8_t *buf, int buf_size,
-   int64_t pts)
+static int parse_presentation_segment(AVCodecContext *avctx,
+  const uint8_t *buf, int buf_size,
+  int64_t pts)
  {
  PGSSubContext *ctx = avctx->priv_data;
  
-int x, y;

+int x, y, ret;
  
  int w = bytestream_get_be16(&buf);

  int h = bytestream_get_be16(&buf);
@@ -287,8 +289,9 @@ static void parse_presentation_segment(AVCodecContext 
*avctx,
  
  av_dlog(avctx, "Video Dimensions %dx%d\n",

  w, h);
-if (av_image_check_size(w, h, 0, avctx) >= 0)
-avcodec_set_dimensions(avctx, w, h);
+ret = ff_set_dimensions(avctx, w, h);
+if (ret < 0)
+return ret;
  
  /* Skip 1 bytes of unknown, frame rate? */

  buf++;
@@ -306,7 +309,7 @@ static void parse_presentation_segment(AVCodecContext 
*avctx,
  ctx->presentation.object_number = bytestream_get_byte(&buf);
  ctx->presentation.composition_flag = 0;
  if (!ctx->presentation.object_number)
-return;
+return 0;
  
  /*

   * Skip 3 bytes of unknown:
@@ -332,6 +335,8 @@ static void parse_presentation_segment(AVCodecContext 
*avctx,
  /* Fill in dimensions */
  ctx->presentation.x = x;
  ctx->presentation.y = y;
+
+return 0;
  }
  
  /**

@@ -413,7 +418,7 @@ static int decode(AVCodecContext *avctx, void *data, int 
*data_size,
  const uint8_t *buf_end;
  uint8_t   segment_type;
  int   segment_length;
-int i;
+int i, ret;
  
  av_dlog(avctx, "PGS sub packet:\n");
  
@@ -452,7 +457,9 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,

  parse_picture_segment(avctx, buf, segment_length);
  break;
  case PRESENTATION_SEGMENT:
-parse_presentation_segment(avctx, buf, segment_length, avpkt->pts);
+ret = parse_presentation_segment(avctx, buf, segment_length, 
avpkt->pts);
+if (ret < 0)
+return ret;
  break;
  case WINDOW_SEGMENT:
  /*


Ok

-Justin

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


Re: [libav-devel] [PATCH 32/50] mpeg4video_parser: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/mpeg4video_parser.c |5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
index e291262..dfba84c 100644
--- a/libavcodec/mpeg4video_parser.c
+++ b/libavcodec/mpeg4video_parser.c
@@ -20,6 +20,7 @@
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
USA
   */
  
+#include "internal.h"

  #include "parser.h"
  #include "mpegvideo.h"
  #include "mpeg4video.h"
@@ -89,7 +90,9 @@ static int av_mpeg4_decode_header(AVCodecParserContext *s1,
  init_get_bits(gb, buf, 8 * buf_size);
  ret = ff_mpeg4_decode_picture_header(s, gb);
  if (s->width && (!avctx->width || !avctx->height || !avctx->coded_width || 
!avctx->coded_height)) {
-avcodec_set_dimensions(avctx, s->width, s->height);
+ret = ff_set_dimensions(avctx, s->width, s->height);
+if (ret < 0)
+return ret;
  }
  s1->pict_type= s->pict_type;
  pc->first_picture = 0;


Ok

-Justin

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


Re: [libav-devel] [PATCH 31/50] mpeg12dec: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/mpeg12dec.c |6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 9d1696c..53d1e0e 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1141,6 +1141,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
  Mpeg1Context *s1 = avctx->priv_data;
  MpegEncContext *s = &s1->mpeg_enc_ctx;
  uint8_t old_permutation[64];
+int ret;
  
  if ((s1->mpeg_enc_ctx_allocated == 0) ||

  avctx->coded_width  != s->width   ||
@@ -1162,7 +1163,10 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
  if ((s->width == 0) || (s->height == 0))
  return -2;
  
-avcodec_set_dimensions(avctx, s->width, s->height);

+ret = ff_set_dimensions(avctx, s->width, s->height);
+if (ret < 0)
+return ret;
+
  avctx->bit_rate  = s->bit_rate;
  s1->save_aspect_info = s->aspect_ratio_info;
  s1->save_width   = s->width;


Ok

-Justin

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


Re: [libav-devel] [PATCH 27/50] kgv1dec: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/kgv1dec.c |7 +++
  1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c
index 1774f36..a5f360c 100644
--- a/libavcodec/kgv1dec.c
+++ b/libavcodec/kgv1dec.c
@@ -61,12 +61,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
  h = (buf[1] + 1) * 8;
  buf += 2;
  
-if ((res = av_image_check_size(w, h, 0, avctx)) < 0)

-return res;
-
  if (w != avctx->width || h != avctx->height) {
  av_frame_unref(&c->prev);
-avcodec_set_dimensions(avctx, w, h);
+res = ff_set_dimensions(avctx, w, h);
+if (res < 0)
+return res;
  }
  
  maxcnt = w * h;


Ok

-Justin

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


Re: [libav-devel] [PATCH 30/50] mjpegdec: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/mjpegdec.c |6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index fdf7c87..dea195b 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -211,7 +211,7 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
  
  int ff_mjpeg_decode_sof(MJpegDecodeContext *s)

  {
-int len, nb_components, i, width, height, pix_fmt_id;
+int len, nb_components, i, width, height, pix_fmt_id, ret;
  
  /* XXX: verify len field validity */

  len = get_bits(&s->gb, 16);
@@ -309,7 +309,9 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
  height *= 2;
  }
  
-avcodec_set_dimensions(s->avctx, width, height);

+ret = ff_set_dimensions(s->avctx, width, height);
+if (ret < 0)
+return ret;
  
  s->first_picture = 0;

  }


Ok

-Justin

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


Re: [libav-devel] [PATCH 29/50] libvpxdec: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/libvpxdec.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index d19dd6f..d65f7f9 100644
--- a/libavcodec/libvpxdec.c
+++ b/libavcodec/libvpxdec.c
@@ -90,9 +90,9 @@ static int vp8_decode(AVCodecContext *avctx,
  if ((int) img->d_w != avctx->width || (int) img->d_h != 
avctx->height) {
  av_log(avctx, AV_LOG_INFO, "dimension change! %dx%d -> %dx%d\n",
 avctx->width, avctx->height, img->d_w, img->d_h);
-if (av_image_check_size(img->d_w, img->d_h, 0, avctx))
-return AVERROR_INVALIDDATA;
-avcodec_set_dimensions(avctx, img->d_w, img->d_h);
+ret = ff_set_dimensions(avctx, img->d_w, img->d_h);
+if (ret < 0)
+return ret;
  }
  if ((ret = ff_get_buffer(avctx, picture, 0)) < 0)
  return ret;


Ok

-Justin

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


Re: [libav-devel] [PATCH 26/50] ivi_common: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/ivi_common.c |5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c
index 7ca53b7..8c5d7f3 100644
--- a/libavcodec/ivi_common.c
+++ b/libavcodec/ivi_common.c
@@ -1015,7 +1015,10 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame,
  av_log(avctx, AV_LOG_ERROR, "Buffer contains IP frames!\n");
  }
  
-avcodec_set_dimensions(avctx, ctx->planes[0].width, ctx->planes[0].height);

+result = ff_set_dimensions(avctx, ctx->planes[0].width, 
ctx->planes[0].height);
+if (result < 0)
+return result;
+
  if ((result = ff_get_buffer(avctx, frame, 0)) < 0) {
  av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
  return result;


Ok

-Justin

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


Re: [libav-devel] [PATCH 25/50] indeo3: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/indeo3.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c
index 7cc870d..a9c02b2 100644
--- a/libavcodec/indeo3.c
+++ b/libavcodec/indeo3.c
@@ -944,7 +944,7 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, 
AVCodecContext *avctx,
  free_frame_buffers(ctx);
  if ((res = allocate_frame_buffers(ctx, avctx)) < 0)
   return res;
-avcodec_set_dimensions(avctx, width, height);
+ff_set_dimensions(avctx, width, height);
  }
  
  y_offset = bytestream2_get_le32(&gb);


Ok

-Justin

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


Re: [libav-devel] [PATCH 24/50] h26[13]dec: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/h261dec.c |5 -
  libavcodec/h263dec.c |4 +++-
  2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index f88831f..10489e1 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -29,6 +29,7 @@
  #include "mpegvideo.h"
  #include "h263.h"
  #include "h261.h"
+#include "internal.h"
  
  #define H261_MBA_VLC_BITS 9

  #define H261_MTYPE_VLC_BITS 6
@@ -608,7 +609,9 @@ retry:
  s->parse_context = pc;
  }
  if (!s->context_initialized) {
-avcodec_set_dimensions(avctx, s->width, s->height);
+ret = ff_set_dimensions(avctx, s->width, s->height);
+if (ret < 0)
+return ret;
  
  goto retry;

  }
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 6245068..503f8ea 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -590,7 +590,9 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
  /* H.263 could change picture size any time */
  s->context_reinit = 0;
  
-avcodec_set_dimensions(avctx, s->width, s->height);

+ret = ff_set_dimensions(avctx, s->width, s->height);
+if (ret < 0)
+return ret;
  
  if ((ret = ff_MPV_common_frame_size_change(s)))

  return ret;


Ok

-Justin

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


Re: [libav-devel] [PATCH 22/50] g2meet: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/g2meet.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index e7743e7..0b4a8b7 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -702,7 +702,7 @@ static int g2m_decode_frame(AVCodecContext *avctx, void 
*data,
  goto header_fail;
  }
  if (c->width != avctx->width || c->height != avctx->height)
-avcodec_set_dimensions(avctx, c->width, c->height);
+ff_set_dimensions(avctx, c->width, c->height);
  c->compression = bytestream2_get_be32(&bc);
  if (c->compression != 2 && c->compression != 3) {
  av_log(avctx, AV_LOG_ERROR,


Ok

-Justin

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


Re: [libav-devel] [PATCH 1/2] lavc: add a dummy field to AVStream to preserve ABI compatibility for avconv

2013-10-28 Thread Martin Storsjö


On Mon, 28 Oct 2013, Anton Khirnov wrote:


avconv abuses the API by accessing AVStream.parser (which is private).
Removing AVStream.reference_dts in
2ba68dd044ca8fc591139c05563840f546a9c0c0 breaks ABI compatibility for an
old avconv using a newer lavf. Fix this by adding a dummy field until
the next bump.
---


Subject typo: lavc->lavf


libavformat/avformat.h |5 +
libavformat/version.h  |3 +++
2 files changed, 8 insertions(+)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index a8e3a7d..cf327e9 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -729,6 +729,11 @@ typedef struct AVStream {

int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */

+#if FF_API_REFERENCE_DTS
+/* a hack to keep ABI compatibility for avconv, which accesses parser even
+ * though it should not */
+int64_t unused;
+#endif
// Timestamp generation support:
int64_t first_dts;
int64_t cur_dts;
diff --git a/libavformat/version.h b/libavformat/version.h
index 43431a5..791933f 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -48,5 +48,8 @@
 * dropped at a future version bump. The defines themselves are not part of
 * the public API and may change, break or disappear at any time.
 */
+#ifndef FF_API_REFERENCE_DTS
+#define FF_API_REFERENCE_DTS(LIBAVFORMAT_VERSION_MAJOR < 56)
+#endif

#endif /* AVFORMAT_VERSION_H */
--
1.7.10.4


The patch itself looks ok.

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


Re: [libav-devel] [PATCH 21/50] eatqi: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/eatqi.c |5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c
index 9f7ec4d..2345cc7 100644
--- a/libavcodec/eatqi.c
+++ b/libavcodec/eatqi.c
@@ -111,8 +111,9 @@ static int tqi_decode_frame(AVCodecContext *avctx,
  tqi_calculate_qtable(s, buf[4]);
  buf += 8;
  
-if (s->avctx->width!=s->width || s->avctx->height!=s->height)

-avcodec_set_dimensions(s->avctx, s->width, s->height);
+ret = ff_set_dimensions(s->avctx, s->width, s->height);
+if (ret < 0)
+return ret;
  
  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {

  av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");


Ok

-Justin

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


Re: [libav-devel] [PATCH 20/50] eatgv: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/eatgv.c |7 +++
  1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c
index fabc516..3602795 100644
--- a/libavcodec/eatgv.c
+++ b/libavcodec/eatgv.c
@@ -269,9 +269,11 @@ static int tgv_decode_frame(AVCodecContext *avctx,
  s->width  = AV_RL16(&buf[0]);
  s->height = AV_RL16(&buf[2]);
  if (s->avctx->width != s->width || s->avctx->height != s->height) {
-avcodec_set_dimensions(s->avctx, s->width, s->height);
  av_freep(&s->frame_buffer);
  av_frame_unref(&s->last_frame);
+ret = ff_set_dimensions(s->avctx, s->width, s->height);
+if (ret < 0)
+return ret;
  }
  
  pal_count = AV_RL16(&buf[6]);

@@ -282,9 +284,6 @@ static int tgv_decode_frame(AVCodecContext *avctx,
  }
  }
  
-if ((ret = av_image_check_size(s->width, s->height, 0, avctx)) < 0)

-return ret;
-
  if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
  return ret;
  


Ok

-Justin

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


Re: [libav-devel] [PATCH 19/50] eatgq: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/eatgq.c |7 ---
  1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c
index 0a3e0f6..1ead5f7 100644
--- a/libavcodec/eatgq.c
+++ b/libavcodec/eatgq.c
@@ -216,9 +216,10 @@ static int tgq_decode_frame(AVCodecContext *avctx,
  s->height = bytestream2_get_le16u(&s->gb);
  }
  
-if (s->avctx->width!=s->width || s->avctx->height!=s->height) {

-avcodec_set_dimensions(s->avctx, s->width, s->height);
-}
+ret = ff_set_dimensions(s->avctx, s->width, s->height);
+if (ret < 0)
+return ret;
+
  tgq_calculate_qtable(s, bytestream2_get_byteu(&s->gb));
  bytestream2_skip(&s->gb, 3);
  


Ok

-Justin

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


Re: [libav-devel] [PATCH 18/50] eamad: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/eamad.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c
index 8d6aa62..f201861 100644
--- a/libavcodec/eamad.c
+++ b/libavcodec/eamad.c
@@ -250,10 +250,10 @@ static int decode_frame(AVCodecContext *avctx,
  buf += 16;
  
  if (avctx->width != width || avctx->height != height) {

-if (av_image_check_size(width, height, 0, avctx) < 0)
-return -1;
-avcodec_set_dimensions(avctx, width, height);
  av_frame_unref(&s->last_frame);
+ret = ff_set_dimensions(avctx, width, height);
+if (ret < 0)
+return ret;
  }
  
  if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) {


Ok

-Justin

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


Re: [libav-devel] [PATCH 17/50] eacmv: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/eacmv.c |   18 --
  1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c
index 3b1256c..d39ebd3 100644
--- a/libavcodec/eacmv.c
+++ b/libavcodec/eacmv.c
@@ -129,19 +129,21 @@ static void cmv_decode_inter(CmvContext *s, AVFrame 
*frame, const uint8_t *buf,
  }
  }
  
-static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end)

+static int cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t 
*buf_end)
  {
-int pal_start, pal_count, i;
+int pal_start, pal_count, i, ret;
  
  if(buf_end - buf < 16) {

  av_log(s->avctx, AV_LOG_WARNING, "truncated header\n");
-return;
+return AVERROR_INVALIDDATA;
  }
  
  s->width  = AV_RL16(&buf[4]);

  s->height = AV_RL16(&buf[6]);
-if (s->avctx->width!=s->width || s->avctx->height!=s->height)
-avcodec_set_dimensions(s->avctx, s->width, s->height);
+
+ret = ff_set_dimensions(s->avctx, s->width, s->height);
+if (ret < 0)
+return ret;
  
  s->avctx->time_base.num = 1;

  s->avctx->time_base.den = AV_RL16(&buf[10]);
@@ -154,6 +156,8 @@ static void cmv_process_header(CmvContext *s, const uint8_t 
*buf, const uint8_t
  s->palette[i] = AV_RB24(buf);
  buf += 3;
  }
+
+return 0;
  }
  
  #define EA_PREAMBLE_SIZE 8

@@ -174,7 +178,9 @@ static int cmv_decode_frame(AVCodecContext *avctx,
  return AVERROR_INVALIDDATA;
  
  if (AV_RL32(buf)==MVIh_TAG||AV_RB32(buf)==MVIh_TAG) {

-cmv_process_header(s, buf+EA_PREAMBLE_SIZE, buf_end);
+ret = cmv_process_header(s, buf+EA_PREAMBLE_SIZE, buf_end);
+if (ret < 0)
+return ret;
  return buf_size;
  }
  


Ok

-Justin

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


Re: [libav-devel] [PATCH 16/50] dvdsubdec: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/dvdsubdec.c |   10 +++---
  1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 3cc9022..c5e864d 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -21,6 +21,8 @@
  #include "avcodec.h"
  #include "get_bits.h"
  #include "dsputil.h"
+#include "internal.h"
+
  #include "libavutil/attributes.h"
  #include "libavutil/colorspace.h"
  #include "libavutil/imgutils.h"
@@ -527,9 +529,11 @@ static av_cold int dvdsub_init(AVCodecContext *avctx)
  }
  } else if (!strncmp("size:", cur, 5)) {
  int w, h;
-if (sscanf(cur + 5, "%dx%d", &w, &h) == 2 &&
-av_image_check_size(w, h, 0, avctx) >= 0)
-avcodec_set_dimensions(avctx, w, h);
+if (sscanf(cur + 5, "%dx%d", &w, &h) == 2) {
+   int ret = ff_set_dimensions(avctx, w, h);
+   if (ret < 0)
+   return ret;
+}
  }
  cur += strcspn(cur, "\n\r");
  cur += strspn(cur, "\n\r");


Ok

-Justin

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


Re: [libav-devel] [PATCH 15/50] dvdec: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/dvdec.c |8 ++--
  1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index 4b7dfee..aee4053 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -318,7 +318,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
  int buf_size = avpkt->size;
  DVVideoContext *s = avctx->priv_data;
  const uint8_t* vsc_pack;
-int apt, is16_9;
+int apt, is16_9, ret;
  
  s->sys = avpriv_dv_frame_profile(s->sys, buf, buf_size);

  if (!s->sys || buf_size < s->sys->frame_size || 
ff_dv_init_dynamic_tables(s->sys)) {
@@ -330,7 +330,11 @@ static int dvvideo_decode_frame(AVCodecContext *avctx,
  s->picture.pict_type = AV_PICTURE_TYPE_I;
  avctx->pix_fmt   = s->sys->pix_fmt;
  avctx->time_base = s->sys->time_base;
-avcodec_set_dimensions(avctx, s->sys->width, s->sys->height);
+
+ret = ff_set_dimensions(avctx, s->sys->width, s->sys->height);
+if (ret < 0)
+return ret;
+
  if (ff_get_buffer(avctx, &s->picture, 0) < 0) {
  av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
  return -1;


Ok

-Justin

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


Re: [libav-devel] [PATCH 14/50] dpx: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/dpx.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index da7457d..c1f163b 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -147,10 +147,10 @@ static int decode_frame(AVCodecContext *avctx,
  return AVERROR_INVALIDDATA;
  }
  
-if ((ret = av_image_check_size(w, h, 0, avctx)) < 0)

+ret = ff_set_dimensions(avctx, w, h);
+if (ret < 0)
  return ret;
-if (w != avctx->width || h != avctx->height)
-avcodec_set_dimensions(avctx, w, h);
+
  if ((ret = ff_get_buffer(avctx, p, 0)) < 0) {
  av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
  return ret;


Ok

-Justin

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


Re: [libav-devel] [PATCH 13/50] dnxhddec: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/dnxhddec.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index f7b8a22..5c29b3e 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -347,9 +347,9 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame,
  first_field = 1;
  }
  
-if (av_image_check_size(ctx->width, ctx->height, 0, avctx))

-return -1;
-avcodec_set_dimensions(avctx, ctx->width, ctx->height);
+ret = ff_set_dimensions(avctx, ctx->width, ctx->height);
+if (ret < 0)
+return ret;
  
  if (first_field) {

  if ((ret = ff_get_buffer(avctx, picture, 0)) < 0) {


Ok

-Justin

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


Re: [libav-devel] [PATCH 11/50] cdxl: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/cdxl.c |5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/cdxl.c b/libavcodec/cdxl.c
index b198c4c..e0dcd1d 100644
--- a/libavcodec/cdxl.c
+++ b/libavcodec/cdxl.c
@@ -237,10 +237,9 @@ static int cdxl_decode_frame(AVCodecContext *avctx, void 
*data,
  return AVERROR_PATCHWELCOME;
  }
  
-if ((ret = av_image_check_size(w, h, 0, avctx)) < 0)

+ret = ff_set_dimensions(avctx, w, h);
+if (ret < 0)
  return ret;
-if (w != avctx->width || h != avctx->height)
-avcodec_set_dimensions(avctx, w, h);
  
  aligned_width = FFALIGN(c->avctx->width, 16);

  c->padded_bits  = aligned_width - c->avctx->width;


Ok

-Justin

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


Re: [libav-devel] [PATCH 12/50] dirac: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/dirac.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
index e11fea7..f0fb85d 100644
--- a/libavcodec/dirac.c
+++ b/libavcodec/dirac.c
@@ -29,6 +29,7 @@
  #include "dirac.h"
  #include "avcodec.h"
  #include "golomb.h"
+#include "internal.h"
  #include "mpeg12data.h"
  
  // defaults for source parameters

@@ -311,11 +312,10 @@ int avpriv_dirac_parse_sequence_header(AVCodecContext 
*avctx, GetBitContext *gb,
  if (ret = parse_source_parameters(avctx, gb, source))
  return ret;
  
-if (ret = av_image_check_size(source->width, source->height, 0, avctx))

+ret = ff_set_dimensions(avctx, source->width, source->height);
+if (ret < 0)
  return ret;
  
-avcodec_set_dimensions(avctx, source->width, source->height);

-
  /* [DIRAC_STD] picture_coding_mode shall be 0 for fields and 1 for frames
   * currently only used to signal field coding */
  picture_coding_mode = svq3_get_ue_golomb(gb);


Ok

-Justin

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


Re: [libav-devel] [PATCH 10/50] avs: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:10 AM, Anton Khirnov wrote:

---
  libavcodec/avs.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/avs.c b/libavcodec/avs.c
index 6ff6d26..8e70a90 100644
--- a/libavcodec/avs.c
+++ b/libavcodec/avs.c
@@ -160,7 +160,7 @@ static av_cold int avs_decode_init(AVCodecContext * avctx)
  {
  AvsContext *s = avctx->priv_data;
  avctx->pix_fmt = AV_PIX_FMT_PAL8;
-avcodec_set_dimensions(avctx, 318, 198);
+ff_set_dimensions(avctx, 318, 198);
  avcodec_get_frame_defaults(&s->picture);
  return 0;
  }


Ok

-Justin

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


Re: [libav-devel] [PATCH] h264: eliminate two triggerable asserts

2013-10-28 Thread Anton Khirnov

On Mon, 28 Oct 2013 11:30:57 +0100, Luca Barbato  wrote:
> ---
>  libavcodec/h264.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> index 68f51a9..944fbc7 100644
> --- a/libavcodec/h264.c
> +++ b/libavcodec/h264.c
> @@ -289,8 +289,10 @@ static int ref_picture(H264Context *h, Picture *dst, 
> Picture *src)
>  {
>  int ret, i;
>  
> -av_assert0(!dst->f.buf[0]);
> -av_assert0(src->f.buf[0]);
> +if (dst->f.buf[0])
> +return AVERROR_BUG;
> +if (!src->f.buf[0])
> +goto fail;

Why are you treating them in different ways?

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


Re: [libav-devel] [PATCH 07/50] oggparsetheora: stop using deprecated avcodec_set_dimensions

2013-10-28 Thread Justin Ruggles

On 10/27/2013 06:09 AM, Anton Khirnov wrote:

---
  libavformat/oggparsetheora.c |   16 
  1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c
index f4f4453..c683044 100644
--- a/libavformat/oggparsetheora.c
+++ b/libavformat/oggparsetheora.c
@@ -58,7 +58,6 @@ static int theora_header(AVFormatContext * s, int idx)
  switch (os->buf[os->pstart]) {
  case 0x80: {
  GetBitContext gb;
-int width, height;
  AVRational timebase;
  
  init_get_bits(&gb, os->buf + os->pstart, os->psize * 8);

@@ -73,19 +72,20 @@ static int theora_header(AVFormatContext * s, int idx)
  return AVERROR(ENOSYS);
  }
  
-width  = get_bits(&gb, 16) << 4;

-height = get_bits(&gb, 16) << 4;
-avcodec_set_dimensions(st->codec, width, height);
+st->codec->width  = get_bits(&gb, 16) << 4;
+st->codec->height = get_bits(&gb, 16) << 4;
  
  if (thp->version >= 0x030400)

  skip_bits(&gb, 100);
  
  if (thp->version >= 0x030200) {

-width  = get_bits_long(&gb, 24);
-height = get_bits_long(&gb, 24);
+int width  = get_bits_long(&gb, 24);
+int height = get_bits_long(&gb, 24);
  if (width  <= st->codec->width  && width  > st->codec->width  - 16 
&&
-height <= st->codec->height && height > st->codec->height - 16)
-avcodec_set_dimensions(st->codec, width, height);
+height <= st->codec->height && height > st->codec->height - 
16) {
+st->codec->width  = width;
+st->codec->height = height;
+}
  
  skip_bits(&gb, 16);

  }


Is it ok that coded_width/coded_height are no longer set after the patch?

-Justin

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


[libav-devel] [PATCH 1/2] lavc: add a dummy field to AVStream to preserve ABI compatibility for avconv

2013-10-28 Thread Anton Khirnov
avconv abuses the API by accessing AVStream.parser (which is private).
Removing AVStream.reference_dts in
2ba68dd044ca8fc591139c05563840f546a9c0c0 breaks ABI compatibility for an
old avconv using a newer lavf. Fix this by adding a dummy field until
the next bump.
---
 libavformat/avformat.h |5 +
 libavformat/version.h  |3 +++
 2 files changed, 8 insertions(+)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index a8e3a7d..cf327e9 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -729,6 +729,11 @@ typedef struct AVStream {
 
 int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) 
*/
 
+#if FF_API_REFERENCE_DTS
+/* a hack to keep ABI compatibility for avconv, which accesses parser even
+ * though it should not */
+int64_t unused;
+#endif
 // Timestamp generation support:
 int64_t first_dts;
 int64_t cur_dts;
diff --git a/libavformat/version.h b/libavformat/version.h
index 43431a5..791933f 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -48,5 +48,8 @@
  * dropped at a future version bump. The defines themselves are not part of
  * the public API and may change, break or disappear at any time.
  */
+#ifndef FF_API_REFERENCE_DTS
+#define FF_API_REFERENCE_DTS(LIBAVFORMAT_VERSION_MAJOR < 56)
+#endif
 
 #endif /* AVFORMAT_VERSION_H */
-- 
1.7.10.4

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


[libav-devel] [PATCH 2/2] avconv: stop accessing AVStream.parser

2013-10-28 Thread Anton Khirnov
It is private and must not be touched from outside of lavf.
---
 avconv.c |7 ++-
 avconv.h |2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/avconv.c b/avconv.c
index 0c0f3bf..257425e 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1013,7 +1013,10 @@ static void do_streamcopy(InputStream *ist, OutputStream 
*ost, const AVPacket *p
&& ost->st->codec->codec_id != AV_CODEC_ID_MPEG2VIDEO
&& ost->st->codec->codec_id != AV_CODEC_ID_VC1
) {
-if (av_parser_change(ist->st->parser, ost->st->codec, &opkt.data, 
&opkt.size, pkt->data, pkt->size, pkt->flags & AV_PKT_FLAG_KEY)) {
+if (av_parser_change(ost->parser, ost->st->codec,
+ &opkt.data, &opkt.size,
+ pkt->data, pkt->size,
+ pkt->flags & AV_PKT_FLAG_KEY)) {
 opkt.buf = av_buffer_create(opkt.data, opkt.size, 
av_buffer_default_free, NULL, 0);
 if (!opkt.buf)
 exit_program(1);
@@ -1546,6 +1549,8 @@ static int transcode_init(void)
 } else
 codec->time_base = ist->st->time_base;
 
+ost->parser = av_parser_init(codec->codec_id);
+
 switch (codec->codec_type) {
 case AVMEDIA_TYPE_AUDIO:
 if (audio_volume != 256) {
diff --git a/avconv.h b/avconv.h
index eb7e37f..cb3005d 100644
--- a/avconv.h
+++ b/avconv.h
@@ -305,6 +305,8 @@ typedef struct OutputStream {
 int copy_initial_nonkeyframes;
 
 enum AVPixelFormat pix_fmts[2];
+
+AVCodecParserContext *parser;
 } OutputStream;
 
 typedef struct OutputFile {
-- 
1.7.10.4

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


Re: [libav-devel] [PATCH] fate: add ffv1.0 test

2013-10-28 Thread Peter B.

Quoting Luca Barbato :


On 27/10/13 10:14, Peter B. wrote:

1) How do I add the reference files, required for tests to be able to diff?


You can upload to our local ftp[1] and drop me a note.


I'd like to keep the set of testvideos as small as possible, but I'm  
trying to improve the LCOV coverage of the FFV1 tests as high as  
possible.


I've seen that the current FFV1 tests were in "vcodec.mak", and if I  
understood it correctly, only encoding of 2 videos was tested. No  
decoding. Therefore, I've added additional FFV1 tests to  
"lossless-video.mak", and transcoded the files used for Lagarith  
FATE-tests to a new folder in "fate-suite/ffv1".


Next to the Lagarith testvideos, I've used 4 frames of a test-signal  
generated by us, because the Lagarith videos were mainly still images,  
and I wanted to have at least a few frames with a visual change in them.
So far my files used for FFV1 testing are around 8,5 MiB in total. I  
have several files for different pix_fmts to test decoding as  
thoroughly as necessary.



All the videos used for these tests could actually be generated, but I  
don't know how to add commands for generating the videos in FATE  
automatically so they are available for the actual tests. Could anyone  
point me at examples for doing so?


If there are any objections or suggestions regarding this approach,  
I'm happy to hear about them, so I can learn.




2) How do I get a LCOV HTML report locally?


https://wiki.libav.org/GcovCoverageHowTo


Worked (almost) perfectly. Thank you very much!
I had to add "-b ." to the command shown in your Wiki, in order for  
lcov to find the source. So my call looks as follows:


[quote]
$ lcov -b . --directory . --capture --output-file coverage.info
[/quote]

I've already used it with my new FFV1 set, and the line-coverage for  
ffv1dec.c already increased.


I've seen in FFmpeg's docs about "lcov" [1], that they've included  
Makefile-rules, such as:


- "make lcov": for generating HTML output
- "make lcov-reset": for resetting coverage measurements

Do these also work in Libav?
(They're not mentioned in your HowTo, so I thought I'd ask)


Regards,
Pb


== References:
[1] http://www.ffmpeg.org/developer.html

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


Re: [libav-devel] [PATCH] configure: Provide an hardened toolchain option

2013-10-28 Thread Vittorio Giovara
On Mon, Oct 28, 2013 at 1:58 PM, Luca Barbato  wrote:
> On 28/10/13 13:52, Vittorio Giovara wrote:
>> On Mon, Oct 28, 2013 at 1:23 PM, Luca Barbato  wrote:
>>> ---
>>>  configure | 4 
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/configure b/configure
>>> index 34a3650..0414e2a 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -2288,6 +2288,10 @@ case "$toolchain" in
>>>  add_cflags  -fprofile-arcs -ftest-coverage
>>>  add_ldflags -fprofile-arcs -ftest-coverage
>>>  ;;
>>> +hardened)
>>> +add_cflags -D_FORTIFY_SOURCE=2 -fno-strict-overflow 
>>> -fstack-protector-all
>>> +add_ldflags -Wl,-z,relro -Wl,-z,now
>>> +;;
>>>  ?*)
>>>  die "Unknown toolchain $toolchain"
>>>  ;;
>>> --
>>
>> Should be fine. What about "noexecstack"?
>
> swscale would break with it, I'm afraid.

sigh, push as is then.
Let's add "support noexecstack" to avscale todo list ;)
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] configure: Provide an hardened toolchain option

2013-10-28 Thread Luca Barbato
On 28/10/13 13:52, Vittorio Giovara wrote:
> On Mon, Oct 28, 2013 at 1:23 PM, Luca Barbato  wrote:
>> ---
>>  configure | 4 
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/configure b/configure
>> index 34a3650..0414e2a 100755
>> --- a/configure
>> +++ b/configure
>> @@ -2288,6 +2288,10 @@ case "$toolchain" in
>>  add_cflags  -fprofile-arcs -ftest-coverage
>>  add_ldflags -fprofile-arcs -ftest-coverage
>>  ;;
>> +hardened)
>> +add_cflags -D_FORTIFY_SOURCE=2 -fno-strict-overflow 
>> -fstack-protector-all
>> +add_ldflags -Wl,-z,relro -Wl,-z,now
>> +;;
>>  ?*)
>>  die "Unknown toolchain $toolchain"
>>  ;;
>> --
> 
> Should be fine. What about "noexecstack"?

swscale would break with it, I'm afraid.

lu

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


Re: [libav-devel] [PATCH] configure: Provide an hardened toolchain option

2013-10-28 Thread Vittorio Giovara
On Mon, Oct 28, 2013 at 1:23 PM, Luca Barbato  wrote:
> ---
>  configure | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/configure b/configure
> index 34a3650..0414e2a 100755
> --- a/configure
> +++ b/configure
> @@ -2288,6 +2288,10 @@ case "$toolchain" in
>  add_cflags  -fprofile-arcs -ftest-coverage
>  add_ldflags -fprofile-arcs -ftest-coverage
>  ;;
> +hardened)
> +add_cflags -D_FORTIFY_SOURCE=2 -fno-strict-overflow 
> -fstack-protector-all
> +add_ldflags -Wl,-z,relro -Wl,-z,now
> +;;
>  ?*)
>  die "Unknown toolchain $toolchain"
>  ;;
> --

Should be fine. What about "noexecstack"?
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] configure: Provide an hardened toolchain option

2013-10-28 Thread Luca Barbato
---
 configure | 4 
 1 file changed, 4 insertions(+)

diff --git a/configure b/configure
index 34a3650..0414e2a 100755
--- a/configure
+++ b/configure
@@ -2288,6 +2288,10 @@ case "$toolchain" in
 add_cflags  -fprofile-arcs -ftest-coverage
 add_ldflags -fprofile-arcs -ftest-coverage
 ;;
+hardened)
+add_cflags -D_FORTIFY_SOURCE=2 -fno-strict-overflow 
-fstack-protector-all
+add_ldflags -Wl,-z,relro -Wl,-z,now
+;;
 ?*)
 die "Unknown toolchain $toolchain"
 ;;
-- 
1.8.3.2

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


Re: [libav-devel] [PATCH] configure: Move gcc-only -W option where it belongs

2013-10-28 Thread Luca Barbato
On 28/10/13 12:57, Vittorio Giovara wrote:
> On Mon, Oct 28, 2013 at 12:46 PM, Luca Barbato  wrote:
>> ---
>>
>> This should make clang users happier.
>>
> 
> Maybe unrelated but gcc-4.6.3 users are unaffected and still see the warning

Ok... I guess I should bake a check that doesn't add cflags if any
message is print.

lu

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


Re: [libav-devel] [PATCH 1/3] lavc: remove old unused audio conversion functions.

2013-10-28 Thread Justin Ruggles
On 10/28/2013 02:55 AM, Anton Khirnov wrote:
> ---
>  libavcodec/Makefile   |1 -
>  libavcodec/audioconvert.c |  116 
> -
>  libavcodec/audioconvert.h |   70 ---
>  3 files changed, 187 deletions(-)
>  delete mode 100644 libavcodec/audioconvert.c
>  delete mode 100644 libavcodec/audioconvert.h

yay! looks great!

-Justin

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


Re: [libav-devel] [PATCH] configure: Move gcc-only -W option where it belongs

2013-10-28 Thread Vittorio Giovara
On Mon, Oct 28, 2013 at 12:46 PM, Luca Barbato  wrote:
> ---
>
> This should make clang users happier.
>

Maybe unrelated but gcc-4.6.3 users are unaffected and still see the warning

cc1: warning: unrecognized command line option
"-Wno-maybe-uninitialized" [enabled by default]

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


[libav-devel] [PATCH] configure: Move gcc-only -W option where it belongs

2013-10-28 Thread Luca Barbato
---

This should make clang users happier.

 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 9c2e7fc..34a3650 100755
--- a/configure
+++ b/configure
@@ -3907,7 +3907,6 @@ check_cflags -Wundef
 check_cflags -Wmissing-prototypes
 check_cflags -Wstrict-prototypes
 enabled extra_warnings && check_cflags -Winline
-enabled extra_warnings || check_cflags -Wno-maybe-uninitialized

 # add some linker flags
 check_ldflags -Wl,--warn-common
@@ -3999,6 +3998,7 @@ elif enabled gcc; then
 check_cflags -Werror=return-type
 check_cflags -Werror=declaration-after-statement
 check_cflags -Werror=vla
+enabled extra_warnings || check_cflags -Wno-maybe-uninitialized
 elif enabled llvm_gcc; then
 check_cflags -mllvm -stack-alignment=16
 elif enabled clang; then
--
1.8.3.2

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


[libav-devel] [PATCH] asyncts: move assignment out of single parenthesis

2013-10-28 Thread Vittorio Giovara
---
Would this be better?
Vittorio

 libavfilter/af_asyncts.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c
index 0ddd8b6..4719479 100644
--- a/libavfilter/af_asyncts.c
+++ b/libavfilter/af_asyncts.c
@@ -149,7 +149,8 @@ static int request_frame(AVFilterLink *link)
 if (s->first_pts != AV_NOPTS_VALUE)
 handle_trimming(ctx);
 
-if (nb_samples = get_delay(s)) {
+nb_samples = get_delay(s);
+if (nb_samples > 0) {
 AVFrame *buf = ff_get_audio_buffer(link, nb_samples);
 if (!buf)
 return AVERROR(ENOMEM);
-- 
1.7.9.5

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


Re: [libav-devel] [PATCH] h264: eliminate two triggerable asserts

2013-10-28 Thread Vittorio Giovara
On Mon, Oct 28, 2013 at 11:30 AM, Luca Barbato  wrote:
> ---
>  libavcodec/h264.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)

Shouldn't hurt.
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] h264: eliminate two triggerable asserts

2013-10-28 Thread Luca Barbato
---
 libavcodec/h264.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 68f51a9..944fbc7 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -289,8 +289,10 @@ static int ref_picture(H264Context *h, Picture *dst, 
Picture *src)
 {
 int ret, i;
 
-av_assert0(!dst->f.buf[0]);
-av_assert0(src->f.buf[0]);
+if (dst->f.buf[0])
+return AVERROR_BUG;
+if (!src->f.buf[0])
+goto fail;
 
 src->tf.f = &src->f;
 dst->tf.f = &dst->f;
-- 
1.8.3.2

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


Re: [libav-devel] [PATCH] wtv: fix variable sign in format

2013-10-28 Thread Diego Biurrun
On Mon, Oct 28, 2013 at 02:24:25AM +0100, Vittorio Giovara wrote:
>  libavformat/wtv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

LGTM

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


Re: [libav-devel] [PATCH] avformat: AviSynth demuxer rewrite

2013-10-28 Thread Diego Biurrun
On Thu, Sep 12, 2013 at 04:09:52PM -0400, Stephen Hutchinson wrote:
> On Thu, Sep 12, 2013 at 4:59 AM, Diego Biurrun  wrote:
> > On Wed, Sep 11, 2013 at 10:14:07PM -0400, Stephen Hutchinson wrote:
> > > From: d s 
> >
> > I repeat: Can we please have a name to go along with this?
> >
> 
> I've shot off an email to them.

Tried again?

> > > --- a/libavformat/avisynth.c
> > > +++ b/libavformat/avisynth.c
> > > @@ -19,211 +19,672 @@
> > > +
> > > +// AvxSynth doesn't have these colorspaces, so disable them
> > > +#ifndef _WIN32
> > > +#define avs_is_yv24(vi) 0
> > > +#define avs_is_yv16(vi) 0
> > > +#define avs_is_yv411(vi) 0
> > > +#define avs_is_y8(vi) 0
> > > +#endif
> >
> > The comment contradicts the ifdef condition.  How is the support of
> > colorspaces related to the operating system?
> 
> The support of those four colorspaces is conditional on whether AviSynth or
> AvxSynth is being used, and the divide between the two is where the OS
> comes in.  If Windows is not defined (and therefore AvxSynth is being
> used), those get forcibly disabled.

You are making an indirect argument here, which shows how brittle the
assumption is.  The condition should check which of the two libs is
used, or - better yet - check if the colorspaces are actually supported.

> > > +#define LOAD_AVS_FUNC(name, continue_on_fail) \
> > > +{ \
> > > +avs_library->name = \
> > > +(void *)GetProcAddress(avs_library->library, #name); \
> > > +if (!continue_on_fail && !avs_library->name) \
> > > +goto fail; \
> > > +}
> > > +LOAD_AVS_FUNC(avs_bit_blt, 0);
> > > +LOAD_AVS_FUNC(avs_clip_get_error, 0);
> >
> > The extra {} look unnecessary.
> 
> Aren't those necessary so that the entire {} block is defined as the
> meaning of LOAD_AVS_FUNC(name, continue_on_fail)?

No, the backslashes take care of that.

> > > +static int avisynth_read_packet(AVFormatContext *s, AVPacket *pkt)
> > > +{
> > > +AviSynthContext *avs = s->priv_data;
> > > +AVStream *st;
> > > +int discard = 0;
> > > +int ret;
> > > +
> > > +if (avs->error)
> > > +return AVERROR_UNKNOWN;
> > > +
> > > +pkt->destruct = av_destruct_packet;
> > > +
> > > +// If either stream reaches EOF, try to read the other one before
> > giving up.
> > > +avisynth_next_stream(s, &st, pkt, &discard);
> > > +if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
> > > +ret = avisynth_read_packet_video(s, pkt, discard);
> > > +if (ret == AVERROR_EOF && avs_has_audio(avs->vi)) {
> > > +avisynth_next_stream(s, &st, pkt, &discard);
> > > +return avisynth_read_packet_audio(s, pkt, discard);
> > > +}
> > > +return ret; // so that video-only scripts don't hang at end of
> > read
> > > +} else {
> > > +ret = avisynth_read_packet_audio(s, pkt, discard);
> > > +if (ret == AVERROR_EOF && avs_has_video(avs->vi)) {
> > > +avisynth_next_stream(s, &st, pkt, &discard);
> > > +return avisynth_read_packet_video(s, pkt, discard);
> > > +}
> > > +return ret; // so that audio-only scripts don't hang at end of
> > read
> > > +}
> > > +}
> >
> > You can factor out the return.
> 
> As mentioned above and noted in the comments, removing the return ret;
> lines and replacing them with a single return 0; at the end of the function
> cause video-only and audio-only scripts to not exit at the end of being
> read, forcing the user to have to Ctrl+C.

I never said you should remove the return.  I said you should factor it out.
Just move it after the if-else block instead of having the same line inside
of both branches.

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


Re: [libav-devel] [PATCH 3/3] lavfi: do not export the filters from shared objects

2013-10-28 Thread Luca Barbato
On 28/10/13 07:55, Anton Khirnov wrote:
> ---
>  libavfilter/af_aformat.c  |2 +-
>  libavfilter/af_amix.c |2 +-
>  libavfilter/af_anull.c|2 +-
>  libavfilter/af_ashowinfo.c|2 +-
>  libavfilter/af_asyncts.c  |2 +-
>  libavfilter/af_channelmap.c   |2 +-
>  libavfilter/af_channelsplit.c |2 +-
>  libavfilter/af_join.c |2 +-
>  libavfilter/af_resample.c |2 +-
>  libavfilter/af_volume.c   |2 +-
>  libavfilter/allfilters.c  |8 
>  libavfilter/asink_anullsink.c |2 +-
>  libavfilter/asrc_anullsrc.c   |2 +-
>  libavfilter/buffersink.c  |4 ++--
>  libavfilter/buffersrc.c   |4 ++--
>  libavfilter/fifo.c|4 ++--
>  libavfilter/setpts.c  |4 ++--
>  libavfilter/split.c   |4 ++--
>  libavfilter/trim.c|4 ++--
>  libavfilter/vf_aspect.c   |4 ++--
>  libavfilter/vf_blackframe.c   |2 +-
>  libavfilter/vf_boxblur.c  |2 +-
>  libavfilter/vf_copy.c |2 +-
>  libavfilter/vf_crop.c |2 +-
>  libavfilter/vf_cropdetect.c   |2 +-
>  libavfilter/vf_delogo.c   |2 +-
>  libavfilter/vf_drawbox.c  |2 +-
>  libavfilter/vf_drawtext.c |2 +-
>  libavfilter/vf_fade.c |2 +-
>  libavfilter/vf_fieldorder.c   |2 +-
>  libavfilter/vf_format.c   |4 ++--
>  libavfilter/vf_fps.c  |2 +-
>  libavfilter/vf_frei0r.c   |4 ++--
>  libavfilter/vf_gradfun.c  |2 +-
>  libavfilter/vf_hflip.c|2 +-
>  libavfilter/vf_hqdn3d.c   |2 +-
>  libavfilter/vf_interlace.c|2 +-
>  libavfilter/vf_libopencv.c|2 +-
>  libavfilter/vf_lut.c  |2 +-
>  libavfilter/vf_null.c |2 +-
>  libavfilter/vf_overlay.c  |2 +-
>  libavfilter/vf_pad.c  |2 +-
>  libavfilter/vf_pixdesctest.c  |2 +-
>  libavfilter/vf_scale.c|2 +-
>  libavfilter/vf_select.c   |2 +-
>  libavfilter/vf_settb.c|2 +-
>  libavfilter/vf_showinfo.c |2 +-
>  libavfilter/vf_transpose.c|2 +-
>  libavfilter/vf_unsharp.c  |2 +-
>  libavfilter/vf_vflip.c|2 +-
>  libavfilter/vf_yadif.c|2 +-
>  libavfilter/vsink_nullsink.c  |2 +-
>  libavfilter/vsrc_color.c  |2 +-
>  libavfilter/vsrc_movie.c  |2 +-
>  libavfilter/vsrc_nullsrc.c|2 +-
>  libavfilter/vsrc_testsrc.c|4 ++--
>  56 files changed, 69 insertions(+), 69 deletions(-)
> 

Ok.

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


Re: [libav-devel] [PATCH 01/50] libopenjpegdec: return meaningful error codes

2013-10-28 Thread Vittorio Giovara
On Sun, Oct 27, 2013 at 11:09 AM, Anton Khirnov  wrote:
> ---
>  libavcodec/libopenjpegdec.c |   15 +--
>  1 file changed, 9 insertions(+), 6 deletions(-)

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


[libav-devel] [PATCH] oggparsetheora: K&R cosmetics, reformat

2013-10-28 Thread Vittorio Giovara
From: Anton Khirnov 

Also typedef the private data struct and make its name consistent with
the rest of Libav.

Signed-off-by: Vittorio Giovara 
---
The patch looks good, I'd just add a few more space fixes here and there, see 
complete patch.
Vittorio

 libavformat/oggparsetheora.c |  108 +-
 1 file changed, 54 insertions(+), 54 deletions(-)

diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c
index 25210ab..8b86653 100644
--- a/libavformat/oggparsetheora.c
+++ b/libavformat/oggparsetheora.c
@@ -1,26 +1,26 @@
 /**
-  Copyright (C) 2005  Matthieu CASTET, Alex Beregszaszi
-
-  Permission is hereby granted, free of charge, to any person
-  obtaining a copy of this software and associated documentation
-  files (the "Software"), to deal in the Software without
-  restriction, including without limitation the rights to use, copy,
-  modify, merge, publish, distribute, sublicense, and/or sell copies
-  of the Software, and to permit persons to whom the Software is
-  furnished to do so, subject to the following conditions:
-
-  The above copyright notice and this permission notice shall be
-  included in all copies or substantial portions of the Software.
-
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-  DEALINGS IN THE SOFTWARE.
-**/
+ *Copyright (C) 2005  Matthieu CASTET, Alex Beregszaszi
+ *
+ *Permission is hereby granted, free of charge, to any person
+ *obtaining a copy of this software and associated documentation
+ *files (the "Software"), to deal in the Software without
+ *restriction, including without limitation the rights to use, copy,
+ *modify, merge, publish, distribute, sublicense, and/or sell copies
+ *of the Software, and to permit persons to whom the Software is
+ *furnished to do so, subject to the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ *DEALINGS IN THE SOFTWARE.
+ **/
 
 #include 
 #include "libavutil/bswap.h"
@@ -29,27 +29,27 @@
 #include "internal.h"
 #include "oggdec.h"
 
-struct theora_params {
+typedef struct TheoraParams {
 int gpshift;
 int gpmask;
 unsigned version;
-};
+} TheoraParams;
 
-static int
-theora_header (AVFormatContext * s, int idx)
+static int theora_header(AVFormatContext *s, int idx)
 {
-struct ogg *ogg = s->priv_data;
+struct ogg *ogg   = s->priv_data;
 struct ogg_stream *os = ogg->streams + idx;
-AVStream *st = s->streams[idx];
-struct theora_params *thp = os->private;
-int cds = st->codec->extradata_size + os->psize + 2, err;
+AVStream *st  = s->streams[idx];
+TheoraParams *thp = os->private;
+int cds   = st->codec->extradata_size + os->psize + 2;
+int err;
 uint8_t *cdp;
 
-if(!(os->buf[os->pstart] & 0x80))
+if (!(os->buf[os->pstart] & 0x80))
 return 0;
 
-if(!thp){
-thp = av_mallocz(sizeof(*thp));
+if (!thp) {
+thp = av_mallocz(sizeof(*thp));
 os->private = thp;
 }
 
@@ -59,15 +59,15 @@ theora_header (AVFormatContext * s, int idx)
 int width, height;
 AVRational timebase;
 
-init_get_bits(&gb, os->buf + os->pstart, os->psize*8);
+init_get_bits(&gb, os->buf + os->pstart, os->psize * 8);
 
-skip_bits_long(&gb, 7*8); /* 0x80"theora" */
+/* 0x80"theora" */
+skip_bits_long(&gb, 7 * 8);
 
 thp->version = get_bits_long(&gb, 24);
-if (thp->version < 0x030100)
-{
+if (thp->version < 0x030100) {
 av_log(s, AV_LOG_ERROR,
-"Too old or unsupported Theora (%x)\n", thp->version);
+   "Too old or unsupported Theora (%x)\n", thp->version);
 return -1;
 }
 
@@ -81,12 +81,13 @@ theora_header (AVFormatContext * s, int idx)
 if (thp->version >= 0x030200) {
 width  = get_bits_long(&gb, 24);
   

Re: [libav-devel] [PATCH] asyncts: fix assignment parenthesis

2013-10-28 Thread Hendrik Leppkes
On Mon, Oct 28, 2013 at 9:19 AM, Vittorio Giovara
 wrote:
> On Mon, Oct 28, 2013 at 7:49 AM, Anton Khirnov  wrote:
>>
>> On Mon, 28 Oct 2013 03:00:39 +0100, Vittorio Giovara 
>>  wrote:
>>> ---
>>>  libavfilter/af_asyncts.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c
>>> index 0ddd8b6..3ecd4ff 100644
>>> --- a/libavfilter/af_asyncts.c
>>> +++ b/libavfilter/af_asyncts.c
>>> @@ -149,7 +149,7 @@ static int request_frame(AVFilterLink *link)
>>>  if (s->first_pts != AV_NOPTS_VALUE)
>>>  handle_trimming(ctx);
>>>
>>> -if (nb_samples = get_delay(s)) {
>>> +if ((nb_samples = get_delay(s))) {
>>
>> Err...and what exactly does this fix?
>
> A clang warning claiming that assignment is used in single parenthesis.
> In practice every other check in the sources has double (( )) around.


You could make it less ugly by adding a > 0 as well, at least to me it
looks less weird then.

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


Re: [libav-devel] [PATCH] asyncts: fix assignment parenthesis

2013-10-28 Thread Vittorio Giovara
On Mon, Oct 28, 2013 at 7:49 AM, Anton Khirnov  wrote:
>
> On Mon, 28 Oct 2013 03:00:39 +0100, Vittorio Giovara 
>  wrote:
>> ---
>>  libavfilter/af_asyncts.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c
>> index 0ddd8b6..3ecd4ff 100644
>> --- a/libavfilter/af_asyncts.c
>> +++ b/libavfilter/af_asyncts.c
>> @@ -149,7 +149,7 @@ static int request_frame(AVFilterLink *link)
>>  if (s->first_pts != AV_NOPTS_VALUE)
>>  handle_trimming(ctx);
>>
>> -if (nb_samples = get_delay(s)) {
>> +if ((nb_samples = get_delay(s))) {
>
> Err...and what exactly does this fix?

A clang warning claiming that assignment is used in single parenthesis.
In practice every other check in the sources has double (( )) around.
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/3] lavf: do not export av_register_{rtp, rdt}_dynamic_payload_handlers from shared objects

2013-10-28 Thread Martin Storsjö

On Mon, 28 Oct 2013, Anton Khirnov wrote:


---
libavformat/allformats.c |4 ++--
libavformat/rdt.c|2 +-
libavformat/rdt.h|2 +-
libavformat/rtpdec.c |2 +-
libavformat/rtpdec.h |2 +-
5 files changed, 6 insertions(+), 6 deletions(-)


Ok.

Since these aren't listed in any public header I'd say it's ok to remove 
them like this even though they were exported before. I really can't see a 
reason why anybody would have linked to them externally earlier.


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


Re: [libav-devel] [PATCH 3/3] avfilter: use the new const attribute for avfilter_get_by_name

2013-10-28 Thread Anton Khirnov

On Mon, 28 Oct 2013 02:58:14 +0100, Vittorio Giovara 
 wrote:
> ---
>  libavfilter/avfilter.c  | 4 
>  libavfilter/avfiltergraph.c | 6 ++
>  libavfilter/graphparser.c   | 3 +++
>  3 files changed, 13 insertions(+)
> 
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index b18c0cb..c2691e5 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -284,7 +284,11 @@ AVFilter *avfilter_get_by_name(const char *name)
>  
>  while ((f = avfilter_next(f)))
>  if (!strcmp(f->name, name))
> +#if !FF_API_NOCONST_GET_NAME
>  return f;
> +#else
> +return (AVFilter *)f;
> +#endif

This probably won't solve anything, at least gcc still warns when you strip
const like this.

>  
>  return NULL;
>  }
> diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
> index 0fc385c..6414816 100644
> --- a/libavfilter/avfiltergraph.c
> +++ b/libavfilter/avfiltergraph.c
> @@ -316,6 +316,9 @@ static int query_formats(AVFilterGraph *graph, AVClass 
> *log_ctx)
>  
>  if (convert_needed) {
>  AVFilterContext *convert;
> +#if !FF_API_NOCONST_GET_NAME
> +const
> +#endif
>  AVFilter *filter;
>  AVFilterLink *inlink, *outlink;
>  char scale_args[256];
> @@ -782,6 +785,9 @@ static int graph_insert_fifos(AVFilterGraph *graph, 
> AVClass *log_ctx)
>  for (j = 0; j < f->nb_inputs; j++) {
>  AVFilterLink *link = f->inputs[j];
>  AVFilterContext *fifo_ctx;
> +#if !FF_API_NOCONST_GET_NAME
> +const
> +#endif
>  AVFilter *fifo;
>  char name[32];
>  
> diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c
> index 00764b6..88cc254 100644
> --- a/libavfilter/graphparser.c
> +++ b/libavfilter/graphparser.c
> @@ -94,6 +94,9 @@ static char *parse_link_name(const char **buf, void 
> *log_ctx)
>  static int create_filter(AVFilterContext **filt_ctx, AVFilterGraph *ctx, int 
> index,
>   const char *filt_name, const char *args, void 
> *log_ctx)
>  {
> +#if !FF_API_NOCONST_GET_NAME
> +const
> +#endif

All those #ifs should be unnecessary. You can assign a non-const variable to a
const one (after all it's just saying you won't modify it, even though you are
allowed to), just not the other way around.

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