Re: [libav-devel] [PATCH 1/1] jv: detect partial packets in the demuxer

2014-02-12 Thread Janne Grunau
On 2014-02-12 20:11:27 +0100, Janne Grunau wrote:
> Fixes valgrind's use of initialized value warnings in fate-jv.

Commimt mesage changed to:

Fixes fate-jv under valgrind which reports a different CRC for the last
frame from a partial read.

since it actually has different output.

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


[libav-devel] [PATCH 1/1] jv: detect partial packets in the demuxer

2014-02-12 Thread Janne Grunau
Fixes valgrind's use of initialized value warnings in fate-jv.
---
 libavformat/jvdec.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
index 006acec..84d55da 100644
--- a/libavformat/jvdec.c
+++ b/libavformat/jvdec.c
@@ -184,16 +184,22 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
 case JV_VIDEO:
 jv->state++;
 if (jvf->video_size || jvf->palette_size) {
+int ret;
 int size = jvf->video_size + jvf->palette_size;
 if (av_new_packet(pkt, size + JV_PREAMBLE_SIZE))
 return AVERROR(ENOMEM);
 
 AV_WL32(pkt->data, jvf->video_size);
 pkt->data[4] = jvf->video_type;
-if (avio_read(pb, pkt->data + JV_PREAMBLE_SIZE, size) < 0)
-return AVERROR(EIO);
-
-pkt->size = size + JV_PREAMBLE_SIZE;
+ret = avio_read(pb, pkt->data + JV_PREAMBLE_SIZE, size);
+if (ret < 0)
+return ret;
+if (ret < size) {
+memset(pkt->data + JV_PREAMBLE_SIZE + ret, 0,
+   FF_INPUT_BUFFER_PADDING_SIZE);
+pkt->flags |= AV_PKT_FLAG_CORRUPT;
+}
+pkt->size = ret + JV_PREAMBLE_SIZE;
 pkt->stream_index = 1;
 pkt->pts  = jv->pts;
 if (jvf->video_type != 1)
-- 
1.8.5.4

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


Re: [libav-devel] [PATCH 1/1] h264: make context_count unsigned

2014-02-12 Thread Janne Grunau
On 2014-02-12 13:08:43 +0100, Luca Barbato wrote:
> On 12/02/14 12:52, Janne Grunau wrote:
> > Removes the bogus but scary looking warning 'libavcodec/h264.c:4529:49:
> > warning: array subscript is below array bounds [-Warray-bounds]'.
> > ---
> >  libavcodec/h264.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> 
> Probably ok, we never use -1 for that variable, right?

no, we just set it to 0, increment it, and compare it for equality with
signed variables which should be strictly positive. Otherwise the warning
would not be bogus but warranted. gcc jsut can't track the fact that
context_count is always >= 0 over a function call.

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


[libav-devel] [PATCH 1/1] h264: make context_count unsigned

2014-02-12 Thread Janne Grunau
Removes the bogus but scary looking warning 'libavcodec/h264.c:4529:49:
warning: array subscript is below array bounds [-Warray-bounds]'.
---
 libavcodec/h264.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index da2d4a5..9b5d6a0 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -4500,7 +4500,7 @@ static int decode_slice(struct AVCodecContext *avctx, 
void *arg)
  * @param h h264 master context
  * @param context_count number of contexts to execute
  */
-static int execute_decode_slices(H264Context *h, int context_count)
+static int execute_decode_slices(H264Context *h, unsigned context_count)
 {
 AVCodecContext *const avctx = h->avctx;
 H264Context *hx;
@@ -4544,7 +4544,7 @@ static int decode_nal_units(H264Context *h, const uint8_t 
*buf, int buf_size,
 AVCodecContext *const avctx = h->avctx;
 H264Context *hx; ///< thread context
 int buf_index;
-int context_count;
+unsigned context_count;
 int next_avc;
 int pass = !(avctx->active_thread_type & FF_THREAD_FRAME);
 int nals_needed = 0; ///< number of NALs that need decoding before the 
next frame thread starts
-- 
1.8.5.4

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


[libav-devel] [PATCH 1/1] header: fix mixed content warning due to forced http in

2014-02-12 Thread Janne Grunau
Also do not force http for FATE.
---
 src/template_head2 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/template_head2 b/src/template_head2
index 043d43f..e0b4fe6 100644
--- a/src/template_head2
+++ b/src/template_head2
@@ -8,7 +8,7 @@
 
 
 
-http://libav.org/libav-logo.png"; alt="Libav" />
+
 
 
 
@@ -17,7 +17,7 @@
 Download
 Documentation
 Bug Reports
-http://fate.libav.org/";>FATE
+FATE
 Consulting
 Contact
 Legal
-- 
1.8.5.4

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


Re: [libav-devel] [PATCH] mov: support exporting rotation angle as AVPacketSideData

2014-02-11 Thread Janne Grunau
On 2014-02-11 12:08:56 +0100, Vittorio Giovara wrote:
> Compute the full rotatation angle exported by display_matrix.
> ---
> Micro optimization, don't do the math when you get the identity matrix!
> Part of the code based on how VLC does it (in modules/demux/mp4/libmp4.c).
> Cheers,
> Vittorio
> ---
>  Changelog|  1 +
>  doc/APIchanges   |  4 
>  libavcodec/avcodec.h |  6 ++
>  libavcodec/version.h |  2 +-
>  libavformat/isom.h   |  1 +
>  libavformat/mov.c| 28 
>  6 files changed, 41 insertions(+), 1 deletion(-)
> 
> diff --git a/Changelog b/Changelog
> index 6c54281..178d55d 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -57,6 +57,7 @@ version 10:
>  - framepack filter
>  - Mirillis FIC video decoder
>  - Support DNx444
> +- mov rotation exported as AVPacketSideData
>  
>  
>  version 9:
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 41c848f..8c5b44f 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,10 @@ libavutil: 2013-12-xx
>  
>  API changes, most recent first:
>  
> +2014-02-11 - xxx - lavc 55.34.0
> +  Add AV_PKT_DATA_ROTATION as AVPacketSideData to export the full rotation
> +  angle as integer degrees.
> +
>  2014-02-04 - d9ae103 - lavf 55.11.0 - avformat.h
>Add AVFormatContext.max_interleave_delta for controlling amount of 
> buffering
>when interleaving.
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 54c60a9..e06d220 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -923,6 +923,12 @@ enum AVPacketSideDataType {
>   * @endcode
>   */
>  AV_PKT_DATA_H263_MB_INFO,
> +
> +/**
> + * An AV_PKT_DATA_SCREEN_ORIENTATION side data packet contains the full
> + * rotation angle as integer degrees.

integer is underspecified in this contents, needs size and endianess.

> + */
> +AV_PKT_DATA_ROTATION,
>  };
>  
>  /**
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index f4d8716..4253074 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,7 +29,7 @@
>  #include "libavutil/version.h"
>  
>  #define LIBAVCODEC_VERSION_MAJOR 55
> -#define LIBAVCODEC_VERSION_MINOR 33
> +#define LIBAVCODEC_VERSION_MINOR 34
>  #define LIBAVCODEC_VERSION_MICRO  0
>  
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> diff --git a/libavformat/isom.h b/libavformat/isom.h
> index bf0792c..5409713 100644
> --- a/libavformat/isom.h
> +++ b/libavformat/isom.h
> @@ -135,6 +135,7 @@ typedef struct MOVStreamContext {
>  int64_t track_end;///< used for dts generation in fragmented movie 
> files
>  unsigned int rap_group_count;
>  MOVSbgp *rap_group;
> +uint32_t rotation;///< rotation angle derived from the display_matrix
>  } MOVStreamContext;
>  
>  typedef struct MOVContext {
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index dc5b42b..76e348a 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -2253,6 +2253,25 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  sc->width = width >> 16;
>  sc->height = height >> 16;
>  
> +// get full orientation angle when the matrix is not the identity one
> +if (display_matrix[0][1] || display_matrix[1][0] ||
> +display_matrix[2][0] || display_matrix[2][1]) {
> +double rotationf, scale[2];
> +#define CONV_FP(x) ((double) (x)) / 65536
> +scale[0] = sqrt(CONV_FP(display_matrix[0][0]) * 
> CONV_FP(display_matrix[0][0]) +
> +CONV_FP(display_matrix[1][0]) * 
> CONV_FP(display_matrix[1][0]));
> +scale[1] = sqrt(CONV_FP(display_matrix[0][1]) * 
> CONV_FP(display_matrix[0][1]) +
> +CONV_FP(display_matrix[1][1]) * 
> CONV_FP(display_matrix[1][1]));
> +
> +rotationf = atan2(CONV_FP(display_matrix[0][1]) / scale[1],
> +  CONV_FP(display_matrix[0][0]) / scale[0]) * 180 / 
> M_PI;
> +
> +while (rotationf < 0)
> +rotationf += 360.0f;
> +
> +sc->rotation = (uint32_t) floor(rotationf);
> +}
> +
>  // transform the display width/height according to the matrix
>  // skip this if the display matrix is the default identity matrix
>  // or if it is rotating the picture, ex iPhone 3GS
> @@ -2964,6 +2983,15 @@ static int mov_read_packet(AVFormatContext *s, 
> AVPacket *pkt)
>  sc->has_palette = 0;
>  }
>  }
> +if (sc->rotation != 0) {
> +uint8_t *rotation;
> +rotation = av_packet_new_side_data(pkt, AV_PKT_DATA_ROTATION, 
> sizeof(uint32_t));
> +if (rotation) {
> +memcpy(rotation, &sc->rotation, sizeof(uint32_t));

one of AV_W?32 from libavutil/intreadwrite.h

> +sc->rotation = 0;

have you tested if it is passed through after probing?

> +} else
> +av_log(mov->fc, AV_LOG_ERROR, "Cannot append rotation angle 
> t

[libav-devel] [PATCH 2/3] asfdec: short-circuit seeking to the start of stream

2014-02-11 Thread Janne Grunau
From: Andrew Kelley 

Bug-id: 43

Signed-off-by: Janne Grunau 
---
 libavformat/asfdec.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index e754cb2..8580ce0 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1465,6 +1465,13 @@ static int asf_read_seek(AVFormatContext *s, int 
stream_index,
 return ret;
 }
 
+/* explicitly handle the case of seeking to 0 */
+if (!pts) {
+asf_reset_header(s);
+avio_seek(s->pb, s->data_offset, SEEK_SET);
+return 0;
+}
+
 if (!asf->index_read)
 ret = asf_build_simple_index(s, stream_index);
 
-- 
1.8.5.4

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


[libav-devel] [PATCH 1/3] asfdec: check ff_get_guid() return values during seeking

2014-02-11 Thread Janne Grunau
Hitting EOF during seeking is quite likely. Fixes use of uninitialized
data during fate-seek-lavf-asf.
---
 libavformat/asfdec.c | 26 --
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 5b4366e..e754cb2 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1387,33 +1387,35 @@ static int64_t asf_read_pts(AVFormatContext *s, int 
stream_index,
 return pts;
 }
 
-static void asf_build_simple_index(AVFormatContext *s, int stream_index)
+static int asf_build_simple_index(AVFormatContext *s, int stream_index)
 {
 ff_asf_guid g;
 ASFContext *asf = s->priv_data;
 int64_t current_pos = avio_tell(s->pb);
-int i;
+int i, ret = 0;
 
 avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, 
SEEK_SET);
-ff_get_guid(s->pb, &g);
+if ((ret = ff_get_guid(s->pb, &g)) < 0)
+goto end;
 
 /* the data object can be followed by other top-level objects,
  * skip them until the simple index object is reached */
 while (ff_guidcmp(&g, &index_guid)) {
 int64_t gsize = avio_rl64(s->pb);
 if (gsize < 24 || s->pb->eof_reached) {
-avio_seek(s->pb, current_pos, SEEK_SET);
-return;
+goto end;
 }
 avio_skip(s->pb, gsize - 24);
-ff_get_guid(s->pb, &g);
+if ((ret = ff_get_guid(s->pb, &g)) < 0)
+goto end;
 }
 
 {
 int64_t itime, last_pos = -1;
 int pct, ict;
 int64_t av_unused gsize = avio_rl64(s->pb);
-ff_get_guid(s->pb, &g);
+if ((ret = ff_get_guid(s->pb, &g)) < 0)
+goto end;
 itime = avio_rl64(s->pb);
 pct   = avio_rl32(s->pb);
 ict   = avio_rl32(s->pb);
@@ -1436,7 +1438,11 @@ static void asf_build_simple_index(AVFormatContext *s, 
int stream_index)
 }
 asf->index_read = ict > 0;
 }
+end:
+if (s->pb->eof_reached)
+ret = 0;
 avio_seek(s->pb, current_pos, SEEK_SET);
+return ret;
 }
 
 static int asf_read_seek(AVFormatContext *s, int stream_index,
@@ -1445,7 +1451,7 @@ static int asf_read_seek(AVFormatContext *s, int 
stream_index,
 ASFContext *asf = s->priv_data;
 AVStream *st= s->streams[stream_index];
 int64_t pos;
-int index;
+int index, ret = 0;
 
 if (s->packet_size <= 0)
 return -1;
@@ -1460,9 +1466,9 @@ static int asf_read_seek(AVFormatContext *s, int 
stream_index,
 }
 
 if (!asf->index_read)
-asf_build_simple_index(s, stream_index);
+ret = asf_build_simple_index(s, stream_index);
 
-if ((asf->index_read && st->index_entries)) {
+if (!ret && asf->index_read && st->index_entries) {
 index = av_index_search_timestamp(st, pts, flags);
 if (index >= 0) {
 /* find the position */
-- 
1.8.5.4

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


[libav-devel] [PATCH 3/3] asfdec: fix seeking with fragmented packets

2014-02-11 Thread Janne Grunau
After seeking fragments with an offset > 0 must be skipped to correctly
assemble packets.

Bug-Id: 43
---
 libavformat/asfdec.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 8580ce0..1da0eab 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1103,6 +1103,16 @@ static int asf_parse_packet(AVFormatContext *s, 
AVIOContext *pb, AVPacket *pkt)
 asf_st = asf->asf_st;
 av_assert0(asf_st);
 
+if (!asf_st->frag_offset && asf->packet_frag_offset) {
+av_dlog(s, "skipping asf data pkt with fragment offset for "
+"stream:%d, expected:%d but got %d from pkt)\n",
+asf->stream_index, asf_st->frag_offset,
+asf->packet_frag_offset);
+avio_skip(pb, asf->packet_frag_size);
+asf->packet_size_left -= asf->packet_frag_size;
+continue;
+}
+
 if (asf->packet_replic_size == 1) {
 // frag_offset is here used as the beginning timestamp
 asf->packet_frag_timestamp = asf->packet_time_start;
@@ -1282,6 +1292,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 /* parse cached packets, if any */
 if ((ret = asf_parse_packet(s, s->pb, pkt)) <= 0)
 return ret;
+
 if ((ret = asf_get_packet(s, s->pb)) < 0)
 assert(asf->packet_size_left < FRAME_HEADER_SIZE ||
asf->packet_segments < 1);
-- 
1.8.5.4

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


[libav-devel] asf seeking

2014-02-11 Thread Janne Grunau
Hi,

I noticed that seeking in avplay of certain asf files didn't work at all
while I tested Andrew's patch before pushing. This patch set fixes that.
The first patch checks ff_get_guid return values, fate-seek-lavf-asf
triggered a undefined value error in valgrind. I covered just ff_get_guid
calls during seeking all other remain unchecked.
Andrew's patch is still an useful optimization for seeking to the start
of the file. I moved the special case in front of the index based seek.
The third patch finally fixes seeking in files from Andrew and Alex in
Bug-Id: 43. seek test output remains unchanged, I handled multiple
payloads in asf data packet incorrectly when I thought it changed.

Janne

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


Re: [libav-devel] [PATCH] aacdec: set AVFrame sample_rate

2014-02-10 Thread Janne Grunau
On 2014-02-08 21:24:00 -0500, Justin Ruggles wrote:
> On 02/08/2014 09:19 PM, John Stebbins wrote:
> > AVFrame.sample_rate is set in ff_get_buffer, but aacdec calls
> > ff_get_buffer before the samplerate is known. So it needs to be
> > set again before returning the frame.
> > ---
> >  libavcodec/aacdec.c | 11 +++
> >  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> LGTM

queued

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


Re: [libav-devel] [PATCH 3/5] ffv1: Make sure to clean up on error

2014-02-10 Thread Janne Grunau
On 2014-02-10 14:09:14 +0100, Luca Barbato wrote:
> On 10/02/14 14:03, Janne Grunau wrote:
> > On 2014-02-09 19:28:15 +0100, Luca Barbato wrote:
> >> Plug some leaks and free on non-allocated pointers.
> >> ---
> >> @@ -216,10 +220,21 @@ av_cold int ffv1_init_slice_contexts(FFV1Context *f)
> >>  
> >>  fs->sample_buffer = av_malloc(3 * MAX_PLANES * (fs->width + 6) *
> >>sizeof(*fs->sample_buffer));
> >> -if (!fs->sample_buffer)
> >> -return AVERROR(ENOMEM);
> >> +if (!fs->sample_buffer) {
> >> +av_freep(f->slice_context + i);
> >> +goto fail;
> >> +}
> >>  }
> >>  return 0;
> >> +
> >> +fail:
> >> +for (j = 0; j < i; j++) {
> >> +av_free(f->slice_context[i]->sample_buffer);
> >> +av_freep(f->slice_context + j);
> >> +}
> >> +for (; i < f->slice_count; i++)
> >> +f->slice_context[i] = NULL;
> > 
> > is there a reason to believe that these could be not null?
> 
> Probably we could zero it from start.

it's zero from the start, avctx.priv_data is allocated with av_mallocz

> > The error handling looks imho too complex while technically correct.
> > I would just go over all f->slice_count contexts free
> > f->slice_context[i]->sample_buffer if (f->slice_context[i]) and
> > av_freep() the slice context then.
> 
> I prefer be sure than sorry.

I would say the simpler approach is safer

> > and while identical &f->slice_context[i] is probably easier to read
> 
> I prefer not use &foo[i] when possible because it is less easier to read
> and & could be typoed away too easily.

I disagree but do as you prefer

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


Re: [libav-devel] [PATCH 3/5] ffv1: Make sure to clean up on error

2014-02-10 Thread Janne Grunau
On 2014-02-09 19:28:15 +0100, Luca Barbato wrote:
> Plug some leaks and free on non-allocated pointers.
> ---
>  libavcodec/ffv1.c| 29 +
>  libavcodec/ffv1dec.c | 14 +-
>  2 files changed, 34 insertions(+), 9 deletions(-)
> 
> diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
> index 9e7ba2e..1bc4273 100644
> --- a/libavcodec/ffv1.c
> +++ b/libavcodec/ffv1.c
> @@ -189,7 +189,7 @@ int ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs)
>  
>  av_cold int ffv1_init_slice_contexts(FFV1Context *f)
>  {
> -int i;
> +int i, j;
>  
>  f->slice_count = f->num_h_slices * f->num_v_slices;
>  if (f->slice_count <= 0) {

since I found it nowhere else this needs a check for f->slice_count >
MAX_SLICES

> @@ -205,6 +205,10 @@ av_cold int ffv1_init_slice_contexts(FFV1Context *f)
>  int sxe = f->avctx->width  * (sx + 1) / f->num_h_slices;
>  int sys = f->avctx->height *  sy  / f->num_v_slices;
>  int sye = f->avctx->height * (sy + 1) / f->num_v_slices;
> +
> +if (!fs)
> +goto fail;
> +
>  f->slice_context[i] = fs;
>  memcpy(fs, f, sizeof(*fs));
>  memset(fs->rc_stat2, 0, sizeof(fs->rc_stat2));
> @@ -216,10 +220,21 @@ av_cold int ffv1_init_slice_contexts(FFV1Context *f)
>  
>  fs->sample_buffer = av_malloc(3 * MAX_PLANES * (fs->width + 6) *
>sizeof(*fs->sample_buffer));
> -if (!fs->sample_buffer)
> -return AVERROR(ENOMEM);
> +if (!fs->sample_buffer) {
> +av_freep(f->slice_context + i);
> +goto fail;
> +}
>  }
>  return 0;
> +
> +fail:
> +for (j = 0; j < i; j++) {
> +av_free(f->slice_context[i]->sample_buffer);
> +av_freep(f->slice_context + j);
> +}
> +for (; i < f->slice_count; i++)
> +f->slice_context[i] = NULL;

is there a reason to believe that these could be not null?

The error handling looks imho too complex while technically correct.
I would just go over all f->slice_count contexts free
f->slice_context[i]->sample_buffer if (f->slice_context[i]) and
av_freep() the slice context then.

and while identical &f->slice_context[i] is probably easier to read

> +return AVERROR(ENOMEM);
>  }
>  
>  int ffv1_allocate_initial_states(FFV1Context *f)
> @@ -229,8 +244,14 @@ int ffv1_allocate_initial_states(FFV1Context *f)
>  for (i = 0; i < f->quant_table_count; i++) {
>  f->initial_states[i] = av_malloc(f->context_count[i] *
>   sizeof(*f->initial_states[i]));
> -if (!f->initial_states[i])
> +if (!f->initial_states[i]) {
> +int j;
> +for (j = 0; j < i; j++)
> +av_freep(f->initial_states + j);
> +for (; i < f->quant_table_count; i++)
> + f->initial_states[i] = NULL;

same, is there any reason to believe one of those is not NULL?

>  return AVERROR(ENOMEM);
> +}
>  memset(f->initial_states[i], 128,
> f->context_count[i] * sizeof(*f->initial_states[i]));
>  }
> diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
> index 98fd9d8..dd31d89 100644
> --- a/libavcodec/ffv1dec.c
> +++ b/libavcodec/ffv1dec.c
> @@ -805,15 +805,19 @@ static av_cold int ffv1_decode_init(AVCodecContext 
> *avctx)
>  
>  ffv1_common_init(avctx);
>  
> -f->last_picture = av_frame_alloc();
> -if (!f->last_picture)
> -return AVERROR(ENOMEM);
> -
>  if (avctx->extradata && (ret = read_extra_header(f)) < 0)

read_extra_header() might have already allocate memory so this needs
ffv1_close() too.

>  return ret;
>  
> -if ((ret = ffv1_init_slice_contexts(f)) < 0)
> +if ((ret = ffv1_init_slice_contexts(f)) < 0) {
> +ffv1_close(avctx);
>  return ret;
> +}
> +
> +f->last_picture = av_frame_alloc();
> +if (!f->last_picture) {
> +ffv1_close(avctx);
> +return AVERROR(ENOMEM);
> +}

no need to change the allocation order

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


Re: [libav-devel] [PATCH 5/5] wip: fate: FFv1 testcases

2014-02-10 Thread Janne Grunau
On 2014-02-10 12:17:30 +0100, Diego Biurrun wrote:
> On Sun, Feb 09, 2014 at 07:28:17PM +0100, Luca Barbato wrote:
> > From: Peter B 
> > 
> > Signed-off-by: Luca Barbato 
> > ---
> > +###
> > +#  Decoding:
> > +###
> > +#  YUV (8bit)
> > +fate-ffv1-dec-v1-defaults:   ${CMD = framecrc -i 
> > $(DEC_SRC)/ffv1-enc-v1-defaults.avi} fate-ffv1-enc-v1-defaults
> > +fate-ffv1-dec-v1-yuv410p:${CMD = framecrc -i 
> > $(DEC_SRC)/ffv1-enc-v1-yuv410p.avi} fate-ffv1-enc-v1-yuv410p
> > +fate-ffv1-dec-v1-yuv411p:${CMD = framecrc -i 
> > $(DEC_SRC)/ffv1-enc-v1-yuv411p.avi} fate-ffv1-enc-v1-yuv411p
> > +fate-ffv1-dec-v1-yuv420p:${CMD = framecrc -i 
> > $(DEC_SRC)/ffv1-enc-v1-yuv420p.avi} fate-ffv1-enc-v1-yuv420p
> > +fate-ffv1-dec-v1-yuv422p:${CMD = framecrc -i 
> > $(DEC_SRC)/ffv1-enc-v1-yuv422p.avi} fate-ffv1-enc-v1-yuv422p
> > +fate-ffv1-dec-v1-yuv444p:${CMD = framecrc -i 
> > $(DEC_SRC)/ffv1-enc-v1-yuv444p.avi} fate-ffv1-enc-v1-yuv444p
> > +fate-ffv1-dec-v1-yuv440p:${CMD = framecrc -i 
> > $(DEC_SRC)/ffv1-enc-v1-yuv440p.avi} fate-ffv1-enc-v1-yuv440p
> 
> Generally $() is preferred over ${}.

cleaner and more in sync with the rest to add
'fate-ffv1-dec-v1-%: fate-ffv1-enc-v1-%'
and drop the ${}

> > +# Requires generating vsynth1.yuv as input source:
> > +$(FATE_FFV1-yes): tests/data/vsynth1.yuv

missing $(TARGET_PATH)

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


Re: [libav-devel] [PATCH 1/1] build: fix make examples when EXESUF is not empty

2014-02-09 Thread Janne Grunau
On 2014-02-10 00:47:17 +0100, Janne Grunau wrote:
> From: Christophe Gisquet 
> 
> Due to a wrong substitution doc/examples is not added as prerequisite
> for the objects of the example programs. This results in compiler error
> due to the non existing output directory.
> 
> Bug-Id: 636
> 
> Signed-off-by: Janne Grunau 

typos in the commit message by me

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


[libav-devel] [PATCH 1/1] build: fix make examples when EXESUF is not empty

2014-02-09 Thread Janne Grunau
From: Christophe Gisquet 

Due to a wrong substitution doc/examples is not added as prerequisite
for the objects of the example programs. This results in compiler error
due to the non existing output directory.

Bug-Id: 636

Signed-off-by: Janne Grunau 
---

 doc/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/Makefile b/doc/Makefile
index 4228c54..e92e72f 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -54,7 +54,7 @@ doc/%.1: doc/%.pod $(GENTEXI)
$(M)pod2man --section=1 --center=" " --release=" " $< > $@
 
 $(DOCS) doc/doxy/html: | doc/
-$(DOC_EXAMPLES:%=%.o): | doc/examples
+$(DOC_EXAMPLES:%$(EXESUF)=%.o): | doc/examples
 OBJDIRS += doc/examples
 
 DOXY_TEMPLATES  = doxy_stylesheet.css footer.html header.html
-- 
1.8.5.4

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


Re: [libav-devel] [PATCH 2/3] template: Use the correct doctype

2014-02-09 Thread Janne Grunau
On 2014-01-29 16:09:41 +0100, Luca Barbato wrote:
> We are using html5.

and still no  on our homepage

> ---
>  src/template_head1 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/template_head1 b/src/template_head1
> index 21ab236..1e5c8a8 100644
> --- a/src/template_head1
> +++ b/src/template_head1
> @@ -1,4 +1,4 @@
> - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> +
>  
>  http://www.w3.org/1999/xhtml";>
>  

ok

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


Re: [libav-devel] [PATCH 1/3] css: Move to bootstrap3

2014-02-09 Thread Janne Grunau
On 2014-01-29 16:09:40 +0100, Luca Barbato wrote:
> ---
>  htdocs/css/alert.css   |   54 -
>  htdocs/css/bootstrap-theme.css |  464 +++
>  htdocs/css/bootstrap.css   | 6771 
> 
>  htdocs/css/libav.css   |  105 -

not really looked at the css changes, probably ok if it looks ok

>  src/about_breadcrumb   |2 +-
>  src/legal_breadcrumb   |1 -
>  src/projects_breadcrumb|3 +-
>  src/shame_breadcrumb   |1 -
>  src/template_footer|2 +-
>  src/template_head2 |   18 +-
>  src/template_head3 |2 -

those are ok, push anytime, we can modify the css later if there's
something wrong

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


Re: [libav-devel] [PATCH] lavf: default .ogg audio to libvorbis if we can

2014-02-08 Thread Janne Grunau
On 2014-02-08 18:14:23 +0100, Luca Barbato wrote:
> On 08/02/14 17:53, Andrew Kelley wrote:
> > Since 2007, the Xipth.org Foundation recommends that .ogg only be used
   ^
except for this typo

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


Re: [libav-devel] [PATCH] vp8: fix PPC assembly and bilinear C code to work if src_stride != dst_stride.

2014-02-08 Thread Janne Grunau
On 2014-02-08 16:12:43 +0100, Diego Biurrun wrote:
> On Sat, Feb 08, 2014 at 02:38:53PM +0000, Janne Grunau wrote:
> > On 2014-02-06 12:05:16 +0100, Diego Biurrun wrote:
> > > On Thu, Feb 06, 2014 at 08:28:44AM +0100, Anton Khirnov wrote:
> > > > On Wed, 5 Feb 2014 15:32:59 +0100, Diego Biurrun  
> > > > wrote:
> > > > > On Wed, Feb 05, 2014 at 09:59:45AM +0100, Anton Khirnov wrote:
> > > > > > --- a/libavcodec/ppc/vp8dsp_altivec.c
> > > > > > +++ b/libavcodec/ppc/vp8dsp_altivec.c
> > > > > > @@ -269,9 +269,44 @@ EPEL_HV(4,  4,6)
> > > > > >  
> > > > > > +static void put_vp8_pixels16_altivec(uint8_t *dst, ptrdiff_t 
> > > > > > dstride, uint8_t *src, ptrdiff_t sstride, int h, int mx, int my)
> > > > > >  {
> > > > > >  }
> > > > > 
> > > > > This duplicates the ff_put_pixels16_altivec() function from
> > > > > libavcodec/ppc/hpeldsp_altivec.c.
> > > > 
> > > > Yes I know.
> > > > Got a better solution?
> > > 
> > > What about replacing the version in hpeldsp_altivec.c with this more
> > > flexible version?
> > 
> > Can we please commit this? Complaining over the duplicated ppc/altivec
> > version is a little unfair if we already have the same duplication for
> > C, x86 and arm.
> 
> Whatever, code duplication seems to be the rage these days ...

it's not a full code duplication, the version in hpeldsp assumes that
src stride == dst stride and uses just one stride argument. A function
call with one argument less might be a worthwhile optimization if the
function which is hte case for put_pixels. It might be worth trying
to use macros to expand both functions from the same source lines
but I'm not sure if it's worth the trouble.

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


Re: [libav-devel] [PATCH] vp8: fix PPC assembly and bilinear C code to work if src_stride != dst_stride.

2014-02-08 Thread Janne Grunau
On 2014-02-06 12:05:16 +0100, Diego Biurrun wrote:
> On Thu, Feb 06, 2014 at 08:28:44AM +0100, Anton Khirnov wrote:
> > On Wed, 5 Feb 2014 15:32:59 +0100, Diego Biurrun  wrote:
> > > On Wed, Feb 05, 2014 at 09:59:45AM +0100, Anton Khirnov wrote:
> > > > --- a/libavcodec/ppc/vp8dsp_altivec.c
> > > > +++ b/libavcodec/ppc/vp8dsp_altivec.c
> > > > @@ -269,9 +269,44 @@ EPEL_HV(4,  4,6)
> > > >  
> > > > +static void put_vp8_pixels16_altivec(uint8_t *dst, ptrdiff_t dstride, 
> > > > uint8_t *src, ptrdiff_t sstride, int h, int mx, int my)
> > > >  {
> > > >  }
> > > 
> > > This duplicates the ff_put_pixels16_altivec() function from
> > > libavcodec/ppc/hpeldsp_altivec.c.
> > 
> > Yes I know.
> > Got a better solution?
> 
> What about replacing the version in hpeldsp_altivec.c with this more
> flexible version?

Can we please commit this? Complaining over the duplicated ppc/altivec
version is a little unfair if we already have the same duplication for
C, x86 and arm.

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


Re: [libav-devel] [PATCH 1/1] x86: use the inline int8x8_fmul_int32 only if inline SSE2 is availbale

2014-02-08 Thread Janne Grunau
On 2014-02-08 14:57:30 +0100, Diego Biurrun wrote:
> On Sat, Feb 08, 2014 at 11:52:19AM +0100, Janne Grunau wrote:
> > --- a/libavcodec/x86/dca.h
> > +++ b/libavcodec/x86/dca.h
> > @@ -18,7 +18,9 @@
> >  
> > -#if ARCH_X86_64
> > +#include "config.h"
> > +
> > +#if ARCH_X86_64 && HAVE_SSE2_INLINE
> >  # include "libavutil/x86/asm.h"
> >  # include "libavutil/mem.h"
> 
> Why is this ARCH_X86_64 anyway?

Because only ARCH_X86_64 guarantees that SSE2 is available at runtime.
We want also the specific HAVE_SSE2_INLINE since that's the only and
correct way to disable this from configure with --disable-sse2

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


[libav-devel] [PATCH 1/1] dca: include dcadsp.h in {arm, x86}/dca.h for checkheaders

2014-02-08 Thread Janne Grunau
---
 libavcodec/arm/dca.h | 1 +
 libavcodec/x86/dca.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/libavcodec/arm/dca.h b/libavcodec/arm/dca.h
index 06e3ea6..580bd75 100644
--- a/libavcodec/arm/dca.h
+++ b/libavcodec/arm/dca.h
@@ -24,6 +24,7 @@
 #include 
 
 #include "config.h"
+#include "libavcodec/dcadsp.h"
 #include "libavcodec/mathops.h"
 
 #if HAVE_ARMV6_INLINE && AV_GCC_VERSION_AT_LEAST(4,4)
diff --git a/libavcodec/x86/dca.h b/libavcodec/x86/dca.h
index fbca7ff..ab175b3 100644
--- a/libavcodec/x86/dca.h
+++ b/libavcodec/x86/dca.h
@@ -23,6 +23,7 @@
 #if ARCH_X86_64 && HAVE_SSE2_INLINE
 # include "libavutil/x86/asm.h"
 # include "libavutil/mem.h"
+#include "libavcodec/dcadsp.h"
 
 # define int8x8_fmul_int32 int8x8_fmul_int32
 static inline void int8x8_fmul_int32(av_unused DCADSPContext *dsp,
-- 
1.8.5.4

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


[libav-devel] [PATCH 2/2] mxfdec: free descriptor extradata in .read_close()

2014-02-08 Thread Janne Grunau
Fixes memleak in fate-mxf-demux.
---
 libavformat/mxfdec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 296044e..158e866 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2200,6 +2200,9 @@ static int mxf_read_close(AVFormatContext *s)
 
 for (i = 0; i < mxf->metadata_sets_count; i++) {
 switch (mxf->metadata_sets[i]->type) {
+case Descriptor:
+av_freep(&((MXFDescriptor *)mxf->metadata_sets[i])->extradata);
+break;
 case MultipleDescriptor:
 av_freep(&((MXFDescriptor 
*)mxf->metadata_sets[i])->sub_descriptors_refs);
 break;
-- 
1.8.5.4

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


[libav-devel] [PATCH 1/2] asvenc: free avctx->coded_frame on codec close

2014-02-08 Thread Janne Grunau
---
 libavcodec/asvenc.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c
index 40257f0..6c83c92 100644
--- a/libavcodec/asvenc.c
+++ b/libavcodec/asvenc.c
@@ -263,6 +263,12 @@ static av_cold int encode_init(AVCodecContext *avctx){
 
 return 0;
 }
+static av_cold int asv_encode_close(AVCodecContext *avctx)
+{
+av_frame_free(&avctx->coded_frame);
+
+return 0;
+}
 
 #if CONFIG_ASV1_ENCODER
 AVCodec ff_asv1_encoder = {
@@ -273,6 +279,7 @@ AVCodec ff_asv1_encoder = {
 .priv_data_size = sizeof(ASV1Context),
 .init   = encode_init,
 .encode2= encode_frame,
+.close  = asv_encode_close,
 .pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
 AV_PIX_FMT_NONE },
 };
@@ -287,6 +294,7 @@ AVCodec ff_asv2_encoder = {
 .priv_data_size = sizeof(ASV1Context),
 .init   = encode_init,
 .encode2= encode_frame,
+.close  = asv_encode_close,
 .pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
 AV_PIX_FMT_NONE },
 };
-- 
1.8.5.4

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


Re: [libav-devel] [PATCH] New HEVC streams

2014-02-08 Thread Janne Grunau
On 2014-02-05 19:16:42 +0100, Guillaume Martres wrote:
> Streams uploaded at ftp://upload.libav.org/incoming/hevc-samples-0214/ .
> 
> Guillaume Martres (1):
>   hevc: update conformance streams
> 
>  tests/fate/hevc.mak|  11 +-
>  ...ricsson_3 => hevc-conformance-EXT_A_ericsson_4} |   0
>  .../ref/fate/hevc-conformance-LTRPSPS_A_Qualcomm_1 | 501 
> +
>  ...ricsson_4 => hevc-conformance-NUT_A_ericsson_5} |   0
>  ...ricsson_4 => hevc-conformance-RPS_C_ericsson_5} |   0
>  ...ricsson_5 => hevc-conformance-RPS_D_ericsson_6} |   0
>  tests/ref/fate/hevc-conformance-SLPPLP_A_VIDYO_1   |  34 ++
>  tests/ref/fate/hevc-conformance-VPSID_A_VIDYO_1|  34 ++
>  8 files changed, 576 insertions(+), 4 deletions(-)
>  rename tests/ref/fate/{hevc-conformance-EXT_A_ericsson_3 => 
> hevc-conformance-EXT_A_ericsson_4} (100%)
>  create mode 100644 tests/ref/fate/hevc-conformance-LTRPSPS_A_Qualcomm_1
>  rename tests/ref/fate/{hevc-conformance-NUT_A_ericsson_4 => 
> hevc-conformance-NUT_A_ericsson_5} (100%)
>  rename tests/ref/fate/{hevc-conformance-RPS_C_ericsson_4 => 
> hevc-conformance-RPS_C_ericsson_5} (100%)
>  rename tests/ref/fate/{hevc-conformance-RPS_D_ericsson_5 => 
> hevc-conformance-RPS_D_ericsson_6} (100%)
>  create mode 100644 tests/ref/fate/hevc-conformance-SLPPLP_A_VIDYO_1
>  create mode 100644 tests/ref/fate/hevc-conformance-VPSID_A_VIDYO_1

NUT_A_ericsson_5.bit and RPS_D_ericsson_6.bit are identical to the
previous versions? Is that intenional? All samples in place.

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


Re: [libav-devel] [PATCH 0/2] New VP9 samples

2014-02-08 Thread Janne Grunau
On 2014-02-05 18:35:23 +0100, Guillaume Martres wrote:
> The samples have been uploaded to
> ftp://upload.libav.org/incoming/vp9-samples-0214/ .
> 
> Ronald S. Bultje (2):
>   vp9: add fate sample for parallelmode.
>   vp9: add a new segmentation sample.
> 
>  tests/fate/vpx.mak   |  4 ++-
>  tests/ref/fate/vp9-parallelmode-akiyo| 26 
>  tests/ref/fate/vp9-segmentation-akiyo| 51 
> 
>  tests/ref/fate/vp9-segmentation-aq-akiyo | 26 
>  tests/ref/fate/vp9-segmentation-sf-akiyo | 26 
>  5 files changed, 81 insertions(+), 52 deletions(-)
>  create mode 100644 tests/ref/fate/vp9-parallelmode-akiyo
>  delete mode 100644 tests/ref/fate/vp9-segmentation-akiyo
>  create mode 100644 tests/ref/fate/vp9-segmentation-aq-akiyo
>  create mode 100644 tests/ref/fate/vp9-segmentation-sf-akiyo

Samples are in place, h264 files will follow in a minute

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


[libav-devel] [PATCH 1/1] x86: use the inline int8x8_fmul_int32 only if inline SSE2 is availbale

2014-02-08 Thread Janne Grunau
Fixes compilation with MSVC. Also does not rely on on earlier config.h
include but include it directly.
---
 libavcodec/x86/dca.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/x86/dca.h b/libavcodec/x86/dca.h
index c14e94f..fbca7ff 100644
--- a/libavcodec/x86/dca.h
+++ b/libavcodec/x86/dca.h
@@ -18,7 +18,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#if ARCH_X86_64
+#include "config.h"
+
+#if ARCH_X86_64 && HAVE_SSE2_INLINE
 # include "libavutil/x86/asm.h"
 # include "libavutil/mem.h"
 
@@ -49,4 +51,4 @@ static inline void int8x8_fmul_int32(av_unused DCADSPContext 
*dsp,
 );
 }
 
-#endif /* ARCH_X86_64 */
+#endif /* ARCH_X86_64 && HAVE_SSE2_INLINE */
-- 
1.8.5.4

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


[libav-devel] [PATCH 1/1] arm: asm changes for splitted dca_lfe_fir

2014-02-07 Thread Janne Grunau
Hi,

whoever pushes "[PATCH 03/11] dcadsp: split lfe_dir cases" should
squash this patch into it. Original patch is ok this one needs review.

Janne
--->0---
---
 libavcodec/arm/dcadsp_init_arm.c | 46 
 libavcodec/arm/dcadsp_neon.S | 18 ++--
 libavcodec/arm/dcadsp_vfp.S  | 34 -
 3 files changed, 39 insertions(+), 59 deletions(-)

diff --git a/libavcodec/arm/dcadsp_init_arm.c b/libavcodec/arm/dcadsp_init_arm.c
index 905e4f9..2ea1289 100644
--- a/libavcodec/arm/dcadsp_init_arm.c
+++ b/libavcodec/arm/dcadsp_init_arm.c
@@ -24,16 +24,22 @@
 #include "libavutil/attributes.h"
 #include "libavcodec/dcadsp.h"
 
-void ff_dca_lfe_fir_vfp(float *out, const float *in, const float *coefs,
-int decifactor, float scale);
+void ff_dca_lfe_fir0_neon(float *out, const float *in, const float *coefs,
+  float scale);
+void ff_dca_lfe_fir1_neon(float *out, const float *in, const float *coefs,
+  float scale);
+
+void ff_dca_lfe_fir32_vfp(float *out, const float *in, const float *coefs,
+  float scale);
+void ff_dca_lfe_fir64_vfp(float *out, const float *in, const float *coefs,
+  float scale);
+
 void ff_dca_qmf_32_subbands_vfp(float samples_in[32][8], int sb_act,
 SynthFilterContext *synth, FFTContext *imdct,
 float synth_buf_ptr[512],
 int *synth_buf_offset, float synth_buf2[32],
 const float window[512], float *samples_out,
 float raXin[32], float scale);
-void ff_dca_lfe_fir_neon(float *out, const float *in, const float *coefs,
- int decifactor, float scale);
 
 void ff_synth_filter_float_vfp(FFTContext *imdct,
float *synth_buf_ptr, int *synth_buf_offset,
@@ -47,42 +53,18 @@ void ff_synth_filter_float_neon(FFTContext *imdct,
 float out[32], const float in[32],
 float scale);
 
-static void lfe_fir0_vfp(float *out, const float *in, const float *coefs,
- float scale)
-{
-ff_dca_lfe_fir_vfp(out, in, coefs, 32, scale);
-}
-
-static void lfe_fir1_vfp(float *out, const float *in, const float *coefs,
- float scale)
-{
-ff_dca_lfe_fir_vfp(out, in, coefs, 64, scale);
-}
-
-static void lfe_fir0_neon(float *out, const float *in, const float *coefs,
-  float scale)
-{
-ff_dca_lfe_fir_neon(out, in, coefs, 32, scale);
-}
-
-static void lfe_fir1_neon(float *out, const float *in, const float *coefs,
-  float scale)
-{
-ff_dca_lfe_fir_neon(out, in, coefs, 64, scale);
-}
-
 av_cold void ff_dcadsp_init_arm(DCADSPContext *s)
 {
 int cpu_flags = av_get_cpu_flags();
 
 if (have_vfp(cpu_flags) && !have_vfpv3(cpu_flags)) {
-s->lfe_fir[0]  = lfe_fir0_vfp;
-s->lfe_fir[1]  = lfe_fir1_vfp;
+s->lfe_fir[0]  = ff_dca_lfe_fir32_vfp;
+s->lfe_fir[1]  = ff_dca_lfe_fir64_vfp;
 s->qmf_32_subbands = ff_dca_qmf_32_subbands_vfp;
 }
 if (have_neon(cpu_flags)) {
-s->lfe_fir[0] = lfe_fir0_neon;
-s->lfe_fir[1] = lfe_fir1_neon;
+s->lfe_fir[0] = ff_dca_lfe_fir0_neon;
+s->lfe_fir[1] = ff_dca_lfe_fir1_neon;
 }
 }
 
diff --git a/libavcodec/arm/dcadsp_neon.S b/libavcodec/arm/dcadsp_neon.S
index fe3aae8..c798fea 100644
--- a/libavcodec/arm/dcadsp_neon.S
+++ b/libavcodec/arm/dcadsp_neon.S
@@ -20,17 +20,23 @@
 
 #include "libavutil/arm/asm.S"
 
-function ff_dca_lfe_fir_neon, export=1
+function ff_dca_lfe_fir0_neon, export=1
 push{r4-r6,lr}
+NOVFP   vmovs0,  r3 @ scale
+mov r3,  #32@ decifactor
+mov r6,  #256/32
+b   dca_lfe_fir
+endfunc
 
+function ff_dca_lfe_fir1_neon, export=1
+push{r4-r6,lr}
+NOVFP   vmovs0,  r3 @ scale
+mov r3,  #64@ decifactor
+mov r6,  #256/64
+dca_lfe_fir:
 add r4,  r0,  r3,  lsl #2   @ out2
 add r5,  r2,  #256*4-16 @ cf1
 sub r1,  r1,  #12
-cmp r3,  #32
-ite eq
-moveq   r6,  #256/32
-movne   r6,  #256/64
-NOVFP   vldrs0,  [sp, #16]  @ scale
 mov lr,  #-16
 1:
 vmov.f32q2,  #0.0   @ v0
diff --git a/libavcodec/arm/dcadsp_vfp.S b/libavcodec/arm/dcadsp_vfp.S
index 5892a84..10ccc9a 100644
--- a/libavcodec/arm/dcadsp_vfp.S
+++ b/libavcodec/arm/dcadsp_vfp.S
@@ -24,7 +24,6 @@
 POUT  .reqa1
 PIN   .reqa2
 PCOEF

Re: [libav-devel] [PATCH 02/11] x86: dcadsp: implement int8x8_fmul_int32

2014-02-07 Thread Janne Grunau
On 2014-02-07 21:57:08 +0100, Christophe Gisquet wrote:
> From 87983deb56aa52c2cdcfbf248dd76bccb97d694a Mon Sep 17 00:00:00 2001
> From: Christophe Gisquet 
> Date: Fri, 11 May 2012 11:25:30 +0200
> Subject: [PATCH 02/10] x86: dcadsp: implement int8x8_fmul_int32
> 
> For the callable function (as opposed to the inline one):
>  C  SSE  SSE2  SSE4
> Win32:  47   42   2926
> Win64:  30   33   2523
> The SSE version is neither compiled nor set for ARCH_X86_64, as the
> inlinable function takes over.
> ---
>  libavcodec/dcadec.c  |  3 ++
>  libavcodec/dcadsp.c  |  1 +
>  libavcodec/dcadsp.h  |  1 +
>  libavcodec/x86/Makefile  |  2 +
>  libavcodec/x86/dca.h | 52 +
>  libavcodec/x86/dcadsp.asm| 90 
> 
>  libavcodec/x86/dcadsp_init.c | 47 +++
>  7 files changed, 196 insertions(+)
>  create mode 100644 libavcodec/x86/dca.h
>  create mode 100644 libavcodec/x86/dcadsp.asm
>  create mode 100644 libavcodec/x86/dcadsp_init.c
> 
> diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
> index b6df3b9..6ffb040 100644
> --- a/libavcodec/dcadec.c
> +++ b/libavcodec/dcadec.c
> @@ -50,6 +50,9 @@
>  #if ARCH_ARM
>  #   include "arm/dca.h"
>  #endif
> +#if ARCH_X86
> +#   include "x86/dca.h"
> +#endif
>  
>  //#define TRACE
>  
> diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c
> index b984864..148f6dd 100644
> --- a/libavcodec/dcadsp.c
> +++ b/libavcodec/dcadsp.c
> @@ -88,4 +88,5 @@ av_cold void ff_dcadsp_init(DCADSPContext *s)
>  s->qmf_32_subbands = dca_qmf_32_subbands;
>  s->int8x8_fmul_int32 = int8x8_fmul_int32_c;
>  if (ARCH_ARM) ff_dcadsp_init_arm(s);
> +if (ARCH_X86) ff_dcadsp_init_x86(s);
>  }
> diff --git a/libavcodec/dcadsp.h b/libavcodec/dcadsp.h
> index 0f79dd6..e2ad09a 100644
> --- a/libavcodec/dcadsp.h
> +++ b/libavcodec/dcadsp.h
> @@ -36,5 +36,6 @@ typedef struct DCADSPContext {
>  
>  void ff_dcadsp_init(DCADSPContext *s);
>  void ff_dcadsp_init_arm(DCADSPContext *s);
> +void ff_dcadsp_init_x86(DCADSPContext *s);
>  
>  #endif /* AVCODEC_DCADSP_H */
> diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
> index 6f4935b..f985525 100644
> --- a/libavcodec/x86/Makefile
> +++ b/libavcodec/x86/Makefile
> @@ -4,6 +4,7 @@ OBJS   += x86/constants.o 
>   \
>  OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp_init.o
>  OBJS-$(CONFIG_AC3DSP)  += x86/ac3dsp_init.o
>  OBJS-$(CONFIG_CAVS_DECODER)+= x86/cavsdsp.o
> +OBJS-$(CONFIG_DCA_DECODER) += x86/dcadsp_init.o
>  OBJS-$(CONFIG_DCT) += x86/dct_init.o
>  OBJS-$(CONFIG_DNXHD_ENCODER)   += x86/dnxhdenc.o
>  OBJS-$(CONFIG_DSPUTIL) += x86/dsputil_init.o\
> @@ -54,6 +55,7 @@ YASM-OBJS  += x86/deinterlace.o 
> \
>  
>  YASM-OBJS-$(CONFIG_AAC_DECODER)+= x86/sbrdsp.o
>  YASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp.o
> +YASM-OBJS-$(CONFIG_DCA_DECODER)+= x86/dcadsp.o
>  YASM-OBJS-$(CONFIG_DCT)+= x86/dct32.o
>  YASM-OBJS-$(CONFIG_DSPUTIL)+= x86/dsputil.o \
>x86/fpel.o\
> diff --git a/libavcodec/x86/dca.h b/libavcodec/x86/dca.h
> new file mode 100644
> index 000..c14e94f
> --- /dev/null
> +++ b/libavcodec/x86/dca.h
> @@ -0,0 +1,52 @@
> +/*
> + * Copyright (c) 2012-2014 Christophe Gisquet 
> + *
> + * This file is part of Libav.
> + *
> + * Libav is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * Libav is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with Libav; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +#if ARCH_X86_64
> +# include "libavutil/x86/asm.h"
> +# include "libavutil/mem.h"
> +
> +# define int8x8_fmul_int32 int8x8_fmul_int32
> +static inline void int8x8_fmul_int32(av_unused DCADSPContext *dsp,
> + float *dst, const int8_t *src, int 
> scale)
> +{
> +DECLARE_ALIGNED(16, static const uint32_t, inverse16) = 0x3D80;
> +__asm__ volatile (
> +"cvtsi2ss%2, %%xmm0 \n\t"
> +"mulss   %3, %%xmm0 \n\t"
> +"movq  (%1), %%xmm1 \n\t"
> +"punpcklbw   %%xmm1, %%xmm1 \n\t"
> +"movaps  %%xmm1, %%xmm2 \n\t"

Re: [libav-devel] [PATCH 1/1] dcadsp: add int8x8_fmul_int32 to dsp context

2014-02-07 Thread Janne Grunau
On 2014-02-07 21:51:02 +0100, Christophe Gisquet wrote:
> From c233b96fa29150b0385776499e90afc9b59405b5 Mon Sep 17 00:00:00 2001
> From: Christophe Gisquet 
> Date: Fri, 11 May 2012 11:17:36 +0200
> Subject: [PATCH 01/10] dcadsp: add int8x8_fmul_int32 to DSP context
> 
> It is currently declared as a macro who is set to inlinable functions,
> among which a Neon and a default C implementations.
> 
> Add a DSP parameter to each inline function, unused except by the
> default C implementation which calls a function from the DSP context.
> 
> On an Arrandale CPU, gain for an inlined SSE2 function vs. a call:
> - Win32: 29 to 26 cycles
> - Win64: 25 to 23 cycles
> ---
>  libavcodec/arm/dca.h |  3 ++-
>  libavcodec/dcadec.c  | 10 --
>  libavcodec/dcadsp.c  |  9 +
>  libavcodec/dcadsp.h  |  1 +
>  4 files changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/arm/dca.h b/libavcodec/arm/dca.h
> index 39ec2b6..06e3ea6 100644
> --- a/libavcodec/arm/dca.h
> +++ b/libavcodec/arm/dca.h
> @@ -83,7 +83,8 @@ static inline int decode_blockcodes(int code1, int code2, 
> int levels,
>  #if HAVE_NEON_INLINE && HAVE_ASM_MOD_Y
>  
>  #define int8x8_fmul_int32 int8x8_fmul_int32
> -static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int 
> scale)
> +static inline void int8x8_fmul_int32(av_unused DCADSPContext *dsp,
> + float *dst, const int8_t *src, int 
> scale)
>  {
>  __asm__ ("vcvt.f32.s32 %2,  %2,  #4 \n"
>   "vld1.8   {d0}, [%1,:64]   \n"
> diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
> index f9e39bc..b6df3b9 100644
> --- a/libavcodec/dcadec.c
> +++ b/libavcodec/dcadec.c
> @@ -1086,12 +1086,10 @@ static const uint8_t abits_sizes[7]  = { 7, 10, 12, 
> 13, 15, 17, 19 };
>  static const uint8_t abits_levels[7] = { 3,  5,  7,  9, 13, 17, 25 };
>  
>  #ifndef int8x8_fmul_int32
> -static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int 
> scale)
> +static inline void int8x8_fmul_int32(DCADSPContext *dsp, float *dst,
> + const int8_t *src, int scale)
>  {
> -float fscale = scale / 16.0;
> -int i;
> -for (i = 0; i < 8; i++)
> -dst[i] = src[i] * fscale;
> +dsp->int8x8_fmul_int32(dst, src, scale);
>  }
>  #endif
>  
> @@ -1219,7 +1217,7 @@ static int dca_subsubframe(DCAContext *s, int 
> base_channel, int block_index)
>  s->debug_flag |= 0x01;
>  }
>  
> -int8x8_fmul_int32(subband_samples[k][l],
> +int8x8_fmul_int32(&s->dcadsp, subband_samples[k][l],
>&high_freq_vq[hfvq][subsubframe * 8],
>s->scale_factor[k][l][0]);
>  }
> diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c
> index 57d716e..b984864 100644
> --- a/libavcodec/dcadsp.c
> +++ b/libavcodec/dcadsp.c
> @@ -24,6 +24,14 @@
>  #include "libavutil/intreadwrite.h"
>  #include "dcadsp.h"
>  
> +static void int8x8_fmul_int32_c(float *dst, const int8_t *src, int scale)
> +{
> +float fscale = scale / 16.0;
> +int i;
> +for (i = 0; i < 8; i++)
> +dst[i] = src[i] * fscale;
> +}
> +
>  static void dca_lfe_fir_c(float *out, const float *in, const float *coefs,
>int decifactor, float scale)
>  {
> @@ -78,5 +86,6 @@ av_cold void ff_dcadsp_init(DCADSPContext *s)
>  {
>  s->lfe_fir = dca_lfe_fir_c;
>  s->qmf_32_subbands = dca_qmf_32_subbands;
> +s->int8x8_fmul_int32 = int8x8_fmul_int32_c;
>  if (ARCH_ARM) ff_dcadsp_init_arm(s);
>  }
> diff --git a/libavcodec/dcadsp.h b/libavcodec/dcadsp.h
> index ec88be7..0f79dd6 100644
> --- a/libavcodec/dcadsp.h
> +++ b/libavcodec/dcadsp.h
> @@ -31,6 +31,7 @@ typedef struct DCADSPContext {
>  int *synth_buf_offset, float synth_buf2[32],
>  const float window[512], float *samples_out,
>  float raXin[32], float scale);
> +void (*int8x8_fmul_int32)(float *dst, const int8_t *src, int scale);
>  } DCADSPContext;
>  
>  void ff_dcadsp_init(DCADSPContext *s);

ok and queued

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


[libav-devel] [PATCH 1/1] configure: clang: add -Qunused-arguments to as|ld_flags as well

2014-02-07 Thread Janne Grunau
On 2014-02-07 21:00:03 +0100, Diego Biurrun wrote:
> On Fri, Feb 07, 2014 at 07:24:28PM +0100, Janne Grunau wrote:
> > ---
> >  configure | 12 
> >  1 file changed, 12 insertions(+)
>
> Why?  A little bit more explanation would be appreciated.
>
> > --- a/configure
> > +++ b/configure
> > @@ -4208,6 +4208,18 @@ elif enabled_any msvc icl; then
> >  fi
> >  fi
> >
> > +case $ld_type in
> > +clang)
> > +   check_ldflags -Qunused-arguments
> > +;;
> > +esac
> > +
> > +case $as_type in
> > +clang)
> > +   add_asflags -Qunused-arguments
> > +;;
> > +esac
>
> stray tabs

argh, /me stabs his editor

Janne

---8<---
---
 configure | 12 
 1 file changed, 12 insertions(+)

diff --git a/configure b/configure
index 7a305c3..f3ca7dc 100755
--- a/configure
+++ b/configure
@@ -4208,6 +4208,18 @@ elif enabled_any msvc icl; then
 fi
 fi
 
+case $as_type in
+clang)
+add_asflags -Qunused-arguments
+;;
+esac
+
+case $ld_type in
+clang)
+check_ldflags -Qunused-arguments
+;;
+esac
+
 case $target_os in
 osf1)
 enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
-- 
1.8.5.3

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


Re: [libav-devel] [PATCH] Check the matched conditions in regexps that match branches

2014-02-07 Thread Janne Grunau
On 2014-02-07 21:03:12 +0200, Martin Storsjö wrote:
> This avoids interpreting instructions such as e.g. bic as
> a branch with the condition 'ic'.
> ---
> Updated to check the condition against the list of conditions
> from ARM ARM.
> ---
>  gas-preprocessor.pl | 15 ++-
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
> index 1c9a1d5..611a3a0 100755
> --- a/gas-preprocessor.pl
> +++ b/gas-preprocessor.pl
> @@ -480,11 +480,16 @@ foreach my $line (@pass1_lines) {
>  $thumb_labels{$1}++;
>  }
>  
> -if ($line =~ /^\s*((\w+\s*:\s*)?bl?x?(?:..)?(?:\.w)?|\.globl)\s+(\w+)/) {
> -if (exists $thumb_labels{$3}) {
> -print ASMFILE ".thumb_func $3\n";
> -} else {
> -$call_targets{$3}++;
> +if ($line =~ /^\s*((\w+\s*:\s*)?bl?x?(..)?(?:\.w)?|\.globl)\s+(\w+)/) {
> +my $cond = $3;
> +my $label = $4;
> +# Don't interpret e.g. bic as b with ic as conditional code
> +if ($cond =~ /|eq|ne|cs|cc|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al/) {

hs and lo missing, synonyms for cs and cc

> +if (exists $thumb_labels{$label}) {
> +print ASMFILE ".thumb_func $label\n";
> +} else {
> +$call_targets{$label}++;
> +}
>  }
>  }

otherwise ok

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


Re: [libav-devel] [PATCH 1/1] configure: clang: add -Qunused-arguments to as|ld_flags as well

2014-02-07 Thread Janne Grunau
On 2014-02-07 20:40:43 +0200, Martin Storsjö wrote:
> On Fri, 7 Feb 2014, Janne Grunau wrote:
> 
> >---
> >configure | 12 
> >1 file changed, 12 insertions(+)
> >
> >diff --git a/configure b/configure
> >index 7a305c3..abee247 100755
> >--- a/configure
> >+++ b/configure
> >@@ -4208,6 +4208,18 @@ elif enabled_any msvc icl; then
> >fi
> >fi
> >
> >+case $ld_type in
> >+clang)
> >+check_ldflags -Qunused-arguments
> >+;;
> >+esac
> 
> This silences the warnings about -pthread, right? I would kinda
> prefer to have the code that tries to add that option changed to
> Luca's second (original) alternative since that felt more robust to
> me. OTOH I guess there's not much value in intentionally annoying us
> with this warning until that is done either.

Yes, it silence the -pthread warning and yes we should try to avoid
adding it when it's not needed. Mostly added it here for consistency
with CFLAGS and ASFLAGS, I won't object dropping it

> >+
> >+case $as_type in
> >+clang)
> >+add_asflags -Qunused-arguments
> >+;;
> >+esac
> >+

This is more important since clang warns about every arguments when
using gas-preprocessor. This doesn't work yet, since it needs a change
in gas-preprocessor to pass -v/--version through

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


[libav-devel] [PATCH 1/1] configure: clang: add -Qunused-arguments to as|ld_flags as well

2014-02-07 Thread Janne Grunau
---
 configure | 12 
 1 file changed, 12 insertions(+)

diff --git a/configure b/configure
index 7a305c3..abee247 100755
--- a/configure
+++ b/configure
@@ -4208,6 +4208,18 @@ elif enabled_any msvc icl; then
 fi
 fi
 
+case $ld_type in
+clang)
+   check_ldflags -Qunused-arguments
+;;
+esac
+
+case $as_type in
+clang)
+   add_asflags -Qunused-arguments
+;;
+esac
+
 case $target_os in
 osf1)
 enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
-- 
1.8.5.3

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


Re: [libav-devel] [PATCH 1/1] dcadec: silence 'extensions_mask may be used uninitialized' warning

2014-02-07 Thread Janne Grunau
On 2014-02-07 19:12:30 +0100, Diego Biurrun wrote:
> On Fri, Feb 07, 2014 at 06:01:01PM +0000, Janne Grunau wrote:
> > On 2014-02-07 18:45:50 +0100, Diego Biurrun wrote:
> > > On Fri, Feb 07, 2014 at 06:39:38PM +0100, Janne Grunau wrote:
> > > > --- a/libavcodec/dcadec.c
> > > > +++ b/libavcodec/dcadec.c
> > > > @@ -1587,7 +1587,12 @@ static int 
> > > > dca_exss_parse_asset_header(DCAContext *s)
> > > >  case 2: extensions_mask = DCA_EXT_EXSS_LBR; break;
> > > > -case 3: extensions_mask = 0; /* aux coding */   break;
> > > > +case 3:
> > > > +/* default covers nothing just silences a warning since the 
> > > > compiler does
> > > > + * not know the range of get_bits(2)'s return values */
> > > > +default:
> > > > +extensions_mask = 0; /* aux coding */
> > > > +break;
> > > >  }
> > > 
> > > I don't see any warning here, with gcc 4.8.1.
> > 
> > I see the following with gcc 4.8.2 and gcc-4.6.3
> > 
> > gcc -I. -I/home/janne/src/libav -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 
> > -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 
> > -DHAVE_AV_CONFIG_H -march=corei7-avx -std=c99 -fomit-frame-pointer -pthread 
> > -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/opus -g 
> > -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith 
> > -Wredundant-decls -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef 
> > -Wmissing-prototypes -Wstrict-prototypes -Wno-parentheses -Wno-switch 
> > -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno 
> > -fno-signed-zeros -fno-tree-vectorize -Werror=implicit-function-declaration 
> > -Werror=missing-prototypes -Werror=return-type 
> > -Werror=declaration-after-statement -Werror=vla  -MMD -MF 
> > libavcodec/dcadec.d -MT libavcodec/dcadec.o -c -o libavcodec/dcadec.o 
> > /home/janne/src/libav/libavcodec/dcadec.c
> > /home/janne/src/libav/libavcodec/dcadec.c: In function 
> > ‘dca_exss_parse_header’:
> > /home/janne/src/libav/libavcodec/dcadec.c:1604:25: warning: 
> > ‘extensions_mask’ may be used uninitialized
> > in this function [-Wuninitialized]
> > /home/janne/src/libav/libavcodec/dcadec.c:1480:9: note: ‘extensions_mask’ 
> > was declared here
> 
> I have -Wno-maybe-uninitialized in that compiler command line, which
> makes the warning go away.  I wonder why you don't ...

because gcc-4.6 doesn't know it and I didn't rerun configure after
switching to gcc-4.8

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

Re: [libav-devel] [PATCH 1/1] dcadec: silence 'extensions_mask may be used uninitialized' warning

2014-02-07 Thread Janne Grunau
On 2014-02-07 18:45:50 +0100, Diego Biurrun wrote:
> On Fri, Feb 07, 2014 at 06:39:38PM +0100, Janne Grunau wrote:
> > --- a/libavcodec/dcadec.c
> > +++ b/libavcodec/dcadec.c
> > @@ -1587,7 +1587,12 @@ static int dca_exss_parse_asset_header(DCAContext *s)
> >  case 2: extensions_mask = DCA_EXT_EXSS_LBR; break;
> > -case 3: extensions_mask = 0; /* aux coding */   break;
> > +case 3:
> > +/* default covers nothing just silences a warning since the compiler 
> > does
> > + * not know the range of get_bits(2)'s return values */
> > +default:
> > +extensions_mask = 0; /* aux coding */
> > +break;
> >  }
> 
> I don't see any warning here, with gcc 4.8.1.

I see the following with gcc 4.8.2 and gcc-4.6.3

gcc -I. -I/home/janne/src/libav -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 
-D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 
-DHAVE_AV_CONFIG_H -march=corei7-avx -std=c99 -fomit-frame-pointer -pthread 
-I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/opus -g 
-Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith 
-Wredundant-decls -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef 
-Wmissing-prototypes -Wstrict-prototypes -Wno-parentheses -Wno-switch 
-Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -fno-signed-zeros 
-fno-tree-vectorize -Werror=implicit-function-declaration 
-Werror=missing-prototypes -Werror=return-type 
-Werror=declaration-after-statement -Werror=vla  -MMD -MF libavcodec/dcadec.d 
-MT libavcodec/dcadec.o -c -o libavcodec/dcadec.o 
/home/janne/src/libav/libavcodec/dcadec.c
/home/janne/src/libav/libavcodec/dcadec.c: In function ‘dca_exss_parse_header’:
/home/janne/src/libav/libavcodec/dcadec.c:1604:25: warning: ‘extensions_mask’ 
may be used uninitialized
in this function [-Wuninitialized]
/home/janne/src/libav/libavcodec/dcadec.c:1480:9: note: ‘extensions_mask’ was 
declared here

There is a second bogus warning about channels which is not easy to fix

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

[libav-devel] [PATCH 1/1] dcadec: silence 'extensions_mask may be used uninitialized' warning

2014-02-07 Thread Janne Grunau
---
 libavcodec/dcadec.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index 66eb03f..0624209 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -1587,7 +1587,12 @@ static int dca_exss_parse_asset_header(DCAContext *s)
 case 0: extensions_mask = get_bits(&s->gb, 12); break;
 case 1: extensions_mask = DCA_EXT_EXSS_XLL; break;
 case 2: extensions_mask = DCA_EXT_EXSS_LBR; break;
-case 3: extensions_mask = 0; /* aux coding */   break;
+case 3:
+/* default covers nothing just silences a warning since the compiler does
+ * not know the range of get_bits(2)'s return values */
+default:
+extensions_mask = 0; /* aux coding */
+break;
 }
 
 /* not parsed further, we were only interested in the extensions mask */
-- 
1.8.5.3

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


Re: [libav-devel] [PATCH] Don't interpret the bic instruction as a conditional branch

2014-02-07 Thread Janne Grunau
On 2014-02-07 17:01:06 +0200, Martin Storsjö wrote:
> 
> >> +if ($cond ne "ic") {
> >> +if (exists $thumb_labels{$label}) {
> >> +print ASMFILE ".thumb_func $label\n";
> >> +} else {
> >> +$call_targets{$label}++;
> >> +}
> >>  }
> >>  }
> >
> >ok,
> >
> >doing it this way is probably best for clarity
> 
> I now later came to think that I could probably stuff it into the RE
> as well, having the (..) match anything but ic, saving one indentation
> level here. But do you still prefer the explicit check here over
> extending the RE?

I don't care much, I think this is a little more explicit but my first
impulse was suggesting to stuff it into the RE. Do as you prefer

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


Re: [libav-devel] [PATCH] Don't interpret the bic instruction as a conditional branch

2014-02-07 Thread Janne Grunau
On 2014-02-07 16:31:38 +0200, Martin Storsjö wrote:

Do not instead of Don't in the commit msg

> ---
> This doesn't help much right now, but in a number of experimental
> branches I've added things in this clause, and I've had to hack
> around misidentifying bic as a branch in all of them.
> ---
>  gas-preprocessor.pl | 16 +++-
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
> index 1c9a1d5..14c07bf 100755
> --- a/gas-preprocessor.pl
> +++ b/gas-preprocessor.pl
> @@ -480,11 +480,17 @@ foreach my $line (@pass1_lines) {
>  $thumb_labels{$1}++;
>  }
>  
> -if ($line =~ /^\s*((\w+\s*:\s*)?bl?x?(?:..)?(?:\.w)?|\.globl)\s+(\w+)/) {
> -if (exists $thumb_labels{$3}) {
> -print ASMFILE ".thumb_func $3\n";
> -} else {
> -$call_targets{$3}++;
> +if ($line =~ /^\s*((\w+\s*:\s*)?bl?x?(..)?(?:\.w)?|\.globl)\s+(\w+)/) {
> +my $cond = $3;
> +my $label = $4;
> +# Don't interpret bic as b with ic as conditional code, although
> +# there's no harm in adding the register to @call_targets.

the second part is useless information

> +if ($cond ne "ic") {
> +if (exists $thumb_labels{$label}) {
> +print ASMFILE ".thumb_func $label\n";
> +} else {
> +$call_targets{$label}++;
> +}
>  }
>  }

ok,

doing it this way is probably best for clarity

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


Re: [libav-devel] [PATCH 1/2] arm: Add X() around all references to extern symbols

2014-02-07 Thread Janne Grunau
On 2014-02-07 14:03:59 +0200, Martin Storsjö wrote:
> On Fri, 7 Feb 2014, Janne Grunau wrote:
> 
> >On 2014-02-07 12:06:56 +0200, Martin Storsjö wrote:
> >>Don't rely on the fact that an unprefixed label currently exists.
> >>---
> >> libavcodec/arm/fmtconvert_neon.S   |  2 +-
> >> libavcodec/arm/h264idct_neon.S | 16 
> >> libavcodec/arm/hpeldsp_armv6.S |  4 ++--
> >> libavcodec/arm/mdct_neon.S |  2 +-
> >> libavcodec/arm/mpegvideo_neon.S|  2 +-
> >> libavcodec/arm/videodsp_armv5te.S  |  2 +-
> >> libavcodec/arm/vp8dsp_armv6.S  | 16 
> >> libavresample/arm/audio_convert_neon.S |  4 ++--
> >> 8 files changed, 24 insertions(+), 24 deletions(-)
> >>
> >>diff --git a/libavcodec/arm/fmtconvert_neon.S 
> >>b/libavcodec/arm/fmtconvert_neon.S
> >>index 41a095a..e11e82c 100644
> >>--- a/libavcodec/arm/fmtconvert_neon.S
> >>+++ b/libavcodec/arm/fmtconvert_neon.S
> >>@@ -70,7 +70,7 @@ function ff_float_to_int16_interleave_neon, export=1
> >> cmp r3, #2
> >> itt lt
> >> ldrlt   r1, [r1]
> >>-blt ff_float_to_int16_neon
> >>+blt X(ff_float_to_int16_neon)
> >> bne 4f
> >>
> >> ldr r3, [r1]
> >>diff --git a/libavcodec/arm/h264idct_neon.S b/libavcodec/arm/h264idct_neon.S
> >>index 3e5321c..f588f3e 100644
> >>--- a/libavcodec/arm/h264idct_neon.S
> >>+++ b/libavcodec/arm/h264idct_neon.S
> >>@@ -113,8 +113,8 @@ function ff_h264_idct_add16_neon, export=1
> >> movne   lr,  #0
> >> cmp lr,  #0
> >> ite ne
> >>-adrne   lr,  ff_h264_idct_dc_add_neon + CONFIG_THUMB
> >>-adreq   lr,  ff_h264_idct_add_neon+ CONFIG_THUMB
> >>+adrne   lr,  X(ff_h264_idct_dc_add_neon) + CONFIG_THUMB
> >>+adreq   lr,  X(ff_h264_idct_add_neon)+ CONFIG_THUMB
> >
> >does this still does the right thing when X(ff_h264_idct_add_neon) is
> >declared as .thumb_func when targeting ios? It probably does since
> >ff_h264_idct_add_neon should already be declared as thumb after my
> >'.func' -> '.thumb_func' patch in gas-preprocessor.
> 
> Yes, prior to this patch both ff_h264_idct_dc_add_neon and
> _ff_h264_idct_dc_add_neon are marked with .thumb_func, so this
> shouldn't change anything with regard to that. Excellent point
> though.

Tested, the '+ CONFIG_THUMB' is still required since for some reason
the thumb bit is not set in this context although the symbol is
declared as .thumb_func. patch ok

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


Re: [libav-devel] [PATCH] h264: report errors from decode_nal_units()

2014-02-07 Thread Janne Grunau
On 2014-02-07 11:51:18 +0100, Vittorio Giovara wrote:
> ---
>  libavcodec/h264.c | 19 ++-
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> index da2d4a5..0cbe944 100644
> --- a/libavcodec/h264.c
> +++ b/libavcodec/h264.c
> @@ -4787,7 +4787,9 @@ again:
>  break;
>  case NAL_SEI:
>  init_get_bits(&h->gb, ptr, bit_length);
> -ff_h264_decode_sei(h);
> +ret = ff_h264_decode_sei(h);
> +if (ret < 0)
> +goto end;

at least the commit message is misleading, it doesn't only report
errors but aborts the decoding of the frame on the first error.
If that's the desired effect it should be explicit about it.

Not sure if errors in ff_h264_decode_sei should be fatal unless
AV_EF_EXPLODE is set

>  break;
>  case NAL_SPS:
>  init_get_bits(&h->gb, ptr, bit_length);
> @@ -4807,7 +4809,9 @@ again:
>  break;
>  case NAL_PPS:
>  init_get_bits(&h->gb, ptr, bit_length);
> -ff_h264_decode_picture_parameter_set(h, bit_length);
> +ret = ff_h264_decode_picture_parameter_set(h, bit_length);
> +if (ret < 0)
> +goto end;

This might make sense but I think we error out later if the pps for the
current frame is not available so this probably shouldnt be fatal either

>  break;
>  case NAL_AUD:
>  case NAL_END_SEQUENCE:
> @@ -4824,7 +4828,9 @@ again:
>  }
>  
>  if (context_count == h->max_contexts) {
> -execute_decode_slices(h, context_count);
> +ret = execute_decode_slices(h, context_count);
> +if (ret < 0)
> +goto end;

no reason to stop decoding just because one slice is damaged unless
AV_EF_EXPLODE is set

>  context_count = 0;
>  }
>  
> @@ -4843,8 +4849,11 @@ again:
>  }
>  }
>  }
> -if (context_count)
> -execute_decode_slices(h, context_count);
> +if (context_count) {
> +ret = execute_decode_slices(h, context_count);
> +if (ret < 0)
> +goto end;
> +}

same

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


Re: [libav-devel] [PATCH 2/2] arm: Add EXTERN_ASM to the .func and .type declarations for exported symbols

2014-02-07 Thread Janne Grunau
On 2014-02-07 12:06:57 +0200, Martin Storsjö wrote:
> This makes the generated assembly more internally consistent,
> avoiding declaring two labels for the same function (for cases
> where EXTERN_ASM is empty) and not declaring a separate unprefixed
> label in other cases.
> 
> This also makes sure the .func and .type delcarations have the same
> prefix. They have previously not been used on the platforms
> that have prefixed symbols on arm (iOS), but gas-preprocessor
> has recently started using the .func declarations for adding
> .thumb_func declarations for such functions.
> ---
>  libavutil/arm/asm.S | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
> index 57efe97..f4523ea 100644
> --- a/libavutil/arm/asm.S
> +++ b/libavutil/arm/asm.S
> @@ -72,11 +72,14 @@ ELF .size   \name, . - \name
>  .align  \align
>  .if \export
>  .global EXTERN_ASM\name
> +ELF .type   EXTERN_ASM\name, %function
> +.func   EXTERN_ASM\name
>  EXTERN_ASM\name:
> -.endif
> +.else
>  ELF .type   \name, %function
>  .func   \name
>  \name:
> +.endif
>  .endm
>  
>  .macro  const   name, align=2

ok

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


Re: [libav-devel] [PATCH 1/2] arm: Add X() around all references to extern symbols

2014-02-07 Thread Janne Grunau
On 2014-02-07 12:06:56 +0200, Martin Storsjö wrote:
> Don't rely on the fact that an unprefixed label currently exists.
> ---
>  libavcodec/arm/fmtconvert_neon.S   |  2 +-
>  libavcodec/arm/h264idct_neon.S | 16 
>  libavcodec/arm/hpeldsp_armv6.S |  4 ++--
>  libavcodec/arm/mdct_neon.S |  2 +-
>  libavcodec/arm/mpegvideo_neon.S|  2 +-
>  libavcodec/arm/videodsp_armv5te.S  |  2 +-
>  libavcodec/arm/vp8dsp_armv6.S  | 16 
>  libavresample/arm/audio_convert_neon.S |  4 ++--
>  8 files changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/libavcodec/arm/fmtconvert_neon.S 
> b/libavcodec/arm/fmtconvert_neon.S
> index 41a095a..e11e82c 100644
> --- a/libavcodec/arm/fmtconvert_neon.S
> +++ b/libavcodec/arm/fmtconvert_neon.S
> @@ -70,7 +70,7 @@ function ff_float_to_int16_interleave_neon, export=1
>  cmp r3, #2
>  itt lt
>  ldrlt   r1, [r1]
> -blt ff_float_to_int16_neon
> +blt X(ff_float_to_int16_neon)
>  bne 4f
>  
>  ldr r3, [r1]
> diff --git a/libavcodec/arm/h264idct_neon.S b/libavcodec/arm/h264idct_neon.S
> index 3e5321c..f588f3e 100644
> --- a/libavcodec/arm/h264idct_neon.S
> +++ b/libavcodec/arm/h264idct_neon.S
> @@ -113,8 +113,8 @@ function ff_h264_idct_add16_neon, export=1
>  movne   lr,  #0
>  cmp lr,  #0
>  ite ne
> -adrne   lr,  ff_h264_idct_dc_add_neon + CONFIG_THUMB
> -adreq   lr,  ff_h264_idct_add_neon+ CONFIG_THUMB
> +adrne   lr,  X(ff_h264_idct_dc_add_neon) + CONFIG_THUMB
> +adreq   lr,  X(ff_h264_idct_add_neon)+ CONFIG_THUMB

does this still does the right thing when X(ff_h264_idct_add_neon) is
declared as .thumb_func when targeting ios? It probably does since
ff_h264_idct_add_neon should already be declared as thumb after my
'.func' -> '.thumb_func' patch in gas-preprocessor.

>  blx lr
>  2:  subsip,  ip,  #1
>  add r1,  r1,  #32
> @@ -138,8 +138,8 @@ function ff_h264_idct_add16intra_neon, export=1
>  cmp r8,  #0
>  ldrsh   r8,  [r1]
>  iteet   ne
> -adrne   lr,  ff_h264_idct_add_neon+ CONFIG_THUMB
> -adreq   lr,  ff_h264_idct_dc_add_neon + CONFIG_THUMB
> +adrne   lr,  X(ff_h264_idct_add_neon)+ CONFIG_THUMB
> +adreq   lr,  X(ff_h264_idct_dc_add_neon) + CONFIG_THUMB
>  cmpeq   r8,  #0
>  blxne   lr
>  subsip,  ip,  #1
> @@ -166,8 +166,8 @@ function ff_h264_idct_add8_neon, export=1
>  cmp r8,  #0
>  ldrsh   r8,  [r1]
>  iteet   ne
> -adrne   lr,  ff_h264_idct_add_neon+ CONFIG_THUMB
> -adreq   lr,  ff_h264_idct_dc_add_neon + CONFIG_THUMB
> +adrne   lr,  X(ff_h264_idct_add_neon)+ CONFIG_THUMB
> +adreq   lr,  X(ff_h264_idct_dc_add_neon) + CONFIG_THUMB
>  cmpeq   r8,  #0
>  blxne   lr
>  add r12, r12, #1
> @@ -388,8 +388,8 @@ function ff_h264_idct8_add4_neon, export=1
>  movne   lr,  #0
>  cmp lr,  #0
>  ite ne
> -adrne   lr,  ff_h264_idct8_dc_add_neon + CONFIG_THUMB
> -adreq   lr,  ff_h264_idct8_add_neon+ CONFIG_THUMB
> +adrne   lr,  X(ff_h264_idct8_dc_add_neon) + CONFIG_THUMB
> +adreq   lr,  X(ff_h264_idct8_add_neon)+ CONFIG_THUMB
>  blx lr
>  2:  subsr12, r12, #4
>  add r1,  r1,  #128
> diff --git a/libavcodec/arm/hpeldsp_armv6.S b/libavcodec/arm/hpeldsp_armv6.S
> index a030d42..f85c8cb 100644
> --- a/libavcodec/arm/hpeldsp_armv6.S
> +++ b/libavcodec/arm/hpeldsp_armv6.S
> @@ -23,11 +23,11 @@
>  .macro  call_2x_pixels  type, subp
>  function ff_\type\()_pixels16\subp\()_armv6, export=1
>  push{r0-r3, lr}
> -bl  ff_\type\()_pixels8\subp\()_armv6
> +bl  X(ff_\type\()_pixels8\subp\()_armv6)
>  pop {r0-r3, lr}
>  add r0,  r0,  #8
>  add r1,  r1,  #8
> -b   ff_\type\()_pixels8\subp\()_armv6
> +b   X(ff_\type\()_pixels8\subp\()_armv6)
>  endfunc
>  .endm
>  
> diff --git a/libavcodec/arm/mdct_neon.S b/libavcodec/arm/mdct_neon.S
> index 9f7cb46..bfe259c 100644
> --- a/libavcodec/arm/mdct_neon.S
> +++ b/libavcodec/arm/mdct_neon.S
> @@ -129,7 +129,7 @@ function ff_imdct_calc_neon, export=1
>  lsl r4,  r4,  r3
>  add r1,  r1,  r4
>  
> -bl  ff_imdct_half_neon
> +  

Re: [libav-devel] [PATCH] h264: give numbers to nalus

2014-02-06 Thread Janne Grunau
On 2014-02-07 00:28:32 +0100, Vittorio Giovara wrote:
> ---
> Mostly cosmetics, but quite useful when you don't have specs arounds.

and are too lazy to count ;)

purely cosmetic and ok

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


Re: [libav-devel] [PATCH] avplay: add support for seeking to chapter marks

2014-02-06 Thread Janne Grunau
On 2014-02-06 23:30:22 +0100, Tim Walker wrote:
> On 04 Feb 2014, at 22:34, Anton Khirnov  wrote:
> 
> > ---
> > This patch is dedicated to av500's tshirt
> > ---
> > avplay.c|   33 +
> > doc/avplay.texi |3 +++
> > 2 files changed, 36 insertions(+)
> 
> This sounds like a joke patch.

Why?

> Still, tested and it doesn't seem to work under OS X. Could be an SDL bug 
> though?

Probably related to the oddities of PgUp/PgDown mapping on Mac OS X.

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


Re: [libav-devel] [PATCH] vp8: fix PPC assembly and bilinear C code to work if src_stride != dst_stride.

2014-02-06 Thread Janne Grunau
On 2014-02-06 12:36:03 +0100, Luca Barbato wrote:
> On 06/02/14 12:21, Martin Storsjö wrote:
> > Can we push the plain C half of this commit first without waiting for
> > refactoring the PPC stuff?
> 
> Fine for me.

pushed the libavcodec//vp8dsp.c part

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


Re: [libav-devel] [PATCH 08/11] dcadsp: split synth_filter_float

2014-02-06 Thread Janne Grunau
On 2014-02-06 11:01:19 +0100, Christophe Gisquet wrote:
> 2014-02-06 Christophe Gisquet :
> > The goal is to avoid function calls within assembly which are a mess on x86.
> 
> 
> This patch should ideally be squashed with the previous but:
> - this is mostly an RFC;
> - this may impact other archs, so this patch may actually stay, but
> with the corresponding changes for said archs.

arm asm would have to be updated for this change but I'm not conviced
that we should do this. It's slightly faster on x86 but it'll slow down
arm.

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


Re: [libav-devel] [PATCH 02/11] x86: dcadsp: implement int8x8_fmul_int32

2014-02-06 Thread Janne Grunau
On 2014-02-06 16:21:49 +0100, Diego Biurrun wrote:
> On Thu, Feb 06, 2014 at 12:40:51AM +, Christophe Gisquet wrote:
> > --- /dev/null
> > +++ b/libavcodec/x86/dca.h
> > @@ -0,0 +1,56 @@
> > +/*
> > + * Copyright (c) 2012 Christophe Gisquet 
> 
> Happy new year?
> 
> > +#if HAVE_SSE2_INLINE
> > +# include "libavutil/x86/asm.h"
> > +# include "libavutil/mem.h"
> > +
> > +#undef  int8x8_fmul_int32
> > +static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int 
> > scale)
> > +{
> > +DECLARE_ALIGNED(16, static const uint32_t, inverse16) = 0x3D80;
> > +__asm__ volatile (
> > +"cvtsi2ss%2, %%xmm0 \n\t"
> > +"mulss   %3, %%xmm0 \n\t"
> > +# if HAVE_SSE4_INLINE
> > +"pmovsxbd 0(%1), %%xmm1 \n\t"
> > +"pmovsxbd 4(%1), %%xmm2 \n\t"
> > +# else
> > +"movq  (%1), %%xmm1 \n\t"
> > +"punpcklbw   %%xmm1, %%xmm1 \n\t"
> > +"movaps  %%xmm1, %%xmm2 \n\t"
> > +"punpcklwd   %%xmm1, %%xmm1 \n\t"
> > +"punpckhwd   %%xmm2, %%xmm2 \n\t"
> > +"psrad  $24, %%xmm1 \n\t"
> > +"psrad  $24, %%xmm2 \n\t"
> > +# endif
> > +"shufps  $0, %%xmm0, %%xmm0 \n\t"
> > +"cvtdq2ps%%xmm1, %%xmm1 \n\t"
> > +"cvtdq2ps%%xmm2, %%xmm2 \n\t"
> > +"mulps   %%xmm0, %%xmm1 \n\t"
> > +"mulps   %%xmm0, %%xmm2 \n\t"
> > +"movaps  %%xmm1,  0(%0) \n\t"
> > +"movaps  %%xmm2, 16(%0) \n\t"
> > +:: "r"(dst), "r"(src), "m"(scale), "m"(inverse16)
> > +XMM_CLOBBERS_ONLY("xmm0", "xmm1", "xmm2")
> > +);
> > +}
> > +#define int8x8_fmul_int32(dsp) int8x8_fmul_int32
> > +#endif /* HAVE_SSE2_INLINE */
> 
> Does this have to be inline assembly?

The function is very short so the function call overhead becomes
significant. 34 vs. 39 cycles on a cortex-a9, i.e. the inline version
is over 10% faster.

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


Re: [libav-devel] [PATCH 03/11] dcadsp: split lfe_dir cases

2014-02-06 Thread Janne Grunau
On 2014-02-06 17:27:17 +0100, Christophe Gisquet wrote:
> Hi,
> 
> 2014-02-06 Janne Grunau :
> > On 2014-02-06 00:40:52 +, Christophe Gisquet wrote:
> >> The x86 runs short on registers because numerous elements are not static.
> >> In addition, splitting them allows more optimized code, at least for x86.
> >
> > Can you expand on what gets better optimized if decifactor is constant?
> > I don't see anything for the arm neon versions.
> 
> Do you mean in the commit message?

No, this reply is enough, I was curious if there was an optimization
which would have justified splitting the neon version instead of
writing just a different prolog for one.

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


Re: [libav-devel] [PATCH 02/11] x86: dcadsp: implement int8x8_fmul_int32

2014-02-06 Thread Janne Grunau
On 2014-02-06 16:08:29 +0100, Christophe Gisquet wrote:
> 2014-02-06 Janne Grunau :
> > On 2014-02-06 00:40:51 +, Christophe Gisquet wrote:
> 
> Yes, as long as this header is included before dcadsp.h.
> 
> This will be rewritten anyway, following your proposal.
> 
> > just because HAVE_SSE4_INLINE is set, doesn't mean the target processor
> 
> I greped config.h and stumbled on this. I wrongly assumed this was the
> consequence of detecting whether e.g. -msse42 was passed to gcc via
> cflags.
> 
> But otherwise, if I understand correctly, this macro is only useful if
> someone writes inline asm.

I think it is only used to detect if the compiler/assembler is knows
those instruction. i.e. an old compiler might not know AVX instructions
Bad example since we aren't even testing that in configure.

gcc is to blame for it since it doesn't fail with -march=nocona -mno-sse4
on SSE4 instructions in inline asm statements.

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


Re: [libav-devel] [PATCH 03/11] dcadsp: split lfe_dir cases

2014-02-06 Thread Janne Grunau
On 2014-02-06 00:40:52 +, Christophe Gisquet wrote:
> The x86 runs short on registers because numerous elements are not static.
> In addition, splitting them allows more optimized code, at least for x86.

Can you expand on what gets better optimized if decifactor is constant?
I don't see anything for the arm neon versions.
> ---
>  libavcodec/arm/dcadsp_init_arm.c | 33 ++---
>  libavcodec/dcadec.c  | 10 +-
>  libavcodec/dcadsp.c  | 20 +---
>  libavcodec/dcadsp.h  |  4 ++--
>  4 files changed, 54 insertions(+), 13 deletions(-)
> 
> diff --git a/libavcodec/arm/dcadsp_init_arm.c 
> b/libavcodec/arm/dcadsp_init_arm.c
> index d49a176..905e4f9 100644
> --- a/libavcodec/arm/dcadsp_init_arm.c
> +++ b/libavcodec/arm/dcadsp_init_arm.c
> @@ -47,16 +47,43 @@ void ff_synth_filter_float_neon(FFTContext *imdct,
>  float out[32], const float in[32],
>  float scale);
>  
> +static void lfe_fir0_vfp(float *out, const float *in, const float *coefs,
> + float scale)
> +{
> +ff_dca_lfe_fir_vfp(out, in, coefs, 32, scale);
> +}
> +
> +static void lfe_fir1_vfp(float *out, const float *in, const float *coefs,
> + float scale)
> +{
> +ff_dca_lfe_fir_vfp(out, in, coefs, 64, scale);
> +}
> +
> +static void lfe_fir0_neon(float *out, const float *in, const float *coefs,
> +  float scale)
> +{
> +ff_dca_lfe_fir_neon(out, in, coefs, 32, scale);
> +}
> +
> +static void lfe_fir1_neon(float *out, const float *in, const float *coefs,
> +  float scale)
> +{
> +ff_dca_lfe_fir_neon(out, in, coefs, 64, scale);
> +}
> +

I'll update the arm asm and send a patch you can fold into this one.

>  av_cold void ff_dcadsp_init_arm(DCADSPContext *s)
>  {
>  int cpu_flags = av_get_cpu_flags();
>  
>  if (have_vfp(cpu_flags) && !have_vfpv3(cpu_flags)) {
> -s->lfe_fir = ff_dca_lfe_fir_vfp;
> +s->lfe_fir[0]  = lfe_fir0_vfp;
> +s->lfe_fir[1]  = lfe_fir1_vfp;
>  s->qmf_32_subbands = ff_dca_qmf_32_subbands_vfp;
>  }
> -if (have_neon(cpu_flags))
> -s->lfe_fir = ff_dca_lfe_fir_neon;
> +if (have_neon(cpu_flags)) {
> +s->lfe_fir[0] = lfe_fir0_neon;
> +s->lfe_fir[1] = lfe_fir1_neon;
> +}
>  }
>  
>  av_cold void ff_synth_filter_init_arm(SynthFilterContext *s)
> diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
> index c6d9be8..f40a693 100644
> --- a/libavcodec/dcadec.c
> +++ b/libavcodec/dcadec.c
> @@ -957,23 +957,23 @@ static void lfe_interpolation_fir(DCAContext *s, int 
> decimation_select,
>   * samples_out: An array holding interpolated samples
>   */
>  
> -int decifactor;
> +int idx;
>  const float *prCoeff;
>  int deciindex;
>  
>  /* Select decimation filter */
>  if (decimation_select == 1) {
> -decifactor = 64;
> +idx = 1;
>  prCoeff = lfe_fir_128;
>  } else {
> -decifactor = 32;
> +idx = 0;
>  prCoeff = lfe_fir_64;
>  }
>  /* Interpolation */
>  for (deciindex = 0; deciindex < num_deci_sample; deciindex++) {
> -s->dcadsp.lfe_fir(samples_out, samples_in, prCoeff, decifactor, 
> scale);
> +s->dcadsp.lfe_fir[idx](samples_out, samples_in, prCoeff, scale);
>  samples_in++;
> -samples_out += 2 * decifactor;
> +samples_out += 2 * 32 * (1 + idx);
>  }
>  }
>  
> diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c
> index 148f6dd..8d242c5 100644
> --- a/libavcodec/dcadsp.c
> +++ b/libavcodec/dcadsp.c
> @@ -32,8 +32,9 @@ static void int8x8_fmul_int32_c(float *dst, const int8_t 
> *src, int scale)
>  dst[i] = src[i] * fscale;
>  }
>  
> -static void dca_lfe_fir_c(float *out, const float *in, const float *coefs,
> -  int decifactor, float scale)
> +static inline void
> +dca_lfe_fir(float *out, const float *in, const float *coefs,
> +int decifactor, float scale)
>  {
>  float *out2 = out + decifactor;
>  const float *cf0 = coefs;
> @@ -82,9 +83,22 @@ static void dca_qmf_32_subbands(float samples_in[32][8], 
> int sb_act,
>  }
>  }
>  
> +static void dca_lfe_fir0_c(float *out, const float *in, const float *coefs,
> +   float scale)
> +{
> +dca_lfe_fir(out, in, coefs, 32, scale);
> +}
> +
> +static void dca_lfe_fir1_c(float *out, const float *in, const float *coefs,
> +   float scale)
> +{
> +dca_lfe_fir(out, in, coefs, 64, scale);
> +}
> +
>  av_cold void ff_dcadsp_init(DCADSPContext *s)
>  {
> -s->lfe_fir = dca_lfe_fir_c;
> +s->lfe_fir[0] = dca_lfe_fir0_c;
> +s->lfe_fir[1] = dca_lfe_fir1_c;
>  s->qmf_32_subbands = dca_qmf_32_subbands;
>  s->int8x8_fmul_int32 = int8x8_fmul_int32_c;
>  if (ARCH_ARM) ff_dcadsp_init_arm(s);
> diff --git a/liba

Re: [libav-devel] [PATCH 02/11] x86: dcadsp: implement int8x8_fmul_int32

2014-02-06 Thread Janne Grunau
On 2014-02-06 00:40:51 +, Christophe Gisquet wrote:
> For the callable function (as opposed to the inline one):
>  C  SSE  SSE2  SSE4
> Win32:  47   42   2926
> Win64:  30   33   2523
> The SSE version is neither compiled nor set for 64bits.

That are cpu cycles?

> When the proper compile macros are set (e.g. ARCH_X86_64 or HAVE_SSEx),
> the macro reverts to use the inline function.

No use of ARCH_X86_64 and HAVE_SSEx_INLINE unfortunately doesn't work
that way.

> ---
>  libavcodec/dcadec.c  |  3 ++
>  libavcodec/dcadsp.c  |  1 +
>  libavcodec/dcadsp.h  |  1 +
>  libavcodec/x86/Makefile  |  2 +
>  libavcodec/x86/dca.h | 56 +++
>  libavcodec/x86/dcadsp.asm| 90 
> 
>  libavcodec/x86/dcadsp_init.c | 47 +++
>  7 files changed, 200 insertions(+)
>  create mode 100644 libavcodec/x86/dca.h
>  create mode 100644 libavcodec/x86/dcadsp.asm
>  create mode 100644 libavcodec/x86/dcadsp_init.c
> 
> diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
> index a3ca02c..c6d9be8 100644
> --- a/libavcodec/dcadec.c
> +++ b/libavcodec/dcadec.c
> @@ -50,6 +50,9 @@
>  #if ARCH_ARM
>  #   include "arm/dca.h"
>  #endif
> +#if ARCH_X86
> +#   include "x86/dca.h"
> +#endif
>  
>  //#define TRACE
>  
> diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c
> index b984864..148f6dd 100644
> --- a/libavcodec/dcadsp.c
> +++ b/libavcodec/dcadsp.c
> @@ -88,4 +88,5 @@ av_cold void ff_dcadsp_init(DCADSPContext *s)
>  s->qmf_32_subbands = dca_qmf_32_subbands;
>  s->int8x8_fmul_int32 = int8x8_fmul_int32_c;
>  if (ARCH_ARM) ff_dcadsp_init_arm(s);
> +if (ARCH_X86) ff_dcadsp_init_x86(s);
>  }
> diff --git a/libavcodec/dcadsp.h b/libavcodec/dcadsp.h
> index 3feea9f..afe40c4 100644
> --- a/libavcodec/dcadsp.h
> +++ b/libavcodec/dcadsp.h
> @@ -39,5 +39,6 @@ typedef struct DCADSPContext {
>  
>  void ff_dcadsp_init(DCADSPContext *s);
>  void ff_dcadsp_init_arm(DCADSPContext *s);
> +void ff_dcadsp_init_x86(DCADSPContext *s);
>  
>  #endif /* AVCODEC_DCADSP_H */
> diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
> index 6f4935b..f985525 100644
> --- a/libavcodec/x86/Makefile
> +++ b/libavcodec/x86/Makefile
> @@ -4,6 +4,7 @@ OBJS   += x86/constants.o 
>   \
>  OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp_init.o
>  OBJS-$(CONFIG_AC3DSP)  += x86/ac3dsp_init.o
>  OBJS-$(CONFIG_CAVS_DECODER)+= x86/cavsdsp.o
> +OBJS-$(CONFIG_DCA_DECODER) += x86/dcadsp_init.o
>  OBJS-$(CONFIG_DCT) += x86/dct_init.o
>  OBJS-$(CONFIG_DNXHD_ENCODER)   += x86/dnxhdenc.o
>  OBJS-$(CONFIG_DSPUTIL) += x86/dsputil_init.o\
> @@ -54,6 +55,7 @@ YASM-OBJS  += x86/deinterlace.o 
> \
>  
>  YASM-OBJS-$(CONFIG_AAC_DECODER)+= x86/sbrdsp.o
>  YASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp.o
> +YASM-OBJS-$(CONFIG_DCA_DECODER)+= x86/dcadsp.o
>  YASM-OBJS-$(CONFIG_DCT)+= x86/dct32.o
>  YASM-OBJS-$(CONFIG_DSPUTIL)+= x86/dsputil.o \
>x86/fpel.o\
> diff --git a/libavcodec/x86/dca.h b/libavcodec/x86/dca.h
> new file mode 100644
> index 000..6aa8f9d
> --- /dev/null
> +++ b/libavcodec/x86/dca.h
> @@ -0,0 +1,56 @@
> +/*
> + * Copyright (c) 2012 Christophe Gisquet 
> + *
> + * This file is part of Libav.
> + *
> + * Libav is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * Libav is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with Libav; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +#if HAVE_SSE2_INLINE

see below, same as for HAVE_SSE4_INLINE applies, ARCH_X86_64 can be used
for the inline version.

> +# include "libavutil/x86/asm.h"
> +# include "libavutil/mem.h"
> +
> +#undef  int8x8_fmul_int32

this still looks backwards to me

> +static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int 
> scale)
> +{
> +DECLARE_ALIGNED(16, static const uint32_t, inverse16) = 0x3D80;
> +__asm__ volatile (
> +"cvtsi2ss%2, %%xmm0 \n\t"
> +"mulss   %3, %%xmm0 \n\t"
> +# if HAVE_SSE4_INLINE

just because HAVE_SSE4_INLINE is set, doesn't mean the target processor
supports it. The s

[libav-devel] [PATCH 1/1] dcadsp: add int8x8_fmul_int32 to dsp context

2014-02-06 Thread Janne Grunau
From: Christophe Gisquet 

On 2014-02-06 00:40:50 +, Christophe Gisquet wrote:
> It is currently declared as a macro who is set to inlinable functions,
> among which a Neon implementation.
>
> Add a DSP parameter to the macro, so that the implementation can either
> be an inline function, or a call to the function found in the context,
> which is the default.
>
> On an Arrandale CPU, gain for an SSE2 function of that inlining vs. a call:
> - Win32: 29 to 26 cycles
> - Win64: 25 to 23 cycles
> ---
>  libavcodec/arm/dca.h |  5 +++--
>  libavcodec/dcadec.c  | 16 +++-
>  libavcodec/dcadsp.c  |  9 +
>  libavcodec/dcadsp.h  |  4 
>  4 files changed, 19 insertions(+), 15 deletions(-)

I though more of something like below which is smaller and has imho
clearer preprocessor use.

Janne

---8<---
It is currently declared as a macro who is set to inlinable functions,
among which a Neon implementation.

Add a DSP parameter to the macro, so that the implementation can either
be an inline function, or a call to the function found in the context,
which is the default.

On an Arrandale CPU, gain for an SSE2 function of that inlining vs. a call:
- Win32: 29 to 26 cycles
- Win64: 25 to 23 cycles
---
 libavcodec/arm/dca.h |  3 ++-
 libavcodec/dcadec.c  | 10 --
 libavcodec/dcadsp.c  |  9 +
 libavcodec/dcadsp.h  |  1 +
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/libavcodec/arm/dca.h b/libavcodec/arm/dca.h
index 39ec2b6..f09f319 100644
--- a/libavcodec/arm/dca.h
+++ b/libavcodec/arm/dca.h
@@ -83,7 +83,8 @@ static inline int decode_blockcodes(int code1, int code2, int 
levels,
 #if HAVE_NEON_INLINE && HAVE_ASM_MOD_Y
 
 #define int8x8_fmul_int32 int8x8_fmul_int32
-static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int scale)
+static inline void int8x8_fmul_int32(DCADSPContext *dsp, float *dst,
+ const int8_t *src, int scale)
 {
 __asm__ ("vcvt.f32.s32 %2,  %2,  #4 \n"
  "vld1.8   {d0}, [%1,:64]   \n"
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index f9e39bc..b6df3b9 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -1086,12 +1086,10 @@ static const uint8_t abits_sizes[7]  = { 7, 10, 12, 13, 
15, 17, 19 };
 static const uint8_t abits_levels[7] = { 3,  5,  7,  9, 13, 17, 25 };
 
 #ifndef int8x8_fmul_int32
-static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int scale)
+static inline void int8x8_fmul_int32(DCADSPContext *dsp, float *dst,
+ const int8_t *src, int scale)
 {
-float fscale = scale / 16.0;
-int i;
-for (i = 0; i < 8; i++)
-dst[i] = src[i] * fscale;
+dsp->int8x8_fmul_int32(dst, src, scale);
 }
 #endif
 
@@ -1219,7 +1217,7 @@ static int dca_subsubframe(DCAContext *s, int 
base_channel, int block_index)
 s->debug_flag |= 0x01;
 }
 
-int8x8_fmul_int32(subband_samples[k][l],
+int8x8_fmul_int32(&s->dcadsp, subband_samples[k][l],
   &high_freq_vq[hfvq][subsubframe * 8],
   s->scale_factor[k][l][0]);
 }
diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c
index 57d716e..b984864 100644
--- a/libavcodec/dcadsp.c
+++ b/libavcodec/dcadsp.c
@@ -24,6 +24,14 @@
 #include "libavutil/intreadwrite.h"
 #include "dcadsp.h"
 
+static void int8x8_fmul_int32_c(float *dst, const int8_t *src, int scale)
+{
+float fscale = scale / 16.0;
+int i;
+for (i = 0; i < 8; i++)
+dst[i] = src[i] * fscale;
+}
+
 static void dca_lfe_fir_c(float *out, const float *in, const float *coefs,
   int decifactor, float scale)
 {
@@ -78,5 +86,6 @@ av_cold void ff_dcadsp_init(DCADSPContext *s)
 {
 s->lfe_fir = dca_lfe_fir_c;
 s->qmf_32_subbands = dca_qmf_32_subbands;
+s->int8x8_fmul_int32 = int8x8_fmul_int32_c;
 if (ARCH_ARM) ff_dcadsp_init_arm(s);
 }
diff --git a/libavcodec/dcadsp.h b/libavcodec/dcadsp.h
index ec88be7..0f79dd6 100644
--- a/libavcodec/dcadsp.h
+++ b/libavcodec/dcadsp.h
@@ -31,6 +31,7 @@ typedef struct DCADSPContext {
 int *synth_buf_offset, float synth_buf2[32],
 const float window[512], float *samples_out,
 float raXin[32], float scale);
+void (*int8x8_fmul_int32)(float *dst, const int8_t *src, int scale);
 } DCADSPContext;
 
 void ff_dcadsp_init(DCADSPContext *s);
-- 
1.8.5.3

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


Re: [libav-devel] [PATCH] vp8: Use 2 registers for dst_stride and src_stride in neon bilin filter.

2014-02-05 Thread Janne Grunau
On 2014-02-05 15:00:57 +0100, Christophe Gisquet wrote:
> Hi,
> 
> 2014-02-05 Martin Storsjö :
> > Based on a patch by Ronald S. Bultje.
> > ---
> > Updated as suggested by Janne, to not require pushing anything to
> > the stack.
> 
> That's not really an issue worthy of additional work, but with such
> patches, it may be interesting to know the impact of the fix
> speed-wise.

the penalty of the fix is not huge but it's meaningless. It doesn't make
sense to benchmark incorrect code. I can i"solve" every problem in a
small and constant amount of time incorrectly.

> For instance, this second patch looks like the right thing to do. But
> besides that, is there an actual/objective reason, e.g. number of
> cycles? (I guess they can vary significantly depending on
> architecture, cache/memory speed etc, but still...).

Number of cpu cycles/overall run time, and while those indeed vary for
different CPU the relative difference between two patches on the same
CPU differs not that much across systems.

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


Re: [libav-devel] [PATCH] vp8: Use 2 registers for dst_stride and src_stride in neon bilin filter.

2014-02-05 Thread Janne Grunau
On 2014-02-05 14:49:04 +0200, Martin Storsjö wrote:
> Based on a patch by Ronald S. Bultje.
> ---
> Updated as suggested by Janne, to not require pushing anything to
> the stack.
> ---
>  libavcodec/arm/vp8dsp_neon.S | 120 
> +--
>  1 file changed, 60 insertions(+), 60 deletions(-)

ok, I prefer this one, patch is smaller and clearer, and resulting code
is smaller too. This variant seems to be faster on a cortex-a9 if I can
trust my START/STOP_timer measurements (I'm not 100% convinced of that)
overall it doesn't make enough difference to measure it reliable.

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


[libav-devel] [PATCH 1/1] lavu: add missing log.h include in timer.h

2014-02-05 Thread Janne Grunau
---
 libavutil/timer.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavutil/timer.h b/libavutil/timer.h
index ea5c891..d2c5001 100644
--- a/libavutil/timer.h
+++ b/libavutil/timer.h
@@ -32,6 +32,8 @@
 
 #include "config.h"
 
+#include "log.h"
+
 #if   ARCH_ARM
 #   include "arm/timer.h"
 #elif ARCH_BFIN
-- 
1.8.5.3

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


Re: [libav-devel] [PATCH] vp8: use 2 registers for dst_stride and src_stride in neon bilin filter.

2014-02-05 Thread Janne Grunau
On 2014-02-05 12:18:34 +0200, Martin Storsjö wrote:
> From: "Ronald S. Bultje" 
> 
> ---
>  libavcodec/arm/vp8dsp_neon.S | 165 
> +++
>  1 file changed, 87 insertions(+), 78 deletions(-)

ok in the sense that the code does the right thing afterwards. It should
be possible to avoid pushing lr to the stack by reording rsb and vdup and
loading mx/my directly to r12. Not sure which variant would be faster on
which CPUs though.

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


[libav-devel] [PATCH 1/1] fate: force the simple idct for xvid custom matrix test

2014-02-04 Thread Janne Grunau
On 2014-02-04 22:54:51 +0100, Diego Biurrun wrote:
> On Fri, Jan 31, 2014 at 01:09:39PM +0100, Janne Grunau wrote:
> > fixes fate-xvid-custom-matrix on non-x86 architectures, suggestions
> > how to avoid the ugly $(FATE_XVID-yes-yes) are welcome.
> > --- a/tests/fate/xvid.mak
> > +++ b/tests/fate/xvid.mak
> > @@ -1,6 +1,9 @@
> > -fate-xvid-custom-matrix: CMD = framemd5 -i 
> > $(TARGET_SAMPLES)/mpeg4/xvid_vlc_trac7411.h263
> > +fate-xvid-custom-matrix: CMD = framemd5 -idct simple -i 
> > $(TARGET_SAMPLES)/mpeg4/xvid_vlc_trac7411.h263
> > +fate-xvid-idctmmx:   CMD = framemd5  -i 
> > $(TARGET_SAMPLES)/mpeg4/xvid_vlc_trac7411.h263
> >
> >  FATE_XVID-$(call DEMDEC, M4V, MPEG4) += fate-xvid-custom-matrix
> > -FATE_SAMPLES_AVCONV += $(FATE_XVID-yes)
> > +FATE_XVID-$(HAVE_MMX)-$(call DEMDEC, M4V, MPEG4) += fate-xvid-idctmmx
> >
> > -fate-xvid: $(FATE_XVID-yes)
> > +FATE_SAMPLES_AVCONV += $(FATE_XVID-yes) $(FATE_XVID-yes-yes)
> > +
> > +fate-xvid: $(FATE_XVID-yes) $(FATE_XVID-yes-yes)
>
> FATE_XVID-$(call ALLYES, HAVE_MMX M4V_DEMUXER MPEG4_DECODER) += 
> fate-xvid-idctmmx
>
> should avoid the yes-yes issue

ALLYES/XYES prepends a CONFIG_ to its arguments so it won't work with
HAVE_* and I don't think it would be a good idea to move that to every
caller of ALLYES. $(filter $(HAVE_MMX), $(call DEMDEC, M4V, MPEG4)) would
avoid the -yes-yes too.

The tests were also unstable due to CPUFLAGS, added -flags bitexact and
forced -cpuflags all to the xvid idct test.

Janne

---8<---
The original test without a forced idct is still useful since it tests
the switching of the idct algorithm/permutation on x86 with MMX. MMXext
or SSE2. Make sure the test runs only if MMX inline asm is available and
force -cpuflags to all.
Add the required bitexact flag for both tests.
---
 tests/fate/xvid.mak   |  5 -
 tests/ref/fate/xvid-custom-matrix | 40 +++
 tests/ref/fate/xvid-idctmmx   | 21 
 3 files changed, 45 insertions(+), 21 deletions(-)
 create mode 100644 tests/ref/fate/xvid-idctmmx

diff --git a/tests/fate/xvid.mak b/tests/fate/xvid.mak
index 50ab231..68f01b5 100644
--- a/tests/fate/xvid.mak
+++ b/tests/fate/xvid.mak
@@ -1,6 +1,9 @@
-fate-xvid-custom-matrix: CMD = framemd5 -i 
$(TARGET_SAMPLES)/mpeg4/xvid_vlc_trac7411.h263
+fate-xvid-custom-matrix: CMD = framemd5 -flags +bitexact -idct simple  -i 
$(TARGET_SAMPLES)/mpeg4/xvid_vlc_trac7411.h263
+fate-xvid-idctmmx:   CMD = framemd5 -flags +bitexact -cpuflags all -i 
$(TARGET_SAMPLES)/mpeg4/xvid_vlc_trac7411.h263
 
 FATE_XVID-$(call DEMDEC, M4V, MPEG4) += fate-xvid-custom-matrix
+FATE_XVID-$(filter $(HAVE_MMX_INLINE), $(call DEMDEC, M4V, MPEG4)) += 
fate-xvid-idctmmx
+
 FATE_SAMPLES_AVCONV += $(FATE_XVID-yes)
 
 fate-xvid: $(FATE_XVID-yes)
diff --git a/tests/ref/fate/xvid-custom-matrix 
b/tests/ref/fate/xvid-custom-matrix
index 9ad6298..0361389 100644
--- a/tests/ref/fate/xvid-custom-matrix
+++ b/tests/ref/fate/xvid-custom-matrix
@@ -1,21 +1,21 @@
 #tb 0: 1/25
-0,  1,  1,1,   622080, fec19d49e4433046ac5f7a9f3dff2078
-0,  2,  2,1,   622080, 77aa1a369ce3e180648eaccce95cb618
-0,  3,  3,1,   622080, d3ff08bc77e247a4b033d37ff780c2a2
-0,  4,  4,1,   622080, 362c6b7411f23134880b4ceeaf09aafb
-0,  5,  5,1,   622080, 52ba7f7611160ed9516a3b94dd889254
-0,  6,  6,1,   622080, e11bf4956dfa43a760cdb8a6c46201eb
-0,  7,  7,1,   622080, 5305b5775b9481b136e84c0f1c2c52c7
-0,  8,  8,1,   622080, 65510ff0135a41e5acc99071893c99b2
-0,  9,  9,1,   622080, cab3a8991f0d404bb42386efb430abc7
-0, 10, 10,1,   622080, b7a8305768527a9b54248e620a5e7117
-0, 11, 11,1,   622080, 67adbfe7c321a2a74244d2a268de598a
-0, 12, 12,1,   622080, 9bcaed10aa15b8a5278c5c4840cfb9c8
-0, 13, 13,1,   622080, 0e3065f441313496cb390ba1a6c92b11
-0, 14, 14,1,   622080, f741816f762c000fc6fa77d9d1d96cdc
-0, 15, 15,1,   622080, 259686747b597c168440d5cfe75cdfbf
-0, 16, 16,1,   622080, d37341f0bea41b6d0421e984cd079673
-0, 17, 17,1,   622080, 97428665f84e4364bdba768ad604bcdc
-0, 18, 18,1,   622080, 8c32ce967ee34df1ccbdf4e8b6aa8c8d
-0, 19, 19,1,   622080, 7fee903f21d29d6d8215fc04c8b3af34
-0, 20, 20,1,   622080, 3d67c55cc62f0308cd4549c7ac46081a
+0,  1,  1,1,   622080, 870e846b6b001d3e34fa87df96297e28
+0,  2,  2,1,   622080, de1a3dd9fcc32086ecdffd4591a8defa
+0,  3,  

Re: [libav-devel] [PATCH] [RFC] avformat: include additional framerates

2014-02-04 Thread Janne Grunau
On 2014-02-04 12:06:00 +0100, Vittorio Giovara wrote:
> ---
> 48 is the "high framerate" used in cinema, 25 and 50 are European framerate.
> Not sure it's worth to add 100 and 120 "high framerates" too.
> Vittorio
> 
>  libavformat/avformat.h |2 +-
>  libavformat/utils.c|3 ++-
>  libavformat/version.h  |2 +-
>  3 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 00380d7..26bd54d 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -712,7 +712,7 @@ typedef struct AVStream {
>  /**
>   * Stream information used internally by av_find_stream_info()
>   */
> -#define MAX_STD_TIMEBASES (60*12+5)
> +#define MAX_STD_TIMEBASES (60 * 12 + 8)
>  struct {
>  int nb_decoded_frames;
>  int found_decoder;
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index fca588b..0b71ad2 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -2177,7 +2177,8 @@ static int get_std_framerate(int i)
>  if (i < 60 * 12)
>  return (i + 1) * 1001;
>  else
> -return ((const int[]) { 24, 30, 60, 12, 15 })[i - 60 * 12] * 1000 * 
> 12;
> +return ((const int[]) { 24, 30, 60, 12, 15, 48, 25, 50 })
> +[i - 60 * 12] * 1000 * 12;

This doesn't match the description, adding them to this list results in
testing 48000/1001, 25000/1001 and 5/1001. 48, 25, and 50 fps are
already tested through ht ecounter based test. look how
get_std_framerate is used. Changing it to something less confusing is
probably a good idea.

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


[libav-devel] [RFC] fate: force the simple idct for xvid custom matrix test

2014-01-31 Thread Janne Grunau
fixes fate-xvid-custom-matrix on non-x86 architectures, suggestions
how to avoid the ugly $(FATE_XVID-yes-yes) are welcome.

Janne
---8<---

Run the original test only when MMX is available.
---
 tests/fate/xvid.mak   |  9 ++---
 tests/ref/fate/xvid-custom-matrix | 40 +++
 tests/ref/fate/xvid-idctmmx   | 21 
 3 files changed, 47 insertions(+), 23 deletions(-)
 create mode 100644 tests/ref/fate/xvid-idctmmx

diff --git a/tests/fate/xvid.mak b/tests/fate/xvid.mak
index 50ab231..7684a77 100644
--- a/tests/fate/xvid.mak
+++ b/tests/fate/xvid.mak
@@ -1,6 +1,9 @@
-fate-xvid-custom-matrix: CMD = framemd5 -i 
$(TARGET_SAMPLES)/mpeg4/xvid_vlc_trac7411.h263
+fate-xvid-custom-matrix: CMD = framemd5 -idct simple -i 
$(TARGET_SAMPLES)/mpeg4/xvid_vlc_trac7411.h263
+fate-xvid-idctmmx:   CMD = framemd5  -i 
$(TARGET_SAMPLES)/mpeg4/xvid_vlc_trac7411.h263
 
 FATE_XVID-$(call DEMDEC, M4V, MPEG4) += fate-xvid-custom-matrix
-FATE_SAMPLES_AVCONV += $(FATE_XVID-yes)
+FATE_XVID-$(HAVE_MMX)-$(call DEMDEC, M4V, MPEG4) += fate-xvid-idctmmx
 
-fate-xvid: $(FATE_XVID-yes)
+FATE_SAMPLES_AVCONV += $(FATE_XVID-yes) $(FATE_XVID-yes-yes)
+
+fate-xvid: $(FATE_XVID-yes) $(FATE_XVID-yes-yes)
diff --git a/tests/ref/fate/xvid-custom-matrix 
b/tests/ref/fate/xvid-custom-matrix
index 9ad6298..b357a5d 100644
--- a/tests/ref/fate/xvid-custom-matrix
+++ b/tests/ref/fate/xvid-custom-matrix
@@ -1,21 +1,21 @@
 #tb 0: 1/25
-0,  1,  1,1,   622080, fec19d49e4433046ac5f7a9f3dff2078
-0,  2,  2,1,   622080, 77aa1a369ce3e180648eaccce95cb618
-0,  3,  3,1,   622080, d3ff08bc77e247a4b033d37ff780c2a2
-0,  4,  4,1,   622080, 362c6b7411f23134880b4ceeaf09aafb
-0,  5,  5,1,   622080, 52ba7f7611160ed9516a3b94dd889254
-0,  6,  6,1,   622080, e11bf4956dfa43a760cdb8a6c46201eb
-0,  7,  7,1,   622080, 5305b5775b9481b136e84c0f1c2c52c7
-0,  8,  8,1,   622080, 65510ff0135a41e5acc99071893c99b2
-0,  9,  9,1,   622080, cab3a8991f0d404bb42386efb430abc7
-0, 10, 10,1,   622080, b7a8305768527a9b54248e620a5e7117
-0, 11, 11,1,   622080, 67adbfe7c321a2a74244d2a268de598a
-0, 12, 12,1,   622080, 9bcaed10aa15b8a5278c5c4840cfb9c8
-0, 13, 13,1,   622080, 0e3065f441313496cb390ba1a6c92b11
-0, 14, 14,1,   622080, f741816f762c000fc6fa77d9d1d96cdc
-0, 15, 15,1,   622080, 259686747b597c168440d5cfe75cdfbf
-0, 16, 16,1,   622080, d37341f0bea41b6d0421e984cd079673
-0, 17, 17,1,   622080, 97428665f84e4364bdba768ad604bcdc
-0, 18, 18,1,   622080, 8c32ce967ee34df1ccbdf4e8b6aa8c8d
-0, 19, 19,1,   622080, 7fee903f21d29d6d8215fc04c8b3af34
-0, 20, 20,1,   622080, 3d67c55cc62f0308cd4549c7ac46081a
+0,  1,  1,1,   622080, 9229a2630d7bcea68bb235b3f99e1778
+0,  2,  2,1,   622080, 2c140b6dde552bccb201118b3ccd3ba3
+0,  3,  3,1,   622080, 8eba2171b7e9fe370d4c3ac9e89144f6
+0,  4,  4,1,   622080, f963d1e9d00da5ec21f489ac2cd4456f
+0,  5,  5,1,   622080, 6c5d0e8fae1767c70da70011470ca06e
+0,  6,  6,1,   622080, 612653518f6d199ccc73d676cee13e2e
+0,  7,  7,1,   622080, 259479ee0eed6f7d605f316987388ad2
+0,  8,  8,1,   622080, 0a9c07b07b3f0cb516117e9948e1f4f7
+0,  9,  9,1,   622080, 5bc31efdf08efb03f58babadb7c485d5
+0, 10, 10,1,   622080, 7e93ef36e656d1a2af19977c9d2e88e4
+0, 11, 11,1,   622080, 5573174371188016f2a2be2398b6f630
+0, 12, 12,1,   622080, a7e6f44e75b9ea7abd43e0012a1217f4
+0, 13, 13,1,   622080, a0aebb85ac6ec3e0a5dfa8897e41f08c
+0, 14, 14,1,   622080, cd7e2b6023460df3cd5812976f2afb84
+0, 15, 15,1,   622080, 69839903514ae915fb87cf3ed0665f69
+0, 16, 16,1,   622080, 67304dd1db199f38d91442b007a1160a
+0, 17, 17,1,   622080, 57e848983ffb33b1817496fbea06a859
+0, 18, 18,1,   622080, 36b36b5d7a630b1b03c5b9333778c349
+0, 19, 19,1,   622080, 73327e61a8fa8a2b182092f2f8d182a9
+0, 20, 20,1,   622080, 6e146084467ab1bc21f043abb3624c3d
diff --git a/tests/ref/fate/xvid-idctmmx b/tests/ref/fate/xvid-idctmmx
new file mode 100644
index 000..9ad6298
--- /dev/null
+++ b/tests/ref/fate/xvid-idctmmx
@@ -0,0 +1,21 @@
+#tb 0: 1/25
+0,  1,  1,1,   622080, fec19d49e4433046ac5f7a9f3df

[libav-devel] [PATCH 1/1] x86: videodsp: Small speedups in ff_emulated_edge_mc x86 SIMD.

2014-01-31 Thread Janne Grunau
From: "Ronald S. Bultje" 

On 2014-01-30 16:58:26 +0100, Diego Biurrun wrote:
> On Thu, Jan 30, 2014 at 03:43:32PM +0100, Janne Grunau wrote:
> > --- a/libavcodec/x86/videodsp.asm
> > +++ b/libavcodec/x86/videodsp.asm
> > @@ -344,10 +344,6 @@ VERTICAL_EXTEND 16, 22
> >  movzx  vald, byte %2
> >  imul   vald, 0x01010101
> >  %if %1 >= 8
> > @@ -356,13 +352,15 @@ VERTICAL_EXTEND 16, 22
> >  %else
> >  punpckldqm0, m0
> > -%endif ; %1 >= 8
> > +%endif ; %1 > 16
>
> This does no longer match the %if above.

and by no longer you mean this patch contains a stray change that doesn't
make sense, removed.

Janne
---8<---
Do not use word-size multiplications if size == 2, and if we're using
SIMD instructions (size >= 8), complete leftover 4byte sets using movd,
not mov. Both of these changes lead to minor speedups.

Signed-off-by: Janne Grunau 
---
 libavcodec/x86/videodsp.asm | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/libavcodec/x86/videodsp.asm b/libavcodec/x86/videodsp.asm
index 53b9e82..41b99a2 100644
--- a/libavcodec/x86/videodsp.asm
+++ b/libavcodec/x86/videodsp.asm
@@ -344,10 +344,6 @@ VERTICAL_EXTEND 16, 22
 ; obviously not the same on both sides.
 
 %macro READ_V_PIXEL 2
-%if %1 == 2
-movzx  valw, byte %2
-imul   valw, 0x0101
-%else
 movzx  vald, byte %2
 imul   vald, 0x01010101
 %if %1 >= 8
@@ -356,13 +352,15 @@ VERTICAL_EXTEND 16, 22
 pshufd   m0, m0, q
 %else
 punpckldqm0, m0
-%endif
+%endif ; mmsize == 16
 %endif ; %1 >= 8
-%endif
 %endmacro ; READ_V_PIXEL
 
 %macro WRITE_V_PIXEL 2
 %assign %%off 0
+
+%if %1 >= 8
+
 %rep %1/mmsize
 movu [%2+%%off], m0
 %assign %%off %%off+mmsize
@@ -378,27 +376,29 @@ VERTICAL_EXTEND 16, 22
 %assign %%off %%off+8
 %endif
 %endif ; %1-%%off >= 8
-%endif
+%endif ; mmsize == 16
 
 %if %1-%%off >= 4
 %if %1 > 8 && %1-%%off > 4
 movq  [%2+%1-8], m0
 %assign %%off %1
-%elif %1 >= 8 && %1-%%off >= 4
-movd [%2+%%off], m0
-%assign %%off %%off+4
 %else
-mov  [%2+%%off], vald
+movd [%2+%%off], m0
 %assign %%off %%off+4
 %endif
 %endif ; %1-%%off >= 4
 
-%if %1-%%off >= 2
-%if %1 >= 8
-movd  [%2+%1-4], m0
-%else
+%else ; %1 < 8
+
+%rep %1/4
+mov  [%2+%%off], vald
+%assign %%off %%off+4
+%endrep ; %1/4
+
+%endif ; %1 >=/< 8
+
+%if %1-%%off == 2
 mov  [%2+%%off], valw
-%endif
 %endif ; (%1-%%off)/2
 %endmacro ; WRITE_V_PIXEL
 
-- 
1.8.5.3

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


[libav-devel] VideoDSP X86 asms

2014-01-30 Thread Janne Grunau
Hi,

videodsp uses SSE2 instructions in SSE code which results in crashes on
machines not support SSE2 but SSE like AMD's Athlon and theoretically
Pentium3. Patch 1 fixes the issue at hand (squashed from two patches).
Patch 2+3 are small changes which brings us up to date wrt to videodsp.asm.

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


[libav-devel] [PATCH 3/3] x86: videodsp: Small speedups in ff_emulated_edge_mc x86 SIMD.

2014-01-30 Thread Janne Grunau
From: "Ronald S. Bultje" 

Do not use word-size multiplications if size == 2, and if we're using
SIMD instructions (size >= 8), complete leftover 4byte sets using movd,
not mov. Both of these changes lead to minor speedups.

Signed-off-by: Janne Grunau 
---
 libavcodec/x86/videodsp.asm | 34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/libavcodec/x86/videodsp.asm b/libavcodec/x86/videodsp.asm
index 53b9e82..d8a7359 100644
--- a/libavcodec/x86/videodsp.asm
+++ b/libavcodec/x86/videodsp.asm
@@ -344,10 +344,6 @@ VERTICAL_EXTEND 16, 22
 ; obviously not the same on both sides.
 
 %macro READ_V_PIXEL 2
-%if %1 == 2
-movzx  valw, byte %2
-imul   valw, 0x0101
-%else
 movzx  vald, byte %2
 imul   vald, 0x01010101
 %if %1 >= 8
@@ -356,13 +352,15 @@ VERTICAL_EXTEND 16, 22
 pshufd   m0, m0, q
 %else
 punpckldqm0, m0
-%endif
-%endif ; %1 >= 8
-%endif
+%endif ; mmsize == 16
+%endif ; %1 > 16
 %endmacro ; READ_V_PIXEL
 
 %macro WRITE_V_PIXEL 2
 %assign %%off 0
+
+%if %1 >= 8
+
 %rep %1/mmsize
 movu [%2+%%off], m0
 %assign %%off %%off+mmsize
@@ -378,27 +376,29 @@ VERTICAL_EXTEND 16, 22
 %assign %%off %%off+8
 %endif
 %endif ; %1-%%off >= 8
-%endif
+%endif ; mmsize == 16
 
 %if %1-%%off >= 4
 %if %1 > 8 && %1-%%off > 4
 movq  [%2+%1-8], m0
 %assign %%off %1
-%elif %1 >= 8 && %1-%%off >= 4
-movd [%2+%%off], m0
-%assign %%off %%off+4
 %else
-mov  [%2+%%off], vald
+movd [%2+%%off], m0
 %assign %%off %%off+4
 %endif
 %endif ; %1-%%off >= 4
 
-%if %1-%%off >= 2
-%if %1 >= 8
-movd  [%2+%1-4], m0
-%else
+%else ; %1 < 8
+
+%rep %1/4
+mov  [%2+%%off], vald
+%assign %%off %%off+4
+%endrep ; %1/4
+
+%endif ; %1 >=/< 8
+
+%if %1-%%off == 2
 mov  [%2+%%off], valw
-%endif
 %endif ; (%1-%%off)/2
 %endmacro ; WRITE_V_PIXEL
 
-- 
1.8.5.3

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


libav-devel@libav.org

2014-01-30 Thread Janne Grunau
From: "Ronald S. Bultje" 

Signed-off-by: Janne Grunau 
---
 libavcodec/x86/videodsp.asm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/x86/videodsp.asm b/libavcodec/x86/videodsp.asm
index aceb77a..53b9e82 100644
--- a/libavcodec/x86/videodsp.asm
+++ b/libavcodec/x86/videodsp.asm
@@ -381,7 +381,7 @@ VERTICAL_EXTEND 16, 22
 %endif
 
 %if %1-%%off >= 4
-%if %1 > 8 %% %1-%%off > 4
+%if %1 > 8 && %1-%%off > 4
 movq  [%2+%1-8], m0
 %assign %%off %1
 %elif %1 >= 8 && %1-%%off >= 4
-- 
1.8.5.3

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


[libav-devel] [PATCH 1/3] x86: videodsp: Properly mark sse2 instructions in emulated_edge_mc as such.

2014-01-30 Thread Janne Grunau
From: "Ronald S. Bultje" 

Should fix crashes or corrupt output on pre-SSE2 CPUs when they were
using SSE2-code (e.g. AMD Athlon XP 2400+ or Intel Pentium III) in
hfix or hvar single-edge (left/right) extension functions.

Signed-off-by: Janne Grunau 
---
 libavcodec/x86/videodsp.asm| 72 +-
 libavcodec/x86/videodsp_init.c | 37 --
 2 files changed, 70 insertions(+), 39 deletions(-)

diff --git a/libavcodec/x86/videodsp.asm b/libavcodec/x86/videodsp.asm
index 59f1937..aceb77a 100644
--- a/libavcodec/x86/videodsp.asm
+++ b/libavcodec/x86/videodsp.asm
@@ -102,8 +102,8 @@ cglobal emu_edge_hvar, 5, 6, 1, dst, dst_stride, start_x, 
n_words, h, w
 imul wd, 0x01010101 ;   w *= 0x01010101
 movd m0, wd
 mov  wq, n_wordsq   ;   initialize w
-%if cpuflag(sse)
-shufps   m0, m0, q  ;   splat
+%if cpuflag(sse2)
+pshufd   m0, m0, q  ;   splat
 %else ; mmx
 punpckldqm0, m0 ;   splat
 %endif ; mmx/sse
@@ -124,7 +124,7 @@ INIT_MMX mmx
 hvar_fn
 %endif
 
-INIT_XMM sse
+INIT_XMM sse2
 hvar_fn
 
 ; macro to read/write a horizontal number of pixels (%2) to/from registers
@@ -137,42 +137,49 @@ hvar_fn
 ; - if (%2 & 3)  fills 1, 2 or 4 bytes in eax
 ; writing data out is in the same way
 %macro READ_NUM_BYTES 2
-%assign %%off 0 ; offset in source buffer
-%assign %%idx 0 ; mmx/xmm register index
+%assign %%off 0 ; offset in source buffer
+%assign %%mmx_idx 0 ; mmx register index
+%assign %%xmm_idx 0 ; xmm register index
 
 %rep %2/mmsize
-movu m %+ %%idx, [srcq+%%off]
+%if mmsize == 16
+movu   xmm %+ %%xmm_idx, [srcq+%%off]
+%assign %%xmm_idx %%xmm_idx+1
+%else ; mmx
+movumm %+ %%mmx_idx, [srcq+%%off]
+%assign %%mmx_idx %%mmx_idx+1
+%endif
 %assign %%off %%off+mmsize
-%assign %%idx %%idx+1
 %endrep ; %2/mmsize
 
 %if mmsize == 16
 %if (%2-%%off) >= 8
 %if %2 > 16 && (%2-%%off) > 8
-movu m %+ %%idx, [srcq+%2-16]
+movu   xmm %+ %%xmm_idx, [srcq+%2-16]
+%assign %%xmm_idx %%xmm_idx+1
 %assign %%off %2
 %else
-movq m %+ %%idx, [srcq+%%off]
+movqmm %+ %%mmx_idx, [srcq+%%off]
+%assign %%mmx_idx %%mmx_idx+1
 %assign %%off %%off+8
 %endif
-%assign %%idx %%idx+1
 %endif ; (%2-%%off) >= 8
 %endif
 
 %if (%2-%%off) >= 4
 %if %2 > 8 && (%2-%%off) > 4
-movq m %+ %%idx, [srcq+%2-8]
+movqmm %+ %%mmx_idx, [srcq+%2-8]
 %assign %%off %2
 %else
-movd m %+ %%idx, [srcq+%%off]
+movdmm %+ %%mmx_idx, [srcq+%%off]
 %assign %%off %%off+4
 %endif
-%assign %%idx %%idx+1
+%assign %%mmx_idx %%mmx_idx+1
 %endif ; (%2-%%off) >= 4
 
 %if (%2-%%off) >= 1
 %if %2 >= 4
-movd m %+ %%idx, [srcq+%2-4]
+movd mm %+ %%mmx_idx, [srcq+%2-4]
 %elif (%2-%%off) == 1
 movvalb, [srcq+%2-1]
 %elif (%2-%%off) == 2
@@ -180,48 +187,55 @@ hvar_fn
 %elifidn %1, body
 movvald, [srcq+%2-3]
 %else
-movd m %+ %%idx, [srcq+%2-3]
+movd mm %+ %%mmx_idx, [srcq+%2-3]
 %endif
 %endif ; (%2-%%off) >= 1
 %endmacro ; READ_NUM_BYTES
 
 %macro WRITE_NUM_BYTES 2
-%assign %%off 0 ; offset in destination buffer
-%assign %%idx 0 ; mmx/xmm register index
+%assign %%off 0 ; offset in destination buffer
+%assign %%mmx_idx 0 ; mmx register index
+%assign %%xmm_idx 0 ; xmm register index
 
 %rep %2/mmsize
-movu   [dstq+%%off], m %+ %%idx
+%if mmsize == 16
+movu   [dstq+%%off], xmm %+ %%xmm_idx
+%assign %%xmm_idx %%xmm_idx+1
+%else ; mmx
+movu   [dstq+%%off], mm %+ %%mmx_idx
+%assign %%mmx_idx %%mmx_idx+1
+%endif
 %assign %%off %%off+mmsize
-%assign %%idx %%idx+1
 %endrep ; %2/mmsize
 
 %if mmsize == 16
 %if (%2-%%off) >= 8
 %if %2 > 16 && (%2-%%off) > 8
-movu   [dstq+%2-16], m %+ %%idx
+movu   [dstq+%2-16], xmm %+ %%xmm_idx
+%assign %%xmm_idx %%xmm_idx+1
 %assign %%off %2
 %else
-movq   [dstq+%%off], m %+ %%idx
+movq   [dstq+%%off], mm %+ %%mmx_idx
+%assign %%mmx_idx %%mmx_idx+1
 %assign %%off %%off+8
 %endif
-%assign %%idx %%idx+1
 %endif ; (%2-%%off) >= 8
 %endif
 
 %if (%2-%%off) >= 4
 %if %2 > 8 && (%2-%%off) > 4
-movq[dstq+%2-8], m %+ %%idx
+movq[dstq+%2-8], mm %+ %%mmx_idx
 %assign %%off %2
 %else
-movd   [dstq+%%off], m %+ %%idx
+movd   [dstq+%%off], mm %+ %%mmx_idx
 %assign %%off %%off+4
 %endif
-%assign %%idx %%idx+1
+%assign %%mmx_idx %%mmx_idx+1
 %endif ; (%2-%%off) >= 4
 
 %if (%2-%%off) >= 1
 %if %2 >= 4
-movd[dstq+%2-4], m %+ %%idx
+movd[dstq+%2-4], mm %+ %%mmx_idx
 %elif (%2-%%off) == 1
 mov [dstq+%2-1], valb
 %elif (%2-%%off) == 2
@@ -231,7 +245,7 @@ hvar_fn
 shrvald, 16
 mov [dstq+%2-1], valb
 %else
-movd   vald, m %+ %%idx
+movd   vald, mm %+ %%mmx_idx
 mov [dstq+%2-3], valw
 s

Re: [libav-devel] [PATCH 1/2] xvid: switch to xvid mmx idct as soon as possible

2014-01-29 Thread Janne Grunau
On 2014-01-29 18:46:43 +0100, Luca Barbato wrote:
> On 29/01/14 18:39, Janne Grunau wrote:
> > The idct implementation cannot be changed after the quantization matrices
> > are read since it use a different permutaion.
> > 
> > Fixes https://trac.videolan.org/vlc/ticket/7411
> > ---
> >  libavcodec/mpeg4videodec.c | 58 
> > +++---
> >  1 file changed, 29 insertions(+), 29 deletions(-)
> > 
> 
> Probably it is also stable-worthy.

no, looks totoally different in all release branches since those do not
include
https://git.libav.org/?p=libav.git;a=commitdiff;h=b452d5ae866942cec00aa1432fe29498b38b49fc

The stable release could be probably better fixed by not using the xvid
idct.

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


[libav-devel] [PATCH 2/2] fate: add xvid test for custom matrices

2014-01-29 Thread Janne Grunau
Test sample is made from the sample in
https://trac.videolan.org/vlc/ticket/7411
---
 tests/Makefile|  1 +
 tests/fate/xvid.mak   |  6 ++
 tests/ref/fate/xvid-custom-matrix | 21 +
 3 files changed, 28 insertions(+)
 create mode 100644 tests/fate/xvid.mak
 create mode 100644 tests/ref/fate/xvid-custom-matrix

diff --git a/tests/Makefile b/tests/Makefile
index ef0bdb4..004b44c 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -108,6 +108,7 @@ include $(SRC_PATH)/tests/fate/vpx.mak
 include $(SRC_PATH)/tests/fate/vqf.mak
 include $(SRC_PATH)/tests/fate/wavpack.mak
 include $(SRC_PATH)/tests/fate/wma.mak
+include $(SRC_PATH)/tests/fate/xvid.mak
 
 FATE_AVCONV += $(FATE_AVCONV-yes)
 FATE-$(CONFIG_AVCONV) += $(FATE_AVCONV)
diff --git a/tests/fate/xvid.mak b/tests/fate/xvid.mak
new file mode 100644
index 000..2b6f264
--- /dev/null
+++ b/tests/fate/xvid.mak
@@ -0,0 +1,6 @@
+fate-xvid-custom-matrix: CMD = framemd5 -i 
$(TARGET_SAMPLES)/mpeg4/xvid_vlc_trac7411.h263
+
+FATE_XVID-$(call DEMDEC, M4V, MPEG4) += fate-xvid-custom-matrix
+FATE_SAMPLES_AVCONV += $(FATE_XVID-yes)
+
+fate-xvid: $(FATE_XVID-yes)
\ No newline at end of file
diff --git a/tests/ref/fate/xvid-custom-matrix 
b/tests/ref/fate/xvid-custom-matrix
new file mode 100644
index 000..9ad6298
--- /dev/null
+++ b/tests/ref/fate/xvid-custom-matrix
@@ -0,0 +1,21 @@
+#tb 0: 1/25
+0,  1,  1,1,   622080, fec19d49e4433046ac5f7a9f3dff2078
+0,  2,  2,1,   622080, 77aa1a369ce3e180648eaccce95cb618
+0,  3,  3,1,   622080, d3ff08bc77e247a4b033d37ff780c2a2
+0,  4,  4,1,   622080, 362c6b7411f23134880b4ceeaf09aafb
+0,  5,  5,1,   622080, 52ba7f7611160ed9516a3b94dd889254
+0,  6,  6,1,   622080, e11bf4956dfa43a760cdb8a6c46201eb
+0,  7,  7,1,   622080, 5305b5775b9481b136e84c0f1c2c52c7
+0,  8,  8,1,   622080, 65510ff0135a41e5acc99071893c99b2
+0,  9,  9,1,   622080, cab3a8991f0d404bb42386efb430abc7
+0, 10, 10,1,   622080, b7a8305768527a9b54248e620a5e7117
+0, 11, 11,1,   622080, 67adbfe7c321a2a74244d2a268de598a
+0, 12, 12,1,   622080, 9bcaed10aa15b8a5278c5c4840cfb9c8
+0, 13, 13,1,   622080, 0e3065f441313496cb390ba1a6c92b11
+0, 14, 14,1,   622080, f741816f762c000fc6fa77d9d1d96cdc
+0, 15, 15,1,   622080, 259686747b597c168440d5cfe75cdfbf
+0, 16, 16,1,   622080, d37341f0bea41b6d0421e984cd079673
+0, 17, 17,1,   622080, 97428665f84e4364bdba768ad604bcdc
+0, 18, 18,1,   622080, 8c32ce967ee34df1ccbdf4e8b6aa8c8d
+0, 19, 19,1,   622080, 7fee903f21d29d6d8215fc04c8b3af34
+0, 20, 20,1,   622080, 3d67c55cc62f0308cd4549c7ac46081a
-- 
1.8.5.3

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


[libav-devel] [PATCH 1/2] xvid: switch to xvid mmx idct as soon as possible

2014-01-29 Thread Janne Grunau
The idct implementation cannot be changed after the quantization matrices
are read since it use a different permutaion.

Fixes https://trac.videolan.org/vlc/ticket/7411
---
 libavcodec/mpeg4videodec.c | 58 +++---
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 0e41548..b6925ac 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -2044,6 +2044,35 @@ static int decode_user_data(Mpeg4DecContext *ctx, 
GetBitContext *gb)
 if (e == 1)
 ctx->xvid_build = build;
 
+if (ctx->xvid_build == -1 && ctx->divx_version == -1 && ctx->lavc_build == 
-1) {
+if (s->stream_codec_tag == AV_RL32("XVID") ||
+s->codec_tag== AV_RL32("XVID") ||
+s->codec_tag== AV_RL32("XVIX") ||
+s->codec_tag== AV_RL32("RMP4") ||
+s->codec_tag== AV_RL32("ZMP4") ||
+s->codec_tag== AV_RL32("SIPP"))
+ctx->xvid_build = 0;
+}
+
+if (ctx->xvid_build == -1 && ctx->divx_version == -1 && ctx->lavc_build == 
-1)
+if (s->codec_tag == AV_RL32("DIVX") && s->vo_type == 0 &&
+s->vol_control_parameters == 0)
+ctx->divx_version = 400;  // divx 4
+
+if (ctx->xvid_build >= 0 && ctx->divx_version >= 0) {
+ctx->divx_version =
+ctx->divx_build   = -1;
+}
+
+#if HAVE_MMX
+if (ctx->xvid_build >= 0&&
+s->avctx->idct_algo == FF_IDCT_AUTO &&
+(av_get_cpu_flags() & AV_CPU_FLAG_MMX)) {
+s->avctx->idct_algo = FF_IDCT_XVIDMMX;
+ff_dct_common_init(s);
+}
+#endif
+
 return 0;
 }
 
@@ -2405,26 +2434,6 @@ end:
 s->low_delay = 1;
 s->avctx->has_b_frames = !s->low_delay;
 
-if (ctx->xvid_build == -1 && ctx->divx_version == -1 && ctx->lavc_build == 
-1) {
-if (s->stream_codec_tag == AV_RL32("XVID") ||
-s->codec_tag== AV_RL32("XVID") ||
-s->codec_tag== AV_RL32("XVIX") ||
-s->codec_tag== AV_RL32("RMP4") ||
-s->codec_tag== AV_RL32("ZMP4") ||
-s->codec_tag== AV_RL32("SIPP"))
-ctx->xvid_build = 0;
-}
-
-if (ctx->xvid_build == -1 && ctx->divx_version == -1 && ctx->lavc_build == 
-1)
-if (s->codec_tag == AV_RL32("DIVX") && s->vo_type == 0 &&
-s->vol_control_parameters == 0)
-ctx->divx_version = 400;  // divx 4
-
-if (ctx->xvid_build >= 0 && ctx->divx_version >= 0) {
-ctx->divx_version =
-ctx->divx_build   = -1;
-}
-
 if (s->workaround_bugs & FF_BUG_AUTODETECT) {
 if (s->codec_tag == AV_RL32("XVIX"))
 s->workaround_bugs |= FF_BUG_XVID_ILACE;
@@ -2475,15 +2484,6 @@ end:
 s->workaround_bugs |= FF_BUG_HPEL_CHROMA;
 }
 
-#if HAVE_MMX
-if (s->codec_id == AV_CODEC_ID_MPEG4 && ctx->xvid_build >= 0 &&
-s->avctx->idct_algo == FF_IDCT_AUTO &&
-(av_get_cpu_flags() & AV_CPU_FLAG_MMX)) {
-s->avctx->idct_algo = FF_IDCT_XVIDMMX;
-ff_dct_common_init(s);
-s->picture_number = 0;
-}
-#endif
 
 if (s->avctx->debug & FF_DEBUG_BUGS)
 av_log(s->avctx, AV_LOG_DEBUG,
-- 
1.8.5.3

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


Re: [libav-devel] [PATCH] avformat: utils: Refactor duplicated PRINT macro

2014-01-29 Thread Janne Grunau
On 2014-01-29 17:05:43 +0100, Diego Biurrun wrote:
> ---
> 
> Now with the improved name suggested by Janne.
> 
>  libavformat/utils.c |   54 
> ++-
>  1 file changed, 23 insertions(+), 31 deletions(-)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index a0e81a8..eaedf74 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -3008,11 +3008,7 @@ fail:
>  return -1;
>  }
>  
> -static void hex_dump_internal(void *avcl, FILE *f, int level,
> -  const uint8_t *buf, int size)
> -{
> -int len, i, j, c;
> -#define PRINT(...)  \
> +#define HEXDUMP_PRINT(...)  \
>  do {\
>  if (!f) \
>  av_log(avcl, level, __VA_ARGS__);   \
> @@ -3020,27 +3016,31 @@ static void hex_dump_internal(void *avcl, FILE *f, 
> int level,
>  fprintf(f, __VA_ARGS__);\
>  } while (0)
>  
> +static void hex_dump_internal(void *avcl, FILE *f, int level,
> +  const uint8_t *buf, int size)
> +{
> +int len, i, j, c;
> +
>  for (i = 0; i < size; i += 16) {
>  len = size - i;
>  if (len > 16)
>  len = 16;
> -PRINT("%08x ", i);
> +HEXDUMP_PRINT("%08x ", i);
>  for (j = 0; j < 16; j++) {
>  if (j < len)
> -PRINT(" %02x", buf[i + j]);
> +HEXDUMP_PRINT(" %02x", buf[i + j]);
>  else
> -PRINT("   ");
> +HEXDUMP_PRINT("   ");
>  }
> -PRINT(" ");
> +HEXDUMP_PRINT(" ");
>  for (j = 0; j < len; j++) {
>  c = buf[i + j];
>  if (c < ' ' || c > '~')
>  c = '.';
> -PRINT("%c", c);
> +HEXDUMP_PRINT("%c", c);
>  }
> -PRINT("\n");
> +HEXDUMP_PRINT("\n");
>  }
> -#undef PRINT
>  }
>  
>  void av_hex_dump(FILE *f, const uint8_t *buf, int size)
> @@ -3056,31 +3056,23 @@ void av_hex_dump_log(void *avcl, int level, const 
> uint8_t *buf, int size)
>  static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt,
>int dump_payload, AVRational time_base)
>  {
> -#define PRINT(...)  \
> -do {\
> -if (!f) \
> -av_log(avcl, level, __VA_ARGS__);   \
> -else\
> -fprintf(f, __VA_ARGS__);\
> -} while (0)
> -PRINT("stream #%d:\n", pkt->stream_index);
> -PRINT("  keyframe=%d\n", ((pkt->flags & AV_PKT_FLAG_KEY) != 0));
> -PRINT("  duration=%0.3f\n", pkt->duration * av_q2d(time_base));
> +HEXDUMP_PRINT("stream #%d:\n", pkt->stream_index);
> +HEXDUMP_PRINT("  keyframe=%d\n", (pkt->flags & AV_PKT_FLAG_KEY) != 0);
> +HEXDUMP_PRINT("  duration=%0.3f\n", pkt->duration * av_q2d(time_base));
>  /* DTS is _always_ valid after av_read_frame() */
> -PRINT("  dts=");
> +HEXDUMP_PRINT("  dts=");
>  if (pkt->dts == AV_NOPTS_VALUE)
> -PRINT("N/A");
> +HEXDUMP_PRINT("N/A");
>  else
> -PRINT("%0.3f", pkt->dts * av_q2d(time_base));
> +HEXDUMP_PRINT("%0.3f", pkt->dts * av_q2d(time_base));
>  /* PTS may not be known if B-frames are present. */
> -PRINT("  pts=");
> +HEXDUMP_PRINT("  pts=");
>  if (pkt->pts == AV_NOPTS_VALUE)
> -PRINT("N/A");
> +HEXDUMP_PRINT("N/A");
>  else
> -PRINT("%0.3f", pkt->pts * av_q2d(time_base));
> -PRINT("\n");
> -PRINT("  size=%d\n", pkt->size);
> -#undef PRINT
> +HEXDUMP_PRINT("%0.3f", pkt->pts * av_q2d(time_base));
> +HEXDUMP_PRINT("\n");
> +HEXDUMP_PRINT("  size=%d\n", pkt->size);
>  if (dump_payload)
>  av_hex_dump(f, pkt->data, pkt->size);
>  }

ok

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


Re: [libav-devel] [PATCH] mpeg: Drop unused parameters from ff_draw_horiz_band()

2014-01-29 Thread Janne Grunau
On 2014-01-29 14:14:46 +0100, Diego Biurrun wrote:
> ---
>  libavcodec/mpegvideo.c | 10 --
>  libavcodec/mpegvideo.h |  7 +++
>  libavcodec/svq3.c  |  5 +++--
>  3 files changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
> index 7b66568..d26bcbe 100644
> --- a/libavcodec/mpegvideo.c
> +++ b/libavcodec/mpegvideo.c
> @@ -2338,10 +2338,9 @@ void ff_MPV_decode_mb(MpegEncContext *s, int16_t 
> block[12][64]){
>  /**
>   * @param h is the normal height, this will be reduced automatically if 
> needed for the last row
>   */
> -void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur,
> +void ff_draw_horiz_band(AVCodecContext *avctx, Picture *cur,
>  Picture *last, int y, int h, int picture_structure,
> -int first_field, int low_delay,
> -int v_edge_pos, int h_edge_pos)
> +int first_field, int low_delay)
>  {
>  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
>  int vshift = desc->log2_chroma_h;
> @@ -2390,10 +2389,9 @@ void ff_draw_horiz_band(AVCodecContext *avctx, 
> DSPContext *dsp, Picture *cur,
>  
>  void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
>  {
> -ff_draw_horiz_band(s->avctx, &s->dsp, &s->current_picture,
> +ff_draw_horiz_band(s->avctx, &s->current_picture,
> &s->last_picture, y, h, s->picture_structure,
> -   s->first_field, s->low_delay,
> -   s->v_edge_pos, s->h_edge_pos);
> +   s->first_field, s->low_delay);
>  }
>  
>  void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename
> diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
> index 1c7248e..2d37860 100644
> --- a/libavcodec/mpegvideo.h
> +++ b/libavcodec/mpegvideo.h
> @@ -810,10 +810,9 @@ void ff_MPV_common_init_x86(MpegEncContext *s);
>  void ff_MPV_common_init_arm(MpegEncContext *s);
>  void ff_MPV_common_init_ppc(MpegEncContext *s);
>  void ff_clean_intra_table_entries(MpegEncContext *s);
> -void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur,
> -Picture *last, int y, int h, int picture_structure,
> -int first_field, int low_delay,
> -int v_edge_pos, int h_edge_pos);
> +void ff_draw_horiz_band(AVCodecContext *avctx, Picture *cur, Picture *last,
> +int y, int h, int picture_structure, int first_field,
> +int low_delay);
>  void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h);
>  void ff_mpeg_flush(AVCodecContext *avctx);
>  void ff_print_debug_info(MpegEncContext *s, Picture *p);
> diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
> index 894180b..638c2b7 100644
> --- a/libavcodec/svq3.c
> +++ b/libavcodec/svq3.c
> @@ -1271,9 +1271,10 @@ static int svq3_decode_frame(AVCodecContext *avctx, 
> void *data,
>  (h->pict_type == AV_PICTURE_TYPE_P && mb_type < 8) ? 
> (mb_type - 1) : -1;
>  }
>  
> -ff_draw_horiz_band(avctx, NULL, s->cur_pic, s->last_pic->f.data[0] ? 
> s->last_pic : NULL,
> +ff_draw_horiz_band(avctx, s->cur_pic,
> +   s->last_pic->f.data[0] ? s->last_pic : NULL,
> 16 * h->mb_y, 16, h->picture_structure, 0,
> -   h->low_delay, h->mb_height * 16, h->mb_width * 
> 16);
> +   h->low_delay);
>  }
>  
>  if (h->pict_type == AV_PICTURE_TYPE_B || h->low_delay)

ok

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


[libav-devel] [PATCH 1/1] lavf: include 60 fps in guessed standard frame rates

2014-01-29 Thread Janne Grunau
Due to what looks like an off-by-one error 60 * 12 * 1001 / 12 * 1001
is not tested as standard frame rate in avformat_find_stream_info().
---
 libavformat/utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index a0e81a8..e4c38a0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2175,7 +2175,7 @@ static void compute_chapters_end(AVFormatContext *s)
 static int get_std_framerate(int i)
 {
 if (i < 60 * 12)
-return i * 1001;
+return (i + 1) * 1001;
 else
 return ((const int[]) { 24, 30, 60, 12, 15 })[i - 60 * 12] * 1000 * 12;
 }
@@ -2458,7 +2458,7 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
 
 /* Round guessed framerate to a "standard" framerate if it's
  * within 1% of the original estimate. */
-for (j = 1; j < MAX_STD_TIMEBASES; j++) {
+for (j = 0; j < MAX_STD_TIMEBASES; j++) {
 AVRational std_fps = { get_std_framerate(j), 12 * 1001 };
 double error   = fabs(av_q2d(st->avg_frame_rate) /
   av_q2d(std_fps) - 1);
-- 
1.8.5.3

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


[libav-devel] [PATCH 1/1] movdec: report 180 degree rotation as metadata

2014-01-29 Thread Janne Grunau
From: Dave Badia 

stupid me, forgot to rebase for av_dict_set
Signed-off-by: Janne Grunau 
---
 libavformat/mov.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index dc5b42b..8b661e9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2253,6 +2253,10 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 sc->width = width >> 16;
 sc->height = height >> 16;
 
+if (display_matrix[0][0] == -65536 && display_matrix[1][1] == -65536) {
+ av_dict_set(&st->metadata, "rotate", "180", 0);
+}
+
 // transform the display width/height according to the matrix
 // skip this if the display matrix is the default identity matrix
 // or if it is rotating the picture, ex iPhone 3GS
-- 
1.8.5.3

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


[libav-devel] [PATCH 2/2] movdec: report 90 and 270 degrees clockwise rotation too

2014-01-29 Thread Janne Grunau
From: Piotr Tomasik 

Signed-off-by: Janne Grunau 
---
 libavformat/mov.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5b444ab..333995e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2253,10 +2253,21 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 sc->width = width >> 16;
 sc->height = height >> 16;
 
+/* Assign clockwise rotate values based on transform matrix so that
+ * we can compensate for iPhone orientation during capture. */
+
+if (display_matrix[1][0] == -65536 && display_matrix[0][1] == 65536) {
+ av_dict_set(&st->metadata, "rotate", "90", 0);
+}
+
 if (display_matrix[0][0] == -65536 && display_matrix[1][1] == -65536) {
  av_metadata_set2(&st->metadata, "rotate", "180", 0);
 }
 
+if (display_matrix[1][0] == 65536 && display_matrix[0][1] == -65536) {
+ av_dict_set(&st->metadata, "rotate", "270", 0);
+}
+
 // transform the display width/height according to the matrix
 // skip this if the display matrix is the default identity matrix
 // or if it is rotating the picture, ex iPhone 3GS
-- 
1.8.5.3

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


[libav-devel] [PATCH 1/2] movdec: report 180 degree rotation as metadata

2014-01-29 Thread Janne Grunau
From: Dave Badia 

Signed-off-by: Janne Grunau 
---
 libavformat/mov.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index dc5b42b..5b444ab 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2253,6 +2253,10 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 sc->width = width >> 16;
 sc->height = height >> 16;
 
+if (display_matrix[0][0] == -65536 && display_matrix[1][1] == -65536) {
+ av_metadata_set2(&st->metadata, "rotate", "180", 0);
+}
+
 // transform the display width/height according to the matrix
 // skip this if the display matrix is the default identity matrix
 // or if it is rotating the picture, ex iPhone 3GS
-- 
1.8.5.3

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


Re: [libav-devel] [PATCH 1/1] mpeg12: check scantable indeces in all decode_block functions

2014-01-26 Thread Janne Grunau
On 2014-01-25 22:36:31 +0100, Luca Barbato wrote:
> On 25/01/14 21:06, Luca Barbato wrote:
> > On 24/01/14 17:20, Janne Grunau wrote:
> >>
> >> Adds checks to the fast functions used with CODEC_FLAGS2_FAST and moves
> >> the check for all other functions to before the invalid memory is
> >> accessed. Fixes https://trac.videolan.org/vlc/ticket/9713 with
> >> CODEC_FLAGS2_FAST.
> >>
> > 
> > Looks fine to me.
> 
> Wait, the ticket reference seems wrong.

Yes, should have been https://trac.videolan.org/vlc/ticket/10451 but 9713
seems to be related.

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


Re: [libav-devel] [PATCH 1/1] configure: add missing x86 dependency for i686

2014-01-26 Thread Janne Grunau
On 2014-01-26 16:02:44 +0100, Diego Biurrun wrote:
> On Sat, Jan 25, 2014 at 04:56:34PM +0100, Janne Grunau wrote:
> > --- a/configure
> > +++ b/configure
> > @@ -1561,6 +1561,7 @@ x86_64_suggest="fast_cmov"
> >  
> >  amd3dnow_deps="mmx"
> >  amd3dnowext_deps="amd3dnow"
> > +i686_deps="x86"
> >  mmx_deps="x86"
> >  mmxext_deps="mmx"
> >  sse_deps="mmxext"
> 
> Move it to the group above this one, the section you placed this in
> is for SIMD extensions.

already pushed

> Does this fix a problem?

It shouldn't, the only use of it is currently in libavcodec/x86 but all
other arch extensions have a dependency on their arch. It looked strange
to have I686 enabled config.h,mak for an arm build.

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


[libav-devel] [PATCH 1/1] configure: clang: explicitly state dep file and rule name in DEPFLAGS

2014-01-25 Thread Janne Grunau
Fixes dependency file generation with gas-preprocessor.pl and clang.
Flags copied from GCC and tested with Apple's clang from Xcode 5 and
5.1 and clang 3.2, 3.3, 3.4 on Linux.
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index b7ff79c..81a4c7a 100755
--- a/configure
+++ b/configure
@@ -2702,7 +2702,7 @@ probe_cc(){
 elif $_cc -v 2>&1 | grep -q clang; then
 _type=clang
 _ident=$($_cc --version | head -n1)
-_depflags='-MMD'
+_depflags='-MMD -MF $(@:.o=.d) -MT $@'
 _cflags_speed='-O3'
 _cflags_size='-Os'
 elif $_cc -V 2>&1 | grep -q Sun; then
-- 
1.8.5.3

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


[libav-devel] [PATCH 1/1] configure: add missing x86 dependency for i686

2014-01-25 Thread Janne Grunau
---
 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 98ac566..b7ff79c 100755
--- a/configure
+++ b/configure
@@ -1561,6 +1561,7 @@ x86_64_suggest="fast_cmov"
 
 amd3dnow_deps="mmx"
 amd3dnowext_deps="amd3dnow"
+i686_deps="x86"
 mmx_deps="x86"
 mmxext_deps="mmx"
 sse_deps="mmxext"
-- 
1.8.5.3

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


Re: [libav-devel] [PATCH 1/1] mpeg12: check scantable indeces in all decode_block functions

2014-01-24 Thread Janne Grunau
On 2014-01-24 17:41:46 +0100, Diego Biurrun wrote:
> indexes

not indices?

> On Fri, Jan 24, 2014 at 05:20:18PM +0100, Janne Grunau wrote:
> > Adds checks to the fast functions used with CODEC_FLAGS2_FAST and moves
> 
> Add, move

changed locally

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


[libav-devel] [PATCH 1/1] mpeg12: check scantable indeces in all decode_block functions

2014-01-24 Thread Janne Grunau
Hi,

On 2014-01-24 16:26:32 +0100, Luca Barbato wrote:
> On 24/01/14 16:24, Janne Grunau wrote:
> > Fixes https://trac.videolan.org/vlc/ticket/9713 with CODEC_FLAGS2_FAST.
> > ---
> >  libavcodec/mpeg12dec.c | 5 +
> >  1 file changed, 5 insertions(+)
> >
>
> if that 64-1 has a name you might use it, the rest seems ok to me once
> you add CC: libav-sta...@libav.org

No matching define for 63/64 as block lenght, CC added and after Kostya
complained over my lazyness on IRC I decided to fix it probably for all
decode_block functions.

Janne
---8<---
Adds checks to the fast functions used with CODEC_FLAGS2_FAST and moves
the check for all other functions to before the invalid memory is
accessed. Fixes https://trac.videolan.org/vlc/ticket/9713 with
CODEC_FLAGS2_FAST.

CC: libav-sta...@libav.org
---
 libavcodec/mpeg12dec.c | 54 +-
 1 file changed, 31 insertions(+), 23 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 49b7d1e..f0e390d 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -119,6 +119,15 @@ static int mpeg_decode_motion(MpegEncContext *s, int 
fcode, int pred)
 return sign_extend(val, 5 + shift);
 }
 
+#define check_scantable_index(ctx, x) \
+do {  \
+if ((x) > 63) {   \
+av_log(ctx->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", \
+   ctx->mb_x, ctx->mb_y); \
+return AVERROR_INVALIDDATA;   \
+} \
+} while (0)   \
+
 static inline int mpeg1_decode_block_intra(MpegEncContext *s, int16_t *block, 
int n)
 {
 int level, dc, diff, i, j, run;
@@ -150,6 +159,7 @@ static inline int mpeg1_decode_block_intra(MpegEncContext 
*s, int16_t *block, in
 break;
 } else if (level != 0) {
 i += run;
+check_scantable_index(s, i);
 j = scantable[i];
 level = (level * qscale * quant_matrix[j]) >> 4;
 level = (level - 1) | 1;
@@ -166,6 +176,7 @@ static inline int mpeg1_decode_block_intra(MpegEncContext 
*s, int16_t *block, in
 level = SHOW_UBITS(re, &s->gb, 8)  ; 
LAST_SKIP_BITS(re, &s->gb, 8);
 }
 i += run;
+check_scantable_index(s, i);
 j = scantable[i];
 if (level < 0) {
 level = -level;
@@ -177,10 +188,6 @@ static inline int mpeg1_decode_block_intra(MpegEncContext 
*s, int16_t *block, in
 level = (level - 1) | 1;
 }
 }
-if (i > 63) {
-av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", 
s->mb_x, s->mb_y);
-return -1;
-}
 
 block[j] = level;
 }
@@ -225,6 +232,7 @@ static inline int mpeg1_decode_block_inter(MpegEncContext 
*s, int16_t *block, in
 
 if (level != 0) {
 i += run;
+check_scantable_index(s, i);
 j = scantable[i];
 level = ((level * 2 + 1) * qscale * quant_matrix[j]) >> 5;
 level = (level - 1) | 1;
@@ -241,6 +249,7 @@ static inline int mpeg1_decode_block_inter(MpegEncContext 
*s, int16_t *block, in
 level = SHOW_UBITS(re, &s->gb, 8)  ; SKIP_BITS(re, 
&s->gb, 8);
 }
 i += run;
+check_scantable_index(s, i);
 j = scantable[i];
 if (level < 0) {
 level = -level;
@@ -252,10 +261,6 @@ static inline int mpeg1_decode_block_inter(MpegEncContext 
*s, int16_t *block, in
 level = (level - 1) | 1;
 }
 }
-if (i > 63) {
-av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", 
s->mb_x, s->mb_y);
-return -1;
-}
 
 block[j] = level;
 if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFF)
@@ -300,6 +305,7 @@ static inline int 
mpeg1_fast_decode_block_inter(MpegEncContext *s, int16_t *bloc
 
 if (level != 0) {
 i += run;
+check_scantable_index(s, i);
 j = scantable[i];
 level = ((level * 2 + 1) * qscale) >> 1;
 level = (level - 1) | 1;
@@ -316,6 +322,7 @@ static inline int 
mpeg1_fast_decode_block_inter(MpegEncContext *s, int16_t *bloc
 level

[libav-devel] [PATCH 1/1] mpeg12: check scantable index in fast_decode_block_non_intra()

2014-01-24 Thread Janne Grunau
Fixes https://trac.videolan.org/vlc/ticket/9713 with CODEC_FLAGS2_FAST.
---
 libavcodec/mpeg12dec.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 49b7d1e..0c2ef8a 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -469,6 +469,11 @@ static inline int 
mpeg2_fast_decode_block_non_intra(MpegEncContext *s,
 level = ((level * 2 + 1) * qscale) >> 1;
 }
 }
+if (i > 63) {
+av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n",
+   s->mb_x, s->mb_y);
+return AVERROR_INVALIDDATA;
+}
 
 block[j] = level;
 if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFF)
-- 
1.8.5.3

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


Re: [libav-devel] [PATCH 2/2] avformat: utils: Refactor duplicated PRINT macro

2014-01-23 Thread Janne Grunau
On 2014-01-16 03:55:45 +0100, Diego Biurrun wrote:
> ---
>  libavformat/utils.c |   18 +-
>  1 file changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 4fee6ec..74d1e69 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -3006,10 +3006,6 @@ fail:
>  return -1;
>  }
>  
> -static void hex_dump_internal(void *avcl, FILE *f, int level,
> -  const uint8_t *buf, int size)
> -{
> -int len, i, j, c;
>  #define PRINT(...)  \
>  do {\
>  if (!f) \
> @@ -3018,6 +3014,11 @@ static void hex_dump_internal(void *avcl, FILE *f, int 
> level,
>  fprintf(f, __VA_ARGS__);\
>  } while (0)
>  
> +static void hex_dump_internal(void *avcl, FILE *f, int level,
> +  const uint8_t *buf, int size)
> +{
> +int len, i, j, c;
> +
>  for (i = 0; i < size; i += 16) {
>  len = size - i;
>  if (len > 16)
> @@ -3038,7 +3039,6 @@ static void hex_dump_internal(void *avcl, FILE *f, int 
> level,
>  }
>  PRINT("\n");
>  }
> -#undef PRINT
>  }
>  
>  void av_hex_dump(FILE *f, const uint8_t *buf, int size)
> @@ -3054,13 +3054,6 @@ void av_hex_dump_log(void *avcl, int level, const 
> uint8_t *buf, int size)
>  static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt,
>int dump_payload, AVRational time_base)
>  {
> -#define PRINT(...)  \
> -do {\
> -if (!f) \
> -av_log(avcl, level, __VA_ARGS__);   \
> -else\
> -fprintf(f, __VA_ARGS__);\
> -} while (0)
>  PRINT("stream #%d:\n", pkt->stream_index);
>  PRINT("  keyframe=%d\n", ((pkt->flags & AV_PKT_FLAG_KEY) != 0));
>  PRINT("  duration=%0.3f\n", pkt->duration * av_q2d(time_base));
> @@ -3078,7 +3071,6 @@ static void pkt_dump_internal(void *avcl, FILE *f, int 
> level, AVPacket *pkt,
>  PRINT("%0.3f", pkt->pts * av_q2d(time_base));
>  PRINT("\n");
>  PRINT("  size=%d\n", pkt->size);
> -#undef PRINT
>  if (dump_payload)
>  av_hex_dump(f, pkt->data, pkt->size);
>  }

PRINT is a little bit unspecific so the #undef is probably not a bad
idea. move it out of the function though. otherwise ok

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


[libav-devel] [PATCH 1/1] avutil: remove timer.h include from internal.h

2014-01-23 Thread Janne Grunau
Added libavutil/timer.h include to all files with {START,STOP}_TIMER.
---
 libavcodec/dnxhddec.c  | 1 +
 libavcodec/dnxhdenc.c  | 1 +
 libavcodec/ffv1dec.c   | 1 +
 libavcodec/h264.c  | 1 +
 libavcodec/h264_cabac.c| 1 +
 libavcodec/ivi_common.c| 1 +
 libavcodec/mpegvideo.c | 1 +
 libavcodec/mpegvideo_enc.c | 1 +
 libavutil/aes.c| 1 +
 libavutil/eval.c   | 1 +
 libavutil/internal.h   | 1 -
 11 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 5c29b3e..854258b 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -23,6 +23,7 @@
  */
 
 #include "libavutil/imgutils.h"
+#include "libavutil/timer.h"
 #include "avcodec.h"
 #include "get_bits.h"
 #include "dnxhddata.h"
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 5eef57e..990c3b2 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -28,6 +28,7 @@
 #include "libavutil/attributes.h"
 #include "libavutil/internal.h"
 #include "libavutil/opt.h"
+#include "libavutil/timer.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "internal.h"
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 5edc667..8f7b2bf 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -30,6 +30,7 @@
 #include "libavutil/crc.h"
 #include "libavutil/opt.h"
 #include "libavutil/imgutils.h"
+#include "libavutil/timer.h"
 #include "avcodec.h"
 #include "internal.h"
 #include "get_bits.h"
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 5069e4a..fd9f796 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -28,6 +28,7 @@
 #include "libavutil/avassert.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/stereo3d.h"
+#include "libavutil/timer.h"
 #include "internal.h"
 #include "cabac.h"
 #include "cabac_functions.h"
diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c
index 43ddf7d..654eab7 100644
--- a/libavcodec/h264_cabac.c
+++ b/libavcodec/h264_cabac.c
@@ -28,6 +28,7 @@
 #define CABAC(h) 1
 
 #include "libavutil/attributes.h"
+#include "libavutil/timer.h"
 #include "config.h"
 #include "cabac.h"
 #include "cabac_functions.h"
diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c
index 8c5d7f3..1e064ed 100644
--- a/libavcodec/ivi_common.c
+++ b/libavcodec/ivi_common.c
@@ -28,6 +28,7 @@
 
 #define BITSTREAM_READER_LE
 #include "libavutil/attributes.h"
+#include "libavutil/timer.h"
 #include "avcodec.h"
 #include "get_bits.h"
 #include "internal.h"
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index a80f737..3e86617 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -31,6 +31,7 @@
 #include "libavutil/avassert.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
+#include "libavutil/timer.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "internal.h"
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index f04926a..1cba087 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -34,6 +34,7 @@
 #include "libavutil/mathematics.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/opt.h"
+#include "libavutil/timer.h"
 #include "avcodec.h"
 #include "dct.h"
 #include "dsputil.h"
diff --git a/libavutil/aes.c b/libavutil/aes.c
index 4656a48..3ba5e9a 100644
--- a/libavutil/aes.c
+++ b/libavutil/aes.c
@@ -23,6 +23,7 @@
 #include "common.h"
 #include "aes.h"
 #include "intreadwrite.h"
+#include "timer.h"
 
 typedef union {
 uint64_t u64[2];
diff --git a/libavutil/eval.c b/libavutil/eval.c
index 48f8e66..72f976c 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -33,6 +33,7 @@
 #include "log.h"
 #include "mathematics.h"
 #include "avstring.h"
+#include "timer.h"
 
 typedef struct Parser {
 const AVClass *class;
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 33a5226..ecd535b 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -36,7 +36,6 @@
 #include 
 #include "config.h"
 #include "attributes.h"
-#include "timer.h"
 #include "dict.h"
 
 #if ARCH_X86
-- 
1.8.5.3

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


Re: [libav-devel] [PATCH] mpegvideo_enc: Don't call ff_h263dsp_init unconditionally

2014-01-22 Thread Janne Grunau
On 2014-01-22 17:50:18 +0200, Martin Storsjö wrote:
> This fixes builds with e.g. --disable-decoders --disable-encoders
> --enable-encoder=mjpeg.
> ---
>  libavcodec/mpegvideo_enc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
> index f04926a..5da5a25 100644
> --- a/libavcodec/mpegvideo_enc.c
> +++ b/libavcodec/mpegvideo_enc.c
> @@ -708,7 +708,8 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
>2 * 64 * sizeof(uint16_t), fail);
>  }
>  
> -ff_h263dsp_init(&s->h263dsp);
> +if (CONFIG_H263_ENCODER)
> +ff_h263dsp_init(&s->h263dsp);
>  if (!s->dct_quantize)
>  s->dct_quantize = ff_dct_quantize_c;
>  if (!s->denoise_dct)

ok

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


Re: [libav-devel] [PATCH] configure: Add missing deps for the mpegvideoenc component

2014-01-22 Thread Janne Grunau
On 2014-01-22 16:59:55 +0200, Martin Storsjö wrote:
> mpegvideo_enc.c unconditionally calls ff_h263dsp_init, therefore
> mpegvideoenc should depend on h263dsp.
> 
> This fixes builds with e.g. --disable-decoders --disable-encoders
> --enable-encoder=mjpeg.
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 98ac566..1977a82 100755
> --- a/configure
> +++ b/configure
> @@ -1612,7 +1612,7 @@ rdft_select="fft"
>  mpegaudio_select="mpegaudiodsp"
>  mpegaudiodsp_select="dct"
>  mpegvideo_select="dsputil hpeldsp videodsp"
> -mpegvideoenc_select="mpegvideo"
> +mpegvideoenc_select="h263dsp mpegvideo"
>  
>  # decoders / encoders
>  aac_decoder_select="mdct sinewin"

That call to ff_h263dsp_init() could be safely placed under 'if
(CONFIG_H263_ENCODER)' and optimized away with dead code elimination.
The only use is the call to ff_h263_loop_filter which is handled in the
same way.

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


Re: [libav-devel] [PATCH 1/2] avformat: utils: K&R formatting cosmetics

2014-01-22 Thread Janne Grunau
On 2014-01-17 15:00:50 +0100, Diego Biurrun wrote:
> On Fri, Jan 17, 2014 at 02:00:06PM +0100, Janne Grunau wrote:
> > On 2014-01-16 03:55:44 +0100, Diego Biurrun wrote:
> > > --- a/libavformat/utils.c
> > > +++ b/libavformat/utils.c
> > > @@ -218,8 +219,10 @@ static int set_codec_from_probe_data(AVFormatContext 
> > > *s, AVStream *st, AVProbeDa
> > >  
> > >  if (fmt) {
> > >  int i;
> > > -av_log(s, AV_LOG_DEBUG, "Probe with size=%d, packets=%d detected 
> > > %s with score=%d\n",
> > > -   pd->buf_size, MAX_PROBE_PACKETS - st->probe_packets, 
> > > fmt->name, score);
> > > +av_log(s, AV_LOG_DEBUG,
> > > +   "Probe with size=%d, packets=%d detected %s with 
> > > score=%d\n",
> > > +   pd->buf_size, MAX_PROBE_PACKETS - st->probe_packets,
> > > +   fmt->name, score);
> > 
> > if you split the format string you could get rid of one line, also
> > 'av_log(s, AV_LOG_DEBUG,\n' lloks ugly
> 
> I find this "logical grouping" of av_log parameters more readable.

I think it's a waste of space and it looks unbalenced

> > > @@ -738,49 +757,58 @@ static void compute_pkt_fields(AVFormatContext *s, 
> > > AVStream *st,
> > >  
> > >  if (pkt->duration == 0 && st->codec->codec_type != 
> > > AVMEDIA_TYPE_AUDIO) {
> > >  ff_compute_frame_duration(&num, &den, st, pc, pkt);
> > >  if (den && num) {
> > > -pkt->duration = av_rescale_rnd(1, num * 
> > > (int64_t)st->time_base.den, den * (int64_t)st->time_base.num, 
> > > AV_ROUND_DOWN);
> > > +pkt->duration = av_rescale_rnd(1,
> > > +   num * (int64_t) 
> > > st->time_base.den,
> > > +   den * (int64_t) 
> > > st->time_base.num,
> > > +   AV_ROUND_DOWN);
> > 
> > please don't this makes my eyes bleed. if the resulting is sligtly above
> > 80 chars let it be
> 
> The line is 131 so surely worth splitting; alternatives
> 
> pkt->duration = av_rescale_rnd(1, num * (int64_t) 
> st->time_base.den,
>den * (int64_t) st->time_base.num, 
> AV_ROUND_DOWN);
> 
> pkt->duration = av_rescale_rnd(1, num * (int64_t) 
> st->time_base.den,
>den * (int64_t) st->time_base.num,
>AV_ROUND_DOWN);
> 
> pkt->duration = av_rescale_rnd(1,
>num * (int64_t) st->time_base.den,
>den * (int64_t) st->time_base.num,
>AV_ROUND_DOWN);
> 
> The first is still too long, the third nicely aligns parameters, that's
> why I went for that solution.

I would prefer option 2, my display is also limited in the number of
lines.

I'll continue to review the patch

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


Re: [libav-devel] [RFC] Merge libavdevice into libavformat.

2014-01-22 Thread Janne Grunau
On 2014-01-22 10:56:27 +0100, Luca Barbato wrote:
> 
> The only marginal problem is having loads of external libraries pulled
> in and that might or might not annoying certain people.

We don't pull most external libraries automatically in. only sdl, zlib
and bzlib and maybe something I missed.

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


[libav-devel] [PATCH 1/1] arm: rewrite .func directive as .thumb_func for thumb

2014-01-22 Thread Janne Grunau
On 2014-01-22 09:54:17 +0200, Martin Storsjö wrote:
> On Wed, 22 Jan 2014, Janne Grunau wrote:
>
> > Makes sure all local function symbols are declared as .thumb_func
> > even if they are not directly called. fft4|65536_neon in
> > libavcodec/arm/fft_neon.S are only accessed through saved offset in
> > a table for example. Fixes fate-mdct-4 tests in libav on iOS.
> > ---
> > gas-preprocessor.pl | 17 +++--
> > 1 file changed, 11 insertions(+), 6 deletions(-)
> >
>
> Probably ok. In general I prefer to move more things to the later stages
> (since some processing can't be done before macros have been expanded
> etc), but these should probably be safe to handle at that point - assuming
> nobody does anything odd like hiding alternating .thumb/.arm statements
> within macros or so.

yes, makes sense and the patch much smaller

Janne
---8<---
Makes sure all local function symbols are declared as .thumb_func
even if they are not directly called. fft4|65536_neon in
libavcodec/arm/fft_neon.S are only accessed through saved offset in
a table for example. Fixes fate-mdct-4 tests in libav on iOS.
---
 gas-preprocessor.pl | 5 +
 1 file changed, 5 insertions(+)

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 2072ca3..1c9a1d5 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -471,6 +471,11 @@ foreach my $line (@pass1_lines) {
 # mach-o local symbol names start with L (no dot)
 $line =~ s/(?https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH 1/1] arm: rewrite .func directive as .thumb_func for thumb

2014-01-21 Thread Janne Grunau
Makes sure all local function symbols are declared as .thumb_func
even if they are not directly called. fft4|65536_neon in
libavcodec/arm/fft_neon.S are only accessed through saved offset in
a table for example. Fixes fate-mdct-4 tests in libav on iOS.
---
 gas-preprocessor.pl | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 2072ca3..834b28d 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -50,6 +50,7 @@ if ((grep /^-c$/, @gcc_cmd) && !(grep /^-o/, @gcc_cmd)) {
 
 my $comm;
 my $aarch64 = 0;
+my $thumb = 0;
 
 # detect architecture from gcc binary name
 if  ($gcc_cmd[0] =~ /arm64|aarch64/) {
@@ -118,9 +119,11 @@ while () {
 # remove all comments (to avoid interfering with evaluating directives)
 s/(?) {
 s/\.arch/$comm$&/x;
 s/\.object_arch/$comm$&/x;
 
+# recycle the '.func' directive for '.thumb_func' otherwise comment it out
+if ($thumb) {
+s/\.func/.thumb_func/x;
+} else {
+s/\.func/$comm$&/x;
+}
+
 # the syntax for these is a little different
 s/\.global/.globl/x;
 # also catch .section .rodata since the equivalent to .const_data is 
.section __DATA,__const
@@ -410,8 +420,6 @@ my @rept_lines;
 my %literal_labels; # for ldr , =
 my $literal_num = 0;
 
-my $thumb = 0;
-
 my %thumb_labels;
 my %call_targets;
 
@@ -436,9 +444,6 @@ foreach my $line (@pass1_lines) {
 push(@sections, $line);
 }
 
-$thumb = 1 if $line =~ /\.code\s+16|\.thumb/;
-$thumb = 0 if $line =~ /\.code\s+32|\.arm/;
-
 # handle ldr , =
 if ($line =~ /(.*)\s*ldr([\w\s\d]+)\s*,\s*=(.*)/) {
 my $label = $literal_labels{$3};
-- 
1.8.5.3

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


Re: [libav-devel] [PATCH 1/1] arm: declare functions called from data table as .thumb_func

2014-01-21 Thread Janne Grunau
On 2014-01-21 09:35:19 +0200, Martin Storsjö wrote:
> On Mon, 20 Jan 2014, Janne Grunau wrote:
> 
> > Handles fft4_neon and fft65536_neon from libavcodec/arm/fft_neon.S
> > correctly which are only called through pc-relative offsets. Fixes
> > i?mdct-4 fate tests on iOS with thumb.
> >
> > Signed-off-by: Janne Grunau 
> > ---
> > gas-preprocessor.pl | 6 ++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
> > index 2072ca3..cdfb95d 100755
> > --- a/gas-preprocessor.pl
> > +++ b/gas-preprocessor.pl
> > @@ -483,6 +483,12 @@ foreach my $line (@pass1_lines) {
> > }
> > }
> >
> > +if ($thumb and $line =~ /^\s*\.word\s+(\w+)\s*$/) {
> > +if (exists $thumb_labels{$1}) {
> > +print ASMFILE ".thumb_func $1\n";
> > +}
> > +}
> > +
> > # @l -> lo16()  @ha -> ha16()
> > $line =~ s/,\s+([^,]+)\@l\b/, lo16($1)/g;
> > $line =~ s/,\s+([^,]+)\@ha\b/, ha16($1)/g;
> > -- 
> > 1.8.5.3
> 
> Ok

Doesn't work unfortunately, forgot --enable-pic in test build

Breaks in vp8_armv6.S due to a '.thumb_func 0'. I'm thinking of
replacing the .func directive with .thumb_func instead of commenting it
out. That makes at least sure that all functions are locally declared as
.thumb_func

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


[libav-devel] [PATCH 1/1] arm: declare functions called from data table as .thumb_func

2014-01-20 Thread Janne Grunau
Handles fft4_neon and fft65536_neon from libavcodec/arm/fft_neon.S
correctly which are only called through pc-relative offsets. Fixes
i?mdct-4 fate tests on iOS with thumb.

Signed-off-by: Janne Grunau 
---
 gas-preprocessor.pl | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 2072ca3..cdfb95d 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -483,6 +483,12 @@ foreach my $line (@pass1_lines) {
 }
 }
 
+if ($thumb and $line =~ /^\s*\.word\s+(\w+)\s*$/) {
+if (exists $thumb_labels{$1}) {
+print ASMFILE ".thumb_func $1\n";
+}
+}
+
 # @l -> lo16()  @ha -> ha16()
 $line =~ s/,\s+([^,]+)\@l\b/, lo16($1)/g;
 $line =~ s/,\s+([^,]+)\@ha\b/, ha16($1)/g;
-- 
1.8.5.3

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


Re: [libav-devel] [PATCH] lavc: do not force the emu edge flag

2014-01-20 Thread Janne Grunau
On 2014-01-20 18:50:26 +0100, Anton Khirnov wrote:
> 
> On Mon, 20 Jan 2014 18:35:00 +0100, Janne Grunau  
> wrote:
> > On 2014-01-20 15:27:46 +0100, Anton Khirnov wrote:
> > > The default get_buffer2() implementation (and possibly some
> > > user ones) does not allocate edges when this flag is set, which may
> > > expose bugs in some decoders. Until the 10 release is out, it is safer
> > > to remove this part.
> > > ---
> > >  libavcodec/utils.c |5 -
> > >  1 file changed, 5 deletions(-)
> > > 
> > > diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> > > index 2e418ec..044413a 100644
> > > --- a/libavcodec/utils.c
> > > +++ b/libavcodec/utils.c
> > > @@ -1091,11 +1091,6 @@ int attribute_align_arg 
> > > avcodec_open2(AVCodecContext *avctx, const AVCodec *code
> > >  ret = AVERROR(EINVAL);
> > >  goto free_and_end;
> > >  }
> > > -
> > > -#if FF_API_EMU_EDGE
> > > -/* force the emu edge flag on, since it's now always active */
> > > -avctx->flags |= CODEC_FLAG_EMU_EDGE;
> > > -#endif
> > >  }
> > >  end:
> > >  entangled_thread_counter--;
> > 
> > Fix for the h264 fate failure sent. Do you still want this committed as
> > protection against possible other bugs?
> 
> Yes, I'd like this in the release to be safe

patch ok

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


Re: [libav-devel] [PATCH] lavc: do not force the emu edge flag

2014-01-20 Thread Janne Grunau
On 2014-01-20 15:27:46 +0100, Anton Khirnov wrote:
> The default get_buffer2() implementation (and possibly some
> user ones) does not allocate edges when this flag is set, which may
> expose bugs in some decoders. Until the 10 release is out, it is safer
> to remove this part.
> ---
>  libavcodec/utils.c |5 -
>  1 file changed, 5 deletions(-)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 2e418ec..044413a 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -1091,11 +1091,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
> *avctx, const AVCodec *code
>  ret = AVERROR(EINVAL);
>  goto free_and_end;
>  }
> -
> -#if FF_API_EMU_EDGE
> -/* force the emu edge flag on, since it's now always active */
> -avctx->flags |= CODEC_FLAG_EMU_EDGE;
> -#endif
>  }
>  end:
>  entangled_thread_counter--;

Fix for the h264 fate failure sent. Do you still want this committed as
protection against possible other bugs? fate-h264 seems to pass here now
with AddressSanitizer. One thing I've noticed though is that the default
get_buffer2() doesn't even allocate a little padding at the end of a
picture plane. I think at least some NEON code can read past the image.

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


[libav-devel] [PATCH 1/1] h264: skip chroma edges at the picture boundary while deblocking 4:4:4

2014-01-20 Thread Janne Grunau
This handles macroblock edges for the chroma components in the same way
as for the luma compoment for 4:4:4 streams. The Spec explicitly states
that the deblocking filter is not applied to edges at the boundary of
the picture.

Signed-off-by: Janne Grunau 
---
 libavcodec/h264.c | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 4b10a68..5069e4a 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2361,17 +2361,19 @@ static av_always_inline void xchg_mb_border(H264Context 
*h, uint8_t *src_y,
 }
 if (simple || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) {
 if (chroma444) {
-if (deblock_topleft) {
-XCHG(top_border_m1 + (24 << pixel_shift), src_cb - (7 << 
pixel_shift), 1);
-XCHG(top_border_m1 + (40 << pixel_shift), src_cr - (7 << 
pixel_shift), 1);
-}
-XCHG(top_border + (16 << pixel_shift), src_cb + (1 << 
pixel_shift), xchg);
-XCHG(top_border + (24 << pixel_shift), src_cb + (9 << 
pixel_shift), 1);
-XCHG(top_border + (32 << pixel_shift), src_cr + (1 << 
pixel_shift), xchg);
-XCHG(top_border + (40 << pixel_shift), src_cr + (9 << 
pixel_shift), 1);
-if (h->mb_x + 1 < h->mb_width) {
-XCHG(h->top_borders[top_idx][h->mb_x + 1] + (16 << 
pixel_shift), src_cb + (17 << pixel_shift), 1);
-XCHG(h->top_borders[top_idx][h->mb_x + 1] + (32 << 
pixel_shift), src_cr + (17 << pixel_shift), 1);
+if (deblock_top) {
+if (deblock_topleft) {
+XCHG(top_border_m1 + (24 << pixel_shift), src_cb - (7 << 
pixel_shift), 1);
+XCHG(top_border_m1 + (40 << pixel_shift), src_cr - (7 << 
pixel_shift), 1);
+}
+XCHG(top_border + (16 << pixel_shift), src_cb + (1 << 
pixel_shift), xchg);
+XCHG(top_border + (24 << pixel_shift), src_cb + (9 << 
pixel_shift), 1);
+XCHG(top_border + (32 << pixel_shift), src_cr + (1 << 
pixel_shift), xchg);
+XCHG(top_border + (40 << pixel_shift), src_cr + (9 << 
pixel_shift), 1);
+if (h->mb_x + 1 < h->mb_width) {
+XCHG(h->top_borders[top_idx][h->mb_x + 1] + (16 << 
pixel_shift), src_cb + (17 << pixel_shift), 1);
+XCHG(h->top_borders[top_idx][h->mb_x + 1] + (32 << 
pixel_shift), src_cr + (17 << pixel_shift), 1);
+}
 }
 } else {
 if (deblock_top) {
-- 
1.8.5.3

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


Re: [libav-devel] [libav-commits] lavc: deprecate CODEC_FLAG_EMU_EDGE and avcodec_get_edge_width().

2014-01-20 Thread Janne Grunau
On 2014-01-20 16:08:57 +0200, Martin Storsjö wrote:
> On Mon, 20 Jan 2014, Anton Khirnov  wrote:
> 
> > Module: libav
> > Branch: master
> > Commit: 93c553c71ef48550ff7c2aa7b5712a7e01f1999f
> >
> > Author:Anton Khirnov 
> > Committer: Anton Khirnov 
> > Date:  Thu Jan  2 11:07:11 2014 +0100
> >
> > lavc: deprecate CODEC_FLAG_EMU_EDGE and avcodec_get_edge_width().
> >
> > ---
> >
> > doc/APIchanges   |5 +
> > libavcodec/avcodec.h |   21 +
> > libavcodec/utils.c   |7 +++
> > libavcodec/version.h |5 -
> > 4 files changed, 29 insertions(+), 9 deletions(-)
> 
> > diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> > index ed68d0f..2e418ec 100644
> > --- a/libavcodec/utils.c
> > +++ b/libavcodec/utils.c
> > @@ -1089,6 +1091,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
> > *avctx, const AVCodec *code
> > ret = AVERROR(EINVAL);
> > goto free_and_end;
> > }
> > +
> > +#if FF_API_EMU_EDGE
> > +/* force the emu edge flag on, since it's now always active */
> > +avctx->flags |= CODEC_FLAG_EMU_EDGE;
> > +#endif
> 
> This hunk broke the h264-reinit-small_420_8-to-large_444_10 test on a 
> number of configs. In configs where it seemingly still passes, try running 
> it in valgrind.

probably emu_edge_width not updated for for >8bit depth on the change

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


Re: [libav-devel] [PATCH] h264: reset data partitioning at the beginning of each decode call

2014-01-20 Thread Janne Grunau
On 2014-01-19 19:49:02 +0100, Anton Khirnov wrote:
> Prevents using GetBitContexts with data from previous calls.
> 
> Fixes access to freed memory.
> 
> Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
> CC:libav-sta...@libav.org
> ---
>  libavcodec/h264.c |   11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> index d43b11e..a36 100644
> --- a/libavcodec/h264.c
> +++ b/libavcodec/h264.c
> @@ -1763,7 +1763,6 @@ static int decode_update_thread_context(AVCodecContext 
> *dst,
>  h->picture_structure= h1->picture_structure;
>  h->qscale   = h1->qscale;
>  h->droppable= h1->droppable;
> -h->data_partitioning= h1->data_partitioning;
>  h->low_delay= h1->low_delay;
>  
>  for (i = 0; i < MAX_PICTURE_COUNT; i++) {
> @@ -4750,6 +4749,13 @@ again:
>  }
>  break;
>  case NAL_DPA:
> +if (h->avctx->flags & CODEC_FLAG2_CHUNKS) {
> +av_log(h->avctx, AV_LOG_ERROR,
> +   "Decoding in chunks is not supported for "
> +   "partitioned slices.\n");
> +return AVERROR(ENOSYS);
> +}
> +
>  init_get_bits(&hx->gb, ptr, bit_length);
>  hx->intra_gb_ptr =
>  hx->inter_gb_ptr = NULL;
> @@ -4899,6 +4905,9 @@ static int h264_decode_frame(AVCodecContext *avctx, 
> void *data,
>  int ret;
>  
>  h->flags = avctx->flags;
> +/* reset data partitioning here, to ensure GetBitContexts from previous
> + * packets do not get used. */
> +h->data_partitioning = 0;
>  
>  /* end of stream, output what is still in the buffers */
>  out:

ok

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


Re: [libav-devel] [PATCH] h264: reset data partitioning at the beginning of each decode call

2014-01-19 Thread Janne Grunau
On 2014-01-18 21:04:04 +0100, Anton Khirnov wrote:
> Prevents using GetBitContexts with data from previous calls.
> 
> Fixes access to freed memory.
> 
> Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
> CC:libav-sta...@libav.org
> ---
>  libavcodec/h264.c |   10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> index d43b11e..adb0dbe 100644
> --- a/libavcodec/h264.c
> +++ b/libavcodec/h264.c
> @@ -4750,6 +4750,13 @@ again:
>  }
>  break;
>  case NAL_DPA:
> +if (h->avctx->flags & CODEC_FLAG2_CHUNKS) {
> +av_log(h->avctx, AV_LOG_ERROR,
> +   "Decoding in chunks is not supported for "
> +   "partitioned slices.\n");
> +return AVERROR(ENOSYS);
> +}
> +
>  init_get_bits(&hx->gb, ptr, bit_length);
>  hx->intra_gb_ptr =
>  hx->inter_gb_ptr = NULL;
> @@ -4899,6 +4906,9 @@ static int h264_decode_frame(AVCodecContext *avctx, 
> void *data,
>  int ret;
>  
>  h->flags = avctx->flags;
> +/* reset data partitioning here, to ensure GetBitContexts from previous
> + * packets do not get used. */
> +h->data_partitioning = 0;
>  
>  /* end of stream, output what is still in the buffers */
>  out:

I guess ok but if we reset h->data_partitioning on each decode_frame
call there is no need to copy it in frame threading

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


Re: [libav-devel] [PATCH 1/2] avformat: utils: K&R formatting cosmetics

2014-01-17 Thread Janne Grunau
On 2014-01-16 03:55:44 +0100, Diego Biurrun wrote:
> Also adjust some comment wording and spelling.
> ---
>  libavformat/utils.c | 1666 
> +++
>  1 file changed, 899 insertions(+), 767 deletions(-)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index db92f81..4fee6ec 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -19,35 +19,35 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
>   */
>  
> +#undef NDEBUG
> +#include 
> +#include 
>  #include 
>  
> -#include "avformat.h"
> -#include "avio_internal.h"
> -#include "internal.h"
> -#include "libavcodec/internal.h"
> -#include "libavcodec/bytestream.h"
> -#include "libavutil/opt.h"
> -#include "libavutil/dict.h"
> -#include "libavutil/internal.h"
> -#include "libavutil/pixdesc.h"
> -#include "metadata.h"
> -#include "id3v2.h"
> +#include "config.h"
>  #include "libavutil/avassert.h"
>  #include "libavutil/avstring.h"
>  #include "libavutil/mathematics.h"
>  #include "libavutil/parseutils.h"
>  #include "libavutil/time.h"
> -#include "riff.h"
> +#include "libavutil/opt.h"
> +#include "libavutil/dict.h"
> +#include "libavutil/internal.h"
> +#include "libavutil/pixdesc.h"
> +#include "libavcodec/bytestream.h"
> +#include "libavcodec/internal.h"
>  #include "audiointerleave.h"
> +#include "avformat.h"
> +#include "avio_internal.h"
> +#include "id3v2.h"
> +#include "internal.h"
> +#include "metadata.h"
> +#include "riff.h"
>  #include "url.h"
> -#include 
>  #if CONFIG_NETWORK
>  #include "network.h"
>  #endif
>  
> -#undef NDEBUG
> -#include 
> -

also reorders headers, please add that to commit message

>  /**
>   * @file
>   * various utility functions for use within Libav
> @@ -72,25 +72,21 @@ const char *avformat_license(void)
>  /* an arbitrarily chosen "sane" max packet size -- 50M */
>  #define SANE_CHUNK_SIZE (5000)
>  
> -/*
> - * Read the data in sane-sized chunks and append to pkt.
> - * Return the number of bytes read or an error.
> - */
> +/* Read the data in sane-sized chunks and append to pkt.
> + * Return the number of bytes read or an error. */
>  static int append_packet_chunked(AVIOContext *s, AVPacket *pkt, int size)
>  {
>  int64_t chunk_size = size;
> -int64_t orig_pos   = pkt->pos; // av_grow_packet might reset pos
> -int orig_size  = pkt->size;
> +int64_t orig_pos = pkt->pos; // av_grow_packet might reset pos
> +int orig_size= pkt->size;

this incomplete vertical alignment looks strange after the patch,
leave it as it is

>  int ret = 0;
>  
>  do {
>  int prev_size = pkt->size;
>  int read_size;
>  
> -/*
> - * When the caller requests a lot of data, limit it to the amount 
> left
> - * in file or SANE_CHUNK_SIZE when it is not known
> - */
> +/* When the caller requests a lot of data, limit it to the amount
> + * left in file or SANE_CHUNK_SIZE when it is not known. */
>  if (size > SANE_CHUNK_SIZE) {
>  int64_t filesize = avio_size(s) - avio_tell(s);
>  chunk_size = FFMAX(filesize, SANE_CHUNK_SIZE);
> @@ -133,14 +129,15 @@ int av_append_packet(AVIOContext *s, AVPacket *pkt, int 
> size)
>  return append_packet_chunked(s, pkt, size);
>  }
>  
> -
>  int av_filename_number_test(const char *filename)
>  {
>  char buf[1024];
> -return filename && (av_get_frame_filename(buf, sizeof(buf), filename, 
> 1)>=0);
> +return filename &&
> +   (av_get_frame_filename(buf, sizeof(buf), filename, 1) >= 0);
>  }
>  
> -AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int 
> *score_max)
> +AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened,
> +  int *score_max)
>  {
>  AVProbeData lpd = *pd;
>  AVInputFormat *fmt1 = NULL, *fmt;
> @@ -149,7 +146,7 @@ AVInputFormat *av_probe_input_format2(AVProbeData *pd, 
> int is_opened, int *score
>  if (lpd.buf_size > 10 && ff_id3v2_match(lpd.buf, ID3v2_DEFAULT_MAGIC)) {
>  int id3len = ff_id3v2_tag_len(lpd.buf);
>  if (lpd.buf_size > id3len + 16) {
> -lpd.buf += id3len;
> +lpd.buf  += id3len;
>  lpd.buf_size -= id3len;
>  }
>  id3 = 1;
> @@ -163,21 +160,21 @@ AVInputFormat *av_probe_input_format2(AVProbeData *pd, 
> int is_opened, int *score
>  if (fmt1->read_probe) {
>  score = fmt1->read_probe(&lpd);
>  } else if (fmt1->extensions) {
> -if (av_match_ext(lpd.filename, fmt1->extensions)) {
> +if (av_match_ext(lpd.filename, fmt1->extensions))
>  score = AVPROBE_SCORE_EXTENSION;
> -}
>  }
>  if (score > *score_max) {
>  *score_max = score;
> -fmt = fmt1;
> -}else if (score == *score_max)
> +fmt= fmt1;
> +} else if (score == *score_max)

Re: [libav-devel] [PATCH 2/2] yuv4mpeg: set average frame rate

2014-01-15 Thread Janne Grunau
On 2014-01-15 21:37:10 +0100, Anton Khirnov wrote:
> ---
>  libavformat/yuv4mpeg.c |1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
> index cc2755f..f793a0e 100644
> --- a/libavformat/yuv4mpeg.c
> +++ b/libavformat/yuv4mpeg.c
> @@ -361,6 +361,7 @@ static int yuv4_read_header(AVFormatContext *s)
>  st->codec->height = height;
>  av_reduce(&raten, &rated, raten, rated, (1UL << 31) - 1);
>  avpriv_set_pts_info(st, 64, rated, raten);
> +st->avg_frame_rate= av_inv_q(st->time_base);
>  st->codec->pix_fmt= pix_fmt;
>  st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
>  st->codec->codec_id   = AV_CODEC_ID_RAWVIDEO;

I guess ok

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


<    5   6   7   8   9   10   11   12   13   14   >