[libav-devel] [PATCH 18/25] intrax8: Add a local BlockDSPContext and initialize it

2016-03-19 Thread Vittorio Giovara
Helps in decoupling this code from mpegvideo.
---
 configure| 2 +-
 libavcodec/intrax8.c | 3 ++-
 libavcodec/intrax8.h | 2 ++
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 493bbc7..1c2ac71 100755
--- a/configure
+++ b/configure
@@ -1860,7 +1860,7 @@ error_resilience_select="me_cmp"
 faandct_deps="faan fdctdsp"
 faanidct_deps="faan idctdsp"
 h264dsp_select="startcode"
-intrax8_select="idctdsp"
+intrax8_select="blockdsp idctdsp"
 mdct_select="fft"
 rdft_select="fft"
 me_cmp_select="fdctdsp idctdsp pixblockdsp"
diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 3365995..c99c4e8 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -585,7 +585,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, 
const int chroma)
 int sign;
 
 assert(w->orient < 12);
-s->bdsp.clear_block(s->block[0]);
+w->bdsp.clear_block(s->block[0]);
 
 if (chroma)
 dc_mode = 2;
@@ -761,6 +761,7 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
   ff_wmv1_scantable[3]);
 
 ff_intrax8dsp_init(>dsp);
+ff_blockdsp_init(>bdsp, avctx);
 
 return 0;
 }
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
index 5b72532..93881d0 100644
--- a/libavcodec/intrax8.h
+++ b/libavcodec/intrax8.h
@@ -19,6 +19,7 @@
 #ifndef AVCODEC_INTRAX8_H
 #define AVCODEC_INTRAX8_H
 
+#include "blockdsp.h"
 #include "get_bits.h"
 #include "mpegvideo.h"
 #include "idctdsp.h"
@@ -41,6 +42,7 @@ typedef struct IntraX8Context {
 MpegEncContext *s;
 IntraX8DSPContext dsp;
 IDCTDSPContext idsp;
+BlockDSPContext bdsp;
 int quant;
 int dquant;
 int qsum;
-- 
2.7.3

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


[libav-devel] [PATCH 1/2] lavf: Raw G.729 demuxer

2016-03-19 Thread Vittorio Giovara
From: Vladimir Voroshilov <voros...@gmail.com>

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 Changelog|   1 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/g729dec.c| 105 +++
 4 files changed, 108 insertions(+)
 create mode 100644 libavformat/g729dec.c

diff --git a/Changelog b/Changelog
index 92c694bc..ca9c9b4 100644
--- a/Changelog
+++ b/Changelog
@@ -51,6 +51,7 @@ version :
 - support Apple AVFoundation video capture
 - G.723.1 muxer and encoder
 - compressed SWF
+- G.729 raw demuxer
 
 
 version 11:
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 46cf9e0..891a20f 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -142,6 +142,7 @@ OBJS-$(CONFIG_G722_DEMUXER)  += g722.o rawdec.o
 OBJS-$(CONFIG_G722_MUXER)+= rawenc.o
 OBJS-$(CONFIG_G723_1_DEMUXER)+= g723_1.o
 OBJS-$(CONFIG_G723_1_MUXER)  += rawenc.o
+OBJS-$(CONFIG_G729_DEMUXER)  += g729dec.o
 OBJS-$(CONFIG_H261_DEMUXER)  += h261dec.o rawdec.o
 OBJS-$(CONFIG_H261_MUXER)+= rawenc.o
 OBJS-$(CONFIG_H263_DEMUXER)  += h263dec.o rawdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 43d0e6d..0f49756 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -105,6 +105,7 @@ void av_register_all(void)
 REGISTER_MUXER   (FRAMEMD5, framemd5);
 REGISTER_MUXDEMUX(G722, g722);
 REGISTER_MUXDEMUX(G723_1,   g723_1);
+REGISTER_DEMUXER (G729, g729);
 REGISTER_MUXER   (GIF,  gif);
 REGISTER_DEMUXER (GSM,  gsm);
 REGISTER_MUXDEMUX(GXF,  gxf);
diff --git a/libavformat/g729dec.c b/libavformat/g729dec.c
new file mode 100644
index 000..c2beb60
--- /dev/null
+++ b/libavformat/g729dec.c
@@ -0,0 +1,105 @@
+/*
+ * G.729 raw format demuxer
+ * Copyright (c) 2011 Vladimir Voroshilov
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/log.h"
+#include "libavutil/opt.h"
+
+#include "avformat.h"
+#include "internal.h"
+
+typedef struct G729DemuxerContext {
+AVClass *class;
+
+int bit_rate;
+} G729DemuxerContext;
+
+static int g729_read_header(AVFormatContext *s)
+{
+AVStream* st;
+G729DemuxerContext *s1 = s->priv_data;
+
+st = avformat_new_stream(s, NULL);
+if (!st)
+return AVERROR(ENOMEM);
+
+st->codecpar->codec_type  = AVMEDIA_TYPE_AUDIO;
+st->codecpar->codec_id= AV_CODEC_ID_G729;
+st->codecpar->sample_rate = 8000;
+st->codecpar->channels= 1;
+
+if (s1 && s1->bit_rate)
+s->bit_rate = s1->bit_rate;
+
+switch(s->bit_rate) {
+case 6400:
+st->codecpar->block_align = 8;
+break;
+case 8000:
+st->codecpar->block_align = 10;
+break;
+default:
+av_log(s, AV_LOG_ERROR, "Invalid bit_rate value %d. "
+   "Only 6400 and 8000 b/s are supported.", s->bit_rate);
+return AVERROR(EINVAL);
+}
+
+avpriv_set_pts_info(st, st->codecpar->block_align << 3, 1,
+st->codecpar->sample_rate);
+
+return 0;
+}
+
+static int g729_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+AVStream *st = s->streams[0];
+int ret = av_get_packet(s->pb, pkt, st->codecpar->block_align);
+if (ret < 0)
+return ret;
+
+pkt->stream_index = 0;
+pkt->dts = pkt->pts = pkt->pos / st->codecpar->block_align;
+
+return 0;
+}
+
+#define OFFSET(x) offsetof(G729DemuxerContext, x)
+static const AVOption g729_options[] = {
+{ "bit_rate", "", OFFSET(bit_rate), AV_OPT_TYPE_INT, { .i64 = 8000 }, 0, 
INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+{ NULL },
+};
+
+static const AVClass g729_demuxer_class = {
+.class_name = "g729 demuxer",
+.item_name  = av_default_item_name,
+.option = g729_options,
+.version= LIBAVUTIL_VERSION_INT,
+};
+
+AVInputFormat ff_g729_demuxer = 

[libav-devel] [PATCH 2/2] GIF demuxer

2016-03-19 Thread Vittorio Giovara
From: Vitaliy E Sugrobov <vsug...@hotmail.com>

This demuxer is capable of extracting multiple frames from gif file.
In conjunction with gif decoder it implements support for reading
animated gifs.

Signed-off-by: Vitaliy E Sugrobov <vsug...@hotmail.com>
Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 Changelog|   1 +
 doc/general.texi |   2 +-
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   2 +-
 libavformat/gifdec.c | 318 +++
 5 files changed, 322 insertions(+), 2 deletions(-)
 create mode 100644 libavformat/gifdec.c

diff --git a/Changelog b/Changelog
index ca9c9b4..71fe9e2 100644
--- a/Changelog
+++ b/Changelog
@@ -52,6 +52,7 @@ version :
 - G.723.1 muxer and encoder
 - compressed SWF
 - G.729 raw demuxer
+- GIF demuxer
 
 
 version 11:
diff --git a/doc/general.texi b/doc/general.texi
index 15e4a66..5f01c50 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -282,7 +282,7 @@ library:
 @item framecrc testing format   @tab X @tab
 @item FunCom ISS@tab   @tab X
 @tab Audio format used in various games from FunCom like The Longest 
Journey.
-@item GIF Animation @tab X @tab
+@item GIF Animation @tab X @tab X
 @item GXF   @tab X @tab X
 @tab General eXchange Format SMPTE 360M, used by Thomson Grass Valley
  playout servers.
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 891a20f..5cd8f8f 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -135,6 +135,7 @@ OBJS-$(CONFIG_FOURXM_DEMUXER)+= 4xm.o
 OBJS-$(CONFIG_FRAMECRC_MUXER)+= framecrcenc.o framehash.o
 OBJS-$(CONFIG_FRAMEMD5_MUXER)+= md5enc.o framehash.o
 OBJS-$(CONFIG_GIF_MUXER) += gif.o
+OBJS-$(CONFIG_GIF_DEMUXER)   += gifdec.o
 OBJS-$(CONFIG_GSM_DEMUXER)   += gsmdec.o
 OBJS-$(CONFIG_GXF_DEMUXER)   += gxf.o
 OBJS-$(CONFIG_GXF_MUXER) += gxfenc.o audiointerleave.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 0f49756..1056d7b 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -106,7 +106,7 @@ void av_register_all(void)
 REGISTER_MUXDEMUX(G722, g722);
 REGISTER_MUXDEMUX(G723_1,   g723_1);
 REGISTER_DEMUXER (G729, g729);
-REGISTER_MUXER   (GIF,  gif);
+REGISTER_MUXDEMUX(GIF,  gif);
 REGISTER_DEMUXER (GSM,  gsm);
 REGISTER_MUXDEMUX(GXF,  gxf);
 REGISTER_MUXDEMUX(H261, h261);
diff --git a/libavformat/gifdec.c b/libavformat/gifdec.c
new file mode 100644
index 000..cc46716
--- /dev/null
+++ b/libavformat/gifdec.c
@@ -0,0 +1,318 @@
+/*
+ * GIF demuxer
+ * Copyright (c) 2012 Vitaliy E Sugrobov
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * GIF demuxer.
+ *
+ * There are two options available to user: default_delay and min_delay.
+ *
+ * These options are for protection from too rapid gif animations.
+ * In practice it is standard approach to slow down rendering of this
+ * kind of gifs. If you try to play gif with delay between frames of one
+ * hundredth of second (100fps) using one of major web browsers, you get
+ * significantly slower playback, around 10 fps. This is because browser
+ * detects that delay value is less than some threshold (usually 2 hundredths
+ * of second) and reset it to default value (usually 10 hundredths of second,
+ * which corresponds to 10fps). Manipulating these options, user can achieve
+ * the same effect during conversion to some video format. Otherwise user
+ * can set them to not protect from rapid animations at all.
+ *
+ * The other case when these options necessary is for gif images encoded
+ * according to gif87a standard since prior to gif89a there was no delay
+ * information included in file.
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "libavutil/opt.h"
+
+#include "avformat.h"
+#include "internal.h"
+
+#define GIF_SIG_87A "GIF87a"
+#define GIF_SIG_89A "GIF89a"
+
+#define GIF_TRAILER 0x3b
+#define GIF_E

[libav-devel] [PATCH 06/25] intrax8: Move documentation from implementation to header files

2016-03-19 Thread Vittorio Giovara
---
 libavcodec/intrax8.c | 20 
 libavcodec/intrax8.h | 22 ++
 2 files changed, 22 insertions(+), 20 deletions(-)

Unchanged.

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 851c434..3ab2faa 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -738,12 +738,6 @@ static void x8_init_block_index(MpegEncContext *s)
 s->dest[2] += (s->mb_y & (~1)) * uvlinesize << 2;
 }
 
-/**
- * Initialize IntraX8 frame decoder.
- * Requires valid MpegEncContext with valid s->mb_width before calling.
- * @param w pointer to IntraX8Context
- * @param s pointer to MpegEncContext of the parent codec
- */
 av_cold void ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s)
 {
 w->s = s;
@@ -763,25 +757,11 @@ av_cold void ff_intrax8_common_init(IntraX8Context *w, 
MpegEncContext *const s)
 ff_intrax8dsp_init(>dsp);
 }
 
-/**
- * Destroy IntraX8 frame structure.
- * @param w pointer to IntraX8Context
- */
 av_cold void ff_intrax8_common_end(IntraX8Context *w)
 {
 av_freep(>prediction_table);
 }
 
-/**
- * Decode single IntraX8 frame.
- * The parent codec must fill s->loopfilter and s->gb (bitstream).
- * The parent codec must call ff_mpv_frame_start() before calling this 
function.
- * The parent codec must call ff_mpv_frame_end() after calling this function.
- * This function does not use ff_mpv_decode_mb().
- * @param w pointer to IntraX8Context
- * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
- * @param quant_offset offset away from zero
- */
 int ff_intrax8_decode_picture(IntraX8Context *const w, int dquant,
   int quant_offset)
 {
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
index 83e984b..3339bc6 100644
--- a/libavcodec/intrax8.h
+++ b/libavcodec/intrax8.h
@@ -56,8 +56,30 @@ typedef struct IntraX8Context {
 int est_run;
 } IntraX8Context;
 
+/**
+ * Initialize IntraX8 frame decoder.
+ * Requires valid MpegEncContext with valid s->mb_width before calling.
+ * @param w pointer to IntraX8Context
+ * @param s pointer to MpegEncContext of the parent codec
+ */
 void ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s);
+
+/**
+ * Destroy IntraX8 frame structure.
+ * @param w pointer to IntraX8Context
+ */
 void ff_intrax8_common_end(IntraX8Context *w);
+
+/**
+ * Decode single IntraX8 frame.
+ * The parent codec must fill s->loopfilter and s->gb (bitstream).
+ * The parent codec must call ff_mpv_frame_start() before calling this 
function.
+ * The parent codec must call ff_mpv_frame_end() after calling this function.
+ * This function does not use ff_mpv_decode_mb().
+ * @param w pointer to IntraX8Context
+ * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
+ * @param quant_offset offset away from zero
+ */
 int ff_intrax8_decode_picture(IntraX8Context *w, int quant, int halfpq);
 
 #endif /* AVCODEC_INTRAX8_H */
-- 
2.7.3

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


[libav-devel] [PATCH 02/25] intrax8: Move error resilience out of intrax8

2016-03-19 Thread Vittorio Giovara
The intrax8 decoding process does not imply any kind of error
correction, and the only call present is more related to how mpegvideo
works rather than anything else.

Therefore have the parent decoders carried out er when actually needed.

Drop two variables that were initialized but never used.
Update documentation accordingly.
---
 configure  |  3 +--
 libavcodec/intrax8.c   | 10 ++
 libavcodec/vc1_block.c |  4 
 libavcodec/wmv2dec.c   |  4 
 4 files changed, 11 insertions(+), 10 deletions(-)

Modified as discussed with Diego.
Vittorio

diff --git a/configure b/configure
index 5376e67..56d3bbf 100755
--- a/configure
+++ b/configure
@@ -1860,7 +1860,6 @@ error_resilience_select="me_cmp"
 faandct_deps="faan fdctdsp"
 faanidct_deps="faan idctdsp"
 h264dsp_select="startcode"
-intrax8_select="error_resilience"
 mdct_select="fft"
 rdft_select="fft"
 me_cmp_select="fdctdsp idctdsp pixblockdsp"
@@ -2083,7 +2082,7 @@ wmav2_encoder_select="mdct sinewin wma_freqs"
 wmavoice_decoder_select="lsp rdft dct mdct sinewin"
 wmv1_decoder_select="h263_decoder"
 wmv1_encoder_select="h263_encoder"
-wmv2_decoder_select="blockdsp h263_decoder idctdsp intrax8 videodsp wmv2dsp"
+wmv2_decoder_select="blockdsp error_resilience h263_decoder idctdsp intrax8 
videodsp wmv2dsp"
 wmv2_encoder_select="h263_encoder wmv2dsp"
 wmv3_decoder_select="vc1_decoder"
 wmv3image_decoder_select="wmv3_decoder"
diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 3cd84dc..45fff96 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -22,7 +22,6 @@
  */
 
 #include "avcodec.h"
-#include "error_resilience.h"
 #include "get_bits.h"
 #include "idctdsp.h"
 #include "mpegvideo.h"
@@ -718,8 +717,8 @@ av_cold void ff_intrax8_common_end(IntraX8Context * w)
 /**
  * Decode single IntraX8 frame.
  * The parent codec must fill s->loopfilter and s->gb (bitstream).
- * The parent codec must call ff_mpv_frame_start(), ff_er_frame_start() before 
calling this function.
- * The parent codec must call ff_er_frame_end(), ff_mpv_frame_end() after 
calling this function.
+ * The parent codec must call ff_mpv_frame_start() before calling this 
function.
+ * The parent codec must call ff_mpv_frame_end() after calling this function.
  * This function does not use ff_mpv_decode_mb().
  * @param w pointer to IntraX8Context
  * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
@@ -745,8 +744,6 @@ int ff_intrax8_decode_picture(IntraX8Context * const w, int 
dquant, int quant_of
 }
 x8_reset_vlc_tables(w);
 
-s->resync_mb_x=0;
-s->resync_mb_y=0;
 
 for(s->mb_y=0; s->mb_y < s->mb_height*2; s->mb_y++){
 x8_init_block_index(s);
@@ -785,8 +782,5 @@ int ff_intrax8_decode_picture(IntraX8Context * const w, int 
dquant, int quant_of
 }
 
 error:
-ff_er_add_slice(>er, s->resync_mb_x, s->resync_mb_y,
-(s->mb_x>>1)-1, (s->mb_y>>1)-1,
-ER_MB_END );
 return 0;
 }
diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c
index 4588af4..8b46260 100644
--- a/libavcodec/vc1_block.c
+++ b/libavcodec/vc1_block.c
@@ -3023,6 +3023,10 @@ void ff_vc1_decode_blocks(VC1Context *v)
 v->s.esc3_level_length = 0;
 if (v->x8_type) {
 ff_intrax8_decode_picture(>x8, 2*v->pq + v->halfpq, v->pq * 
!v->pquantizer);
+
+ff_er_add_slice(>s.er, 0, 0,
+(v->s.mb_x >> 1) - 1, (v->s.mb_y >> 1) - 1,
+ER_MB_END);
 } else {
 v->cur_blk_idx =  0;
 v->left_blk_idx= -1;
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index c71fd3d..ca8afe6 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -229,6 +229,10 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext 
*s)
 
 if (w->j_type) {
 ff_intrax8_decode_picture(>x8, 2 * s->qscale, (s->qscale - 1) | 1);
+
+ff_er_add_slice(>s.er, 0, 0,
+(w->s.mb_x >> 1) - 1, (w->s.mb_y >> 1) - 1,
+ER_MB_END);
 return 1;
 }
 
-- 
2.7.3

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


[libav-devel] [PATCH 09/25] vc1dec: wmv2dec: Validate ff_intrax8_common_init return value

2016-03-19 Thread Vittorio Giovara
---
 libavcodec/vc1dec.c  | 8 +---
 libavcodec/wmv2dec.c | 4 +---
 2 files changed, 6 insertions(+), 6 deletions(-)

Unchanged.

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 51f5c42..76f3591 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -314,7 +314,7 @@ static void vc1_sprite_flush(AVCodecContext *avctx)
 av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 {
 MpegEncContext *s = >s;
-int i;
+int i, ret = AVERROR(ENOMEM);
 int mb_height = FFALIGN(s->mb_height, 2);
 
 /* Allocate mb bitplanes */
@@ -371,7 +371,9 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 v->mv_f_next[0] = v->mv_f_next_base + s->b8_stride + 1;
 v->mv_f_next[1] = v->mv_f_next[0] + (s->b8_stride * (mb_height * 2 + 
1) + s->mb_stride * (mb_height + 1) * 2);
 
-ff_intrax8_common_init(>x8,s);
+ret = ff_intrax8_common_init(>x8,s);
+if (ret < 0)
+goto error;
 
 if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == 
AV_CODEC_ID_VC1IMAGE) {
 for (i = 0; i < 4; i++) {
@@ -385,7 +387,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 
 error:
 ff_vc1_decode_end(s->avctx);
-return AVERROR(ENOMEM);
+return ret;
 }
 
 av_cold void ff_vc1_init_transposed_scantables(VC1Context *v)
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index ca8afe6..5bfedbd 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -471,9 +471,7 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
 
 ff_wmv2_common_init(w);
 
-ff_intrax8_common_init(>x8, >s);
-
-return 0;
+return ff_intrax8_common_init(>x8, >s);
 }
 
 static av_cold int wmv2_decode_end(AVCodecContext *avctx)
-- 
2.7.3

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


[libav-devel] [PATCH 03/25] intrax8: Wrap multiline macros in do{}while(0) clauses

2016-03-19 Thread Vittorio Giovara
These macros are treated like functions, the wrapping simplifies error
checking and avoids deep nested if in the following commit.
---
 libavcodec/intrax8.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

Unchanged.
Vittorio

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 45fff96..4887643 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -61,7 +61,7 @@ static av_cold void x8_vlc_init(void){
 
 static VLC_TYPE table[28150][2];
 
-#define  init_ac_vlc(dst,src) \
+#define  init_ac_vlc(dst,src) do { \
 dst.table = [offset]; \
 dst.table_allocated = sizes[sizeidx]; \
 offset += sizes[sizeidx++]; \
@@ -69,7 +69,8 @@ static av_cold void x8_vlc_init(void){
   AC_VLC_BITS,77, \
   [1],4,2, \
   [0],4,2, \
-  INIT_VLC_USE_NEW_STATIC)
+  INIT_VLC_USE_NEW_STATIC); \
+} while(0)
 //set ac tables
 for(i=0;i<8;i++){
 init_ac_vlc( j_ac_vlc[0][0][i], x8_ac0_highquant_table[i][0] );
@@ -80,7 +81,7 @@ static av_cold void x8_vlc_init(void){
 #undef init_ac_vlc
 
 //set dc tables
-#define init_dc_vlc(dst,src) \
+#define init_dc_vlc(dst,src) do { \
 dst.table = [offset]; \
 dst.table_allocated = sizes[sizeidx]; \
 offset += sizes[sizeidx++]; \
@@ -88,7 +89,8 @@ static av_cold void x8_vlc_init(void){
 DC_VLC_BITS,34, \
 [1],4,2, \
 [0],4,2, \
-INIT_VLC_USE_NEW_STATIC);
+INIT_VLC_USE_NEW_STATIC); \
+} while(0)
 for(i=0;i<8;i++){
 init_dc_vlc( j_dc_vlc[0][i], x8_dc_highquant_table[i][0]);
 init_dc_vlc( j_dc_vlc[1][i], x8_dc_lowquant_table [i][0]);
@@ -96,7 +98,7 @@ static av_cold void x8_vlc_init(void){
 #undef init_dc_vlc
 
 //set orient tables
-#define init_or_vlc(dst,src) \
+#define init_or_vlc(dst,src) do { \
 dst.table = [offset]; \
 dst.table_allocated = sizes[sizeidx]; \
 offset += sizes[sizeidx++]; \
@@ -104,12 +106,13 @@ static av_cold void x8_vlc_init(void){
 OR_VLC_BITS,12, \
 [1],4,2, \
 [0],4,2, \
-INIT_VLC_USE_NEW_STATIC);
+INIT_VLC_USE_NEW_STATIC); \
+} while(0)
 for(i=0;i<2;i++){
 init_or_vlc( j_orient_vlc[0][i], x8_orient_highquant_table[i][0]);
 }
 for(i=0;i<4;i++){
-init_or_vlc( j_orient_vlc[1][i], x8_orient_lowquant_table [i][0])
+init_or_vlc( j_orient_vlc[1][i], x8_orient_lowquant_table [i][0]);
 }
 if (offset != sizeof(table)/sizeof(VLC_TYPE)/2)
 av_log(NULL, AV_LOG_ERROR, "table size %i does not match needed %i\n", 
(int)(sizeof(table)/sizeof(VLC_TYPE)/2), offset);
-- 
2.7.3

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


[libav-devel] [PATCH 12/25] intrax8: Keep a reference to the context idctdsp

2016-03-19 Thread Vittorio Giovara
Use it instead of the embedded mpegvideo one. Update init function
signature to load it directly from the callers.
---
 configure|  1 +
 libavcodec/intrax8.c | 14 --
 libavcodec/intrax8.h |  6 +-
 libavcodec/vc1dec.c  |  2 +-
 libavcodec/wmv2dec.c |  2 +-
 5 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 56d3bbf..493bbc7 100755
--- a/configure
+++ b/configure
@@ -1860,6 +1860,7 @@ error_resilience_select="me_cmp"
 faandct_deps="faan fdctdsp"
 faanidct_deps="faan idctdsp"
 h264dsp_select="startcode"
+intrax8_select="idctdsp"
 mdct_select="fft"
 rdft_select="fft"
 me_cmp_select="fdctdsp idctdsp pixblockdsp"
diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index bb2ee8f..b1933a5 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -490,7 +490,7 @@ static void x8_ac_compensation(IntraX8Context *const w, int 
const direction,
 {
 MpegEncContext *const s = w->s;
 int t;
-#define B(x, y) s->block[0][s->idsp.idct_permutation[(x) + (y) * 8]]
+#define B(x, y) s->block[0][w->idsp.idct_permutation[(x) + (y) * 8]]
 #define T(x)  ((x) * dc_level + 0x8000) >> 16;
 switch (direction) {
 case 0:
@@ -703,7 +703,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, 
const int chroma)

s->current_picture.f->linesize[!!chroma]);
 }
 if (!zeros_only)
-s->idsp.idct_add(w->dest[chroma],
+w->idsp.idct_add(w->dest[chroma],
  s->current_picture.f->linesize[!!chroma],
  s->block[0]);
 
@@ -742,12 +742,14 @@ static void x8_init_block_index(IntraX8Context *w, 
AVFrame *frame, int mb_y)
 w->dest[2] += (mb_y & (~1)) * uvlinesize << 2;
 }
 
-av_cold int ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s)
+av_cold int ff_intrax8_common_init(IntraX8Context *w, IDCTDSPContext *idsp,
+   MpegEncContext *const s)
 {
 int ret = x8_vlc_init();
 if (ret < 0)
 return ret;
 
+w->idsp = *idsp;
 w->s = s;
 
 // two rows, 2 blocks per cannon mb
@@ -755,11 +757,11 @@ av_cold int ff_intrax8_common_init(IntraX8Context *w, 
MpegEncContext *const s)
 if (!w->prediction_table)
 return AVERROR(ENOMEM);
 
-ff_init_scantable(s->idsp.idct_permutation, >scantable[0],
+ff_init_scantable(w->idsp.idct_permutation, >scantable[0],
   ff_wmv1_scantable[0]);
-ff_init_scantable(s->idsp.idct_permutation, >scantable[1],
+ff_init_scantable(w->idsp.idct_permutation, >scantable[1],
   ff_wmv1_scantable[2]);
-ff_init_scantable(s->idsp.idct_permutation, >scantable[2],
+ff_init_scantable(w->idsp.idct_permutation, >scantable[2],
   ff_wmv1_scantable[3]);
 
 ff_intrax8dsp_init(>dsp);
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
index e2532f8..ef88d83 100644
--- a/libavcodec/intrax8.h
+++ b/libavcodec/intrax8.h
@@ -21,6 +21,7 @@
 
 #include "get_bits.h"
 #include "mpegvideo.h"
+#include "idctdsp.h"
 #include "intrax8dsp.h"
 
 typedef struct IntraX8Context {
@@ -37,6 +38,7 @@ typedef struct IntraX8Context {
 // set by the caller codec
 MpegEncContext *s;
 IntraX8DSPContext dsp;
+IDCTDSPContext idsp;
 int quant;
 int dquant;
 int qsum;
@@ -61,10 +63,12 @@ typedef struct IntraX8Context {
  * Initialize IntraX8 frame decoder.
  * Requires valid MpegEncContext with valid s->mb_width before calling.
  * @param w pointer to IntraX8Context
+ * @param idsp pointer to IDCTDSPContext
  * @param s pointer to MpegEncContext of the parent codec
  * @return 0 on success, a negative AVERROR value on error
  */
-int ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s);
+int ff_intrax8_common_init(IntraX8Context *w, IDCTDSPContext *idsp,
+   MpegEncContext *const s);
 
 /**
  * Destroy IntraX8 frame structure.
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 76f3591..948626c 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -371,7 +371,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 v->mv_f_next[0] = v->mv_f_next_base + s->b8_stride + 1;
 v->mv_f_next[1] = v->mv_f_next[0] + (s->b8_stride * (mb_height * 2 + 
1) + s->mb_stride * (mb_height + 1) * 2);
 
-ret = ff_intrax8_common_init(>x8,s);
+ret = ff_intrax8_common_init(>x8, >idsp, s);
 if (ret < 0)
 goto error;
 
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 5bfedbd..03b949e 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -471,7 +471,7 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
 
 ff_wmv2_common_init(w);
 
-return ff_intrax8_common_init(>x8, >s);
+return ff_intrax8_common_init(>x8, >s.idsp, >s);
 }
 
 static av_cold int wmv2_decode_end(AVCodecContext *avctx)
-- 
2.7.3

___
libav-devel 

[libav-devel] [PATCH 11/25] intrax8: Make x8_init_block_index not use mpegvideo fields

2016-03-19 Thread Vittorio Giovara
---
 libavcodec/intrax8.c | 23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 3993c57..bb2ee8f 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -725,22 +725,21 @@ block_placed:
 }
 
 // FIXME maybe merge with ff_*
-static void x8_init_block_index(IntraX8Context *w)
+static void x8_init_block_index(IntraX8Context *w, AVFrame *frame, int mb_y)
 {
-MpegEncContext *const s = w->s;
-// not s->linesize as this would be wrong for field pics
+// not parent codec linesize as this would be wrong for field pics
 // not that IntraX8 has interlacing support ;)
-const int linesize   = s->current_picture.f->linesize[0];
-const int uvlinesize = s->current_picture.f->linesize[1];
+const int linesize   = frame->linesize[0];
+const int uvlinesize = frame->linesize[1];
 
-w->dest[0] = s->current_picture.f->data[0];
-w->dest[1] = s->current_picture.f->data[1];
-w->dest[2] = s->current_picture.f->data[2];
+w->dest[0] = frame->data[0];
+w->dest[1] = frame->data[1];
+w->dest[2] = frame->data[2];
 
-w->dest[0] +=  s->mb_y * linesize << 3;
+w->dest[0] +=  mb_y * linesize << 3;
 // chroma blocks are on add rows
-w->dest[1] += (s->mb_y & (~1)) * uvlinesize << 2;
-w->dest[2] += (s->mb_y & (~1)) * uvlinesize << 2;
+w->dest[1] += (mb_y & (~1)) * uvlinesize << 2;
+w->dest[2] += (mb_y & (~1)) * uvlinesize << 2;
 }
 
 av_cold int ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s)
@@ -796,7 +795,7 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, int 
dquant,
 x8_reset_vlc_tables(w);
 
 for (s->mb_y = 0; s->mb_y < s->mb_height * 2; s->mb_y++) {
-x8_init_block_index(w);
+x8_init_block_index(w, s->current_picture.f, s->mb_y);
 mb_xy = (s->mb_y >> 1) * s->mb_stride;
 
 for (s->mb_x = 0; s->mb_x < s->mb_width * 2; s->mb_x++) {
-- 
2.7.3

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


[libav-devel] [PATCH 04/25] intrax8: Split one comment on multiple lines where it applies

2016-03-19 Thread Vittorio Giovara
---
 libavcodec/intrax8.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

Taken out of the k patch.

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 4887643..b951684 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -152,11 +152,11 @@ static inline int x8_get_orient_vlc(IntraX8Context * w){
 return get_vlc2(>gb, w->j_orient_vlc->table, OR_VLC_BITS, OR_VLC_MTD);
 }
 
-#define extra_bits(eb) (eb)
-#define extra_run   (0xFF<<8)
-#define extra_level (0x00<<8)
-#define   run_offset(r)((r)<<16)
-#define level_offset(l)((l)<<24)
+#define extra_bits(eb)  (eb)// 3 bits
+#define extra_run   (0xFF << 8) // 1 bit
+#define extra_level (0x00 << 8) // 1 bit
+#define run_offset(r)   ((r) << 16) // 6 bits
+#define level_offset(l) ((l) << 24) // 5 bits
 static const uint32_t ac_decode_table[]={
 /*46*/ extra_bits(3) |  extra_run  | run_offset(16) | level_offset( 0),
 /*47*/ extra_bits(3) |  extra_run  | run_offset(24) | level_offset( 0),
@@ -193,7 +193,6 @@ static const uint32_t ac_decode_table[]={
 /*71*/ extra_bits(2) | extra_level | run_offset( 1) | level_offset( 3),
 /*72*/ extra_bits(3) | extra_level | run_offset( 1) | level_offset( 7),
 };
-//extra_bits = 3bits; extra_run/level = 1 bit; run_offset = 6bits; 
level_offset = 5 bits;
 #undef extra_bits
 #undef extra_run
 #undef extra_level
-- 
2.7.3

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


[libav-devel] [PATCH 10/25] intrax8: Use local destination buffers

2016-03-19 Thread Vittorio Giovara
These buffers are just a way to store frame pointers and be able to
modify them without touching the original ones.

The two dependent decoders (WMV2 and VC1) do not need special care for
these fields: the former does not seem to use the dest buffers, while
the latter reinits them every time to the current frame data buffers.

So only keep a local copy rather than the one from mpegvideo.
---
 libavcodec/intrax8.c | 35 ++-
 libavcodec/intrax8.h |  1 +
 2 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 0c720b0..3993c57 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -333,7 +333,7 @@ static int x8_setup_spatial_predictor(IntraX8Context *const 
w, const int chroma)
 int sum;
 int quant;
 
-w->dsp.setup_spatial_compensation(s->dest[chroma], s->sc.edge_emu_buffer,
+w->dsp.setup_spatial_compensation(w->dest[chroma], s->sc.edge_emu_buffer,
   s->current_picture.f->linesize[chroma > 
0],
   , , w->edges);
 if (chroma) {
@@ -669,7 +669,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, 
const int chroma)
 dc_level += (w->predicted_dc * divide_quant + (1 << 12)) >> 13;
 
 dsp_x8_put_solidcolor(av_clip_uint8((dc_level * dc_quant + 4) >> 
3),
-  s->dest[chroma],
+  w->dest[chroma],
   s->current_picture.f->linesize[!!chroma]);
 
 goto block_placed;
@@ -695,15 +695,15 @@ static int x8_decode_intra_mb(IntraX8Context *const w, 
const int chroma)
 }
 
 if (w->flat_dc) {
-dsp_x8_put_solidcolor(w->predicted_dc, s->dest[chroma],
+dsp_x8_put_solidcolor(w->predicted_dc, w->dest[chroma],
   s->current_picture.f->linesize[!!chroma]);
 } else {
 w->dsp.spatial_compensation[w->orient](s->sc.edge_emu_buffer,
-   s->dest[chroma],
+   w->dest[chroma],

s->current_picture.f->linesize[!!chroma]);
 }
 if (!zeros_only)
-s->idsp.idct_add(s->dest[chroma],
+s->idsp.idct_add(w->dest[chroma],
  s->current_picture.f->linesize[!!chroma],
  s->block[0]);
 
@@ -712,7 +712,7 @@ block_placed:
 x8_update_predictions(w, w->orient, n);
 
 if (s->loop_filter) {
-uint8_t *ptr = s->dest[chroma];
+uint8_t *ptr = w->dest[chroma];
 int linesize = s->current_picture.f->linesize[!!chroma];
 
 if (!((w->edges & 2) || (zeros_only && (w->orient | 4) == 4)))
@@ -725,21 +725,22 @@ block_placed:
 }
 
 // FIXME maybe merge with ff_*
-static void x8_init_block_index(MpegEncContext *s)
+static void x8_init_block_index(IntraX8Context *w)
 {
+MpegEncContext *const s = w->s;
 // not s->linesize as this would be wrong for field pics
 // not that IntraX8 has interlacing support ;)
 const int linesize   = s->current_picture.f->linesize[0];
 const int uvlinesize = s->current_picture.f->linesize[1];
 
-s->dest[0] = s->current_picture.f->data[0];
-s->dest[1] = s->current_picture.f->data[1];
-s->dest[2] = s->current_picture.f->data[2];
+w->dest[0] = s->current_picture.f->data[0];
+w->dest[1] = s->current_picture.f->data[1];
+w->dest[2] = s->current_picture.f->data[2];
 
-s->dest[0] +=  s->mb_y * linesize << 3;
+w->dest[0] +=  s->mb_y * linesize << 3;
 // chroma blocks are on add rows
-s->dest[1] += (s->mb_y & (~1)) * uvlinesize << 2;
-s->dest[2] += (s->mb_y & (~1)) * uvlinesize << 2;
+w->dest[1] += (s->mb_y & (~1)) * uvlinesize << 2;
+w->dest[2] += (s->mb_y & (~1)) * uvlinesize << 2;
 }
 
 av_cold int ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s)
@@ -795,7 +796,7 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, int 
dquant,
 x8_reset_vlc_tables(w);
 
 for (s->mb_y = 0; s->mb_y < s->mb_height * 2; s->mb_y++) {
-x8_init_block_index(s);
+x8_init_block_index(w);
 mb_xy = (s->mb_y >> 1) * s->mb_stride;
 
 for (s->mb_x = 0; s->mb_x < s->mb_width * 2; s->mb_x++) {
@@ -818,8 +819,8 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, int 
dquant,
 if (x8_decode_intra_mb(w, 2))
 goto error;
 
-s->dest[1] += 8;
-s->dest[2] += 8;
+w->dest[1] += 8;
+w->dest[2] += 8;
 
 /* emulate MB info in the relevant tables */
 s->mbskip_table[mb_xy] = 0;
@@ -827,7 +828,7 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, int 
dquant,
 s->current_picture.qscale_table[mb_xy] = w->quant;
 mb_xy++;
 }

[libav-devel] [PATCH 01/25] fate: Add test for WMV2 with jframes

2016-03-19 Thread Vittorio Giovara
---
 tests/fate/microsoft.mak|   3 +
 tests/ref/fate/wmv8-intrax8 | 475 
 2 files changed, 478 insertions(+)
 create mode 100644 tests/ref/fate/wmv8-intrax8

This test breaks on an oracle box with gcc-4.4. I carried out a minimum
investigation and managed to isolate the issue to optimization level: when
compiled with -O2 gcc-4.4 produces the expected results, while -O3 generates
differing hashes. Note that with -O2 and the other 6-7 additional optimizations
that -O3 enables, the test still works fine, it's something that is triggered
when -O3 is explicitly passed in.

I don't have sample code to demonstrate this is a compiler bug, but I would
rather have this section of the code covered by this test and update
the gcc version on the oracle box, than trying to isolate the issue more.
However, I'd be more than happy to help anybody willing to work on this.

Since I don't want to create controversy, if there is no consensus I'll simply
drop this patch, and leave this portion of code untested. The changes brought
in by this set do not affect this test at all.

Vittorio

diff --git a/tests/fate/microsoft.mak b/tests/fate/microsoft.mak
index 30bd35a..4a67468 100644
--- a/tests/fate/microsoft.mak
+++ b/tests/fate/microsoft.mak
@@ -38,6 +38,9 @@ fate-wmv8-drm-nodec: CMD = framecrc -cryptokey 
137381538c84c068111902a59c5cf6c34
 FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, WMV3) += $(FATE_WMV8_DRM)
 fate-wmv8_drm: $(FATE_WMV8_DRM)
 
+FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, WMV2) += fate-wmv8-intrax8
+fate-wmv8-intrax8: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/wmv8/wmv8_x8intra.wmv -an
+
 FATE_VC1-$(CONFIG_VC1_DEMUXER) += fate-vc1_sa00040
 fate-vc1_sa00040: CMD = framecrc -i $(TARGET_SAMPLES)/vc1/SA00040.vc1
 
diff --git a/tests/ref/fate/wmv8-intrax8 b/tests/ref/fate/wmv8-intrax8
new file mode 100644
index 000..103e8da
--- /dev/null
+++ b/tests/ref/fate/wmv8-intrax8
@@ -0,0 +1,475 @@
+#tb 0: 1/1000
+0,  0,  0,0,   115200, 0x03fbd838
+0,200,200,0,   115200, 0x8911d86f
+0,266,266,0,   115200, 0x7c5dd82e
+0,333,333,0,   115200, 0x7c5ed82e
+0,   2000,   2000,0,   115200, 0xd323d838
+0,   2066,   2066,0,   115200, 0x6e7479ab
+0,   2133,   2133,0,   115200, 0x14674bf6
+0,   2200,   2200,0,   115200, 0x074c2e3d
+0,   2266,   2266,0,   115200, 0x9b3025ef
+0,   2333,   2333,0,   115200, 0x76882dae
+0,   2400,   2400,0,   115200, 0xedf3421b
+0,   2466,   2466,0,   115200, 0xb5378486
+0,   2533,   2533,0,   115200, 0xc4a53420
+0,   2600,   2600,0,   115200, 0x559cb60f
+0,   2666,   2666,0,   115200, 0xcc034ddd
+0,   2733,   2733,0,   115200, 0xb77b7779
+0,   2800,   2800,0,   115200, 0x0ad9c3e6
+0,   2866,   2866,0,   115200, 0x4e673027
+0,   2933,   2933,0,   115200, 0x54717979
+0,   3000,   3000,0,   115200, 0xf9e557c9
+0,   3066,   3066,0,   115200, 0xbdcf6358
+0,   3133,   3133,0,   115200, 0xd55c7bb7
+0,   3200,   3200,0,   115200, 0x78d171e7
+0,   3266,   3266,0,   115200, 0x28715816
+0,   ,   ,0,   115200, 0x58740b8a
+0,   3400,   3400,0,   115200, 0x86c10f18
+0,   3466,   3466,0,   115200, 0x903918f9
+0,   3533,   3533,0,   115200, 0x7f742394
+0,   3600,   3600,0,   115200, 0xd3a91d44
+0,   3666,   3666,0,   115200, 0x24452563
+0,   3733,   3733,0,   115200, 0x1b0c320e
+0,   3800,   3800,0,   115200, 0x3a493c8e
+0,   3866,   3866,0,   115200, 0xebe445ec
+0,   3933,   3933,0,   115200, 0xd2c54c8c
+0,   4000,   4000,0,   115200, 0x4aa15593
+0,   4066,   4066,0,   115200, 0x19a35cc1
+0,   4133,   4133,0,   115200, 0x968c6ee7
+0,   4200,   4200,0,   115200, 0x9f7c7808
+0,   4266,   4266,0,   115200, 0xa23980ee
+0,   4333,   4333,0,   115200, 0xcf3089c3
+0,   4400,   4400,0,   115200, 0x43f78d5c
+0,   4466,   4466,0,   115200, 0x43caa1d4
+0,   4533,   4533,0,   115200, 0x025594c3
+0,   4600,   4600,0,   115200, 0x5ec8a11c
+0,   4666,   4666,0,   115200, 0x7f2a959b
+0,   4733,   4733,0,   115200, 0xc602852d
+0,   4800,   4800,0,   115200, 0x67737ef5
+0,   4866,   4866,0,   115200, 0x81e06efe
+0,   4933,   4933,0,   115200, 0xdb0a484f
+0,   5000,   5000,0,   115200, 0xf30e4418
+0,   5066,   5066,0,   115200, 0xbdd1310d
+0,  

[libav-devel] [PATCH 16/25] intrax8: Keep a reference to the GetBitContext reader

2016-03-19 Thread Vittorio Giovara
Helps in decoupling this code from mpegvideo.
---
 libavcodec/intrax8.c   | 35 ---
 libavcodec/intrax8.h   |  4 +++-
 libavcodec/vc1_block.c |  2 +-
 libavcodec/wmv2dec.c   |  2 +-
 4 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index fae9bc8..336551f 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -132,7 +132,6 @@ static void x8_reset_vlc_tables(IntraX8Context *w)
 
 static inline void x8_select_ac_table(IntraX8Context *const w, int mode)
 {
-MpegEncContext *const s = w->s;
 int table_index;
 
 assert(mode < 4);
@@ -140,7 +139,7 @@ static inline void x8_select_ac_table(IntraX8Context *const 
w, int mode)
 if (w->j_ac_vlc[mode])
 return;
 
-table_index   = get_bits(>gb, 3);
+table_index   = get_bits(w->gb, 3);
 // 2 modes use same tables
 w->j_ac_vlc[mode] = _ac_vlc[w->quant < 13][mode >> 1][table_index];
 
@@ -149,16 +148,14 @@ static inline void x8_select_ac_table(IntraX8Context 
*const w, int mode)
 
 static inline int x8_get_orient_vlc(IntraX8Context *w)
 {
-MpegEncContext *const s = w->s;
-
 if (!w->j_orient_vlc) {
-int table_index = get_bits(>gb, 1 + (w->quant < 13));
+int table_index = get_bits(w->gb, 1 + (w->quant < 13));
 w->j_orient_vlc = _orient_vlc[w->quant < 13][table_index];
 }
 assert(w->j_orient_vlc);
 assert(w->j_orient_vlc->table);
 
-return get_vlc2(>gb, w->j_orient_vlc->table, OR_VLC_BITS, OR_VLC_MTD);
+return get_vlc2(w->gb, w->j_orient_vlc->table, OR_VLC_BITS, OR_VLC_MTD);
 }
 
 #define extra_bits(eb)  (eb)// 3 bits
@@ -211,11 +208,10 @@ static const uint32_t ac_decode_table[] = {
 static void x8_get_ac_rlf(IntraX8Context *const w, const int mode,
   int *const run, int *const level, int *const final)
 {
-MpegEncContext *const s = w->s;
 int i, e;
 
 //x8_select_ac_table(w,mode);
-i = get_vlc2(>gb, w->j_ac_vlc[mode]->table, AC_VLC_BITS, AC_VLC_MTD);
+i = get_vlc2(w->gb, w->j_ac_vlc[mode]->table, AC_VLC_BITS, AC_VLC_MTD);
 
 if (i < 46) { // [0-45]
 int t, l;
@@ -252,7 +248,7 @@ static void x8_get_ac_rlf(IntraX8Context *const w, const 
int mode,
 i -= 46;
 sm = ac_decode_table[i];
 
-e= get_bits(>gb, sm & 0xF);
+e= get_bits(w->gb, sm & 0xF);
 sm >>= 8;// 3bits
 mask = sm & 0xff;
 sm >>= 8;// 1bit
@@ -269,13 +265,13 @@ static void x8_get_ac_rlf(IntraX8Context *const w, const 
int mode,
 };
 
 (*final) = !(i & 1);
-e= get_bits(>gb, 5); // get the extra bits
+e= get_bits(w->gb, 5); // get the extra bits
 (*run)   = crazy_mix_runlevel[e] >> 4;
 (*level) = crazy_mix_runlevel[e] & 0x0F;
 } else {
-(*level) = get_bits(>gb, 7 - 3 * (i & 1));
-(*run)   = get_bits(>gb, 6);
-(*final) = get_bits1(>gb);
+(*level) = get_bits(w->gb, 7 - 3 * (i & 1));
+(*run)   = get_bits(w->gb, 6);
+(*final) = get_bits1(w->gb);
 }
 return;
 }
@@ -290,19 +286,18 @@ static const uint8_t dc_index_offset[] = {
 static int x8_get_dc_rlf(IntraX8Context *const w,
  int const mode, int *const level, int *const final)
 {
-MpegEncContext *const s = w->s;
 int i, e, c;
 
 assert(mode < 3);
 if (!w->j_dc_vlc[mode]) {
-int table_index = get_bits(>gb, 3);
+int table_index = get_bits(w->gb, 3);
 // 4 modes, same table
 w->j_dc_vlc[mode] = _dc_vlc[w->quant < 13][table_index];
 }
 assert(w->j_dc_vlc);
 assert(w->j_dc_vlc[mode]->table);
 
-i = get_vlc2(>gb, w->j_dc_vlc[mode]->table, DC_VLC_BITS, DC_VLC_MTD);
+i = get_vlc2(w->gb, w->j_dc_vlc[mode]->table, DC_VLC_BITS, DC_VLC_MTD);
 
 /* (i >= 17) { i -= 17; final =1; } */
 c= i > 16;
@@ -316,7 +311,7 @@ static int x8_get_dc_rlf(IntraX8Context *const w,
 c  = (i + 1) >> 1; // hackish way to calculate dc_extra_sbits[]
 c -= c > 1;
 
-e = get_bits(>gb, c); // get the extra bits
+e = get_bits(w->gb, c); // get the extra bits
 i = dc_index_offset[i] + (e >> 1);
 
 e= -(e & 1); // 0, 0xff
@@ -645,7 +640,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, 
const int chroma)
 level  = (level + 1) * w->dquant;
 level += w->qsum;
 
-sign  = -get_bits1(>gb);
+sign  = -get_bits1(w->gb);
 level = (level ^ sign) - sign;
 
 if (use_quant_matrix) {
@@ -774,18 +769,20 @@ av_cold void ff_intrax8_common_end(IntraX8Context *w)
 }
 
 int ff_intrax8_decode_picture(IntraX8Context *const w, Picture *pict,
+  GetBitContext *gb,
   int dquant, int quant_offset, int loopfilter)
 {
 MpegEncContext *const s = w->s;
 int mb_xy;

[libav-devel] [PATCH] indeo4: Rework stream analysis report

2016-03-19 Thread Vittorio Giovara
* Change log level from error to debug
* Print report  after the first decoded frame, not at the end of decoding
* Drop macro guard and use a context variable instead

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 libavcodec/indeo4.c | 11 +--
 libavcodec/ivi.c| 33 -
 libavcodec/ivi.h|  4 +---
 3 files changed, 18 insertions(+), 30 deletions(-)

diff --git a/libavcodec/indeo4.c b/libavcodec/indeo4.c
index 64ed8cd..4ec09dc 100644
--- a/libavcodec/indeo4.c
+++ b/libavcodec/indeo4.c
@@ -119,17 +119,13 @@ static int decode_pic_hdr(IVI45DecContext *ctx, 
AVCodecContext *avctx)
 return AVERROR_INVALIDDATA;
 }
 
-#if IVI4_STREAM_ANALYSER
 if (ctx->frame_type == IVI4_FRAMETYPE_BIDIR)
 ctx->has_b_frames = 1;
-#endif
 
 ctx->transp_status = get_bits1(>gb);
-#if IVI4_STREAM_ANALYSER
 if (ctx->transp_status) {
 ctx->has_transp = 1;
 }
-#endif
 
 /* unknown bit: Mac decoder ignores this bit, XANIM returns error */
 if (get_bits1(>gb)) {
@@ -166,9 +162,7 @@ static int decode_pic_hdr(IVI45DecContext *ctx, 
AVCodecContext *avctx)
 if (get_bits1(>gb)) {
 pic_conf.tile_height = scale_tile_size(pic_conf.pic_height, 
get_bits(>gb, 4));
 pic_conf.tile_width  = scale_tile_size(pic_conf.pic_width,  
get_bits(>gb, 4));
-#if IVI4_STREAM_ANALYSER
 ctx->uses_tiling = 1;
-#endif
 } else {
 pic_conf.tile_height = pic_conf.pic_height;
 pic_conf.tile_width  = pic_conf.pic_width;
@@ -293,10 +287,8 @@ static int decode_band_hdr(IVI45DecContext *ctx, 
IVIBandDesc *band,
band->is_halfpel);
 return AVERROR_INVALIDDATA;
 }
-#if IVI4_STREAM_ANALYSER
 if (!band->is_halfpel)
 ctx->uses_fullpel = 1;
-#endif
 
 band->checksum_present = get_bits1(>gb);
 if (band->checksum_present)
@@ -328,10 +320,8 @@ static int decode_band_hdr(IVI45DecContext *ctx, 
IVIBandDesc *band,
 return AVERROR_PATCHWELCOME;
 }
 
-#if IVI4_STREAM_ANALYSER
 if ((transform_id >= 0 && transform_id <= 2) || transform_id == 10)
 ctx->uses_haar = 1;
-#endif
 
 band->inv_transform = transforms[transform_id].inv_trans;
 band->dc_transform  = transforms[transform_id].dc_trans;
@@ -640,6 +630,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 ctx->is_nonnull_frame = is_nonnull_frame;
 
 ctx->is_indeo4 = 1;
+ctx->show_indeo4_info = 1;
 
 ctx->dst_buf   = 0;
 ctx->ref_buf   = 1;
diff --git a/libavcodec/ivi.c b/libavcodec/ivi.c
index 9762eeb..caa3fe6 100644
--- a/libavcodec/ivi.c
+++ b/libavcodec/ivi.c
@@ -1133,6 +1133,22 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame,
 }
 }
 
+if (ctx->show_indeo4_info) {
+if (ctx->is_scalable)
+av_log(avctx, AV_LOG_DEBUG, "This video uses scalability mode\n");
+if (ctx->uses_tiling)
+av_log(avctx, AV_LOG_DEBUG, "This video uses local decoding\n");
+if (ctx->has_b_frames)
+av_log(avctx, AV_LOG_DEBUG, "This video contains B-frames\n");
+if (ctx->has_transp)
+av_log(avctx, AV_LOG_DEBUG, "Transparency mode is enabled\n");
+if (ctx->uses_haar)
+av_log(avctx, AV_LOG_DEBUG, "This video uses Haar transform\n");
+if (ctx->uses_fullpel)
+av_log(avctx, AV_LOG_DEBUG, "This video uses fullpel motion 
vectors\n");
+ctx->show_indeo4_info = 0;
+}
+
 return buf_size;
 }
 
@@ -1148,23 +1164,6 @@ av_cold int ff_ivi_decode_close(AVCodecContext *avctx)
 if (ctx->mb_vlc.cust_tab.table)
 ff_free_vlc(>mb_vlc.cust_tab);
 
-#if IVI4_STREAM_ANALYSER
-if (ctx->is_indeo4) {
-if (ctx->is_scalable)
-av_log(avctx, AV_LOG_ERROR, "This video uses scalability mode!\n");
-if (ctx->uses_tiling)
-av_log(avctx, AV_LOG_ERROR, "This video uses local decoding!\n");
-if (ctx->has_b_frames)
-av_log(avctx, AV_LOG_ERROR, "This video contains B-frames!\n");
-if (ctx->has_transp)
-av_log(avctx, AV_LOG_ERROR, "Transparency mode is enabled!\n");
-if (ctx->uses_haar)
-av_log(avctx, AV_LOG_ERROR, "This video uses Haar transform!\n");
-if (ctx->uses_fullpel)
-av_log(avctx, AV_LOG_ERROR, "This video uses fullpel motion 
vectors!\n");
-}
-#endif
-
 av_frame_free(>p_frame);
 
 return 0;
diff --git a/libavcodec/ivi.h b/libavcodec/ivi.h
index 5dadd9f..c403739 100644
--- a/libavcodec/ivi.h
+++ b/libavcodec/ivi.h
@@ -47,7 +47,6 @@ enum {
 };
 
 #define IVI_VLC_BITS 13 ///< max number of bits of the ivi's huffma

Re: [libav-devel] [PATCH 2/2] vda_h264: Use av_buffer to manage buffers

2016-03-19 Thread Vittorio Giovara
On Tue, Mar 4, 2014 at 7:30 PM, Luca Barbato  wrote:
> From: Sebastien Zwickert 
>
> Fix a buffer leak when seeking occurs.
>
> Signed-off-by: Luca Barbato 
> ---
>  libavcodec/vda_h264.c | 25 -
>  libavcodec/version.h  |  4 ++--
>  2 files changed, 26 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/vda_h264.c b/libavcodec/vda_h264.c
> index e9c4af6..a7183c6 100644
> --- a/libavcodec/vda_h264.c
> +++ b/libavcodec/vda_h264.c
> @@ -107,6 +107,12 @@ static int vda_h264_decode_slice(AVCodecContext *avctx,
>  return 0;
>  }
>
> +static void vda_h264_release_buffer(void *opaque, uint8_t *data)
> +{
> +CVPixelBufferRef cv_buffer = opaque;
> +CVPixelBufferRelease(cv_buffer);
> +}
> +
>  static int vda_h264_end_frame(AVCodecContext *avctx)
>  {
>  H264Context *h  = avctx->priv_data;
> @@ -120,8 +126,25 @@ static int vda_h264_end_frame(AVCodecContext *avctx)
>  status = vda_sync_decode(vda_ctx);
>  frame->data[3] = (void*)vda_ctx->cv_buffer;
>
> -if (status)
> +if (status) {
>  av_log(avctx, AV_LOG_ERROR, "Failed to decode frame (%d)\n", status);
> +return status;
> +}
> +
> +/* VDA workaround to release properly each core video buffer:
> + * we need to create an extra av_buffer with a custom freeing callback
> + * to avoid potential memory leaks. */
> +h->cur_pic_ptr->hwaccel_priv_buf = av_buffer_create(frame->data[0],
> +0,
> +
> vda_h264_release_buffer,
> +vda_ctx->cv_buffer,
> +0);
> +if (!h->cur_pic_ptr->hwaccel_priv_buf) {
> +CVPixelBufferRelease(vda_ctx->cv_buffer);
> +return AVERROR(ENOMEM);
> +}
> +
> +h->cur_pic_ptr->hwaccel_picture_private = 
> h->cur_pic_ptr->hwaccel_priv_buf->data;
>
>  return status;
>  }
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index cdd5a61..a813fc9 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,8 +29,8 @@
>  #include "libavutil/version.h"
>
>  #define LIBAVCODEC_VERSION_MAJOR 55
> -#define LIBAVCODEC_VERSION_MINOR 34
> -#define LIBAVCODEC_VERSION_MICRO  1
> +#define LIBAVCODEC_VERSION_MINOR 35
> +#define LIBAVCODEC_VERSION_MICRO  0
>
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> LIBAVCODEC_VERSION_MINOR, \
> --

Is this patch still needed?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] matroskaenc: Don't set language to empty string, use "und"

2016-03-19 Thread Vittorio Giovara
On Wed, Jul 23, 2014 at 7:03 AM, Anton Khirnov  wrote:
>
> On Tue, 22 Jul 2014 09:38:42 +0200, j...@v2v.cc wrote:
>> On 07/21/2014 09:35 PM, Anton Khirnov wrote:
>> >
>> > On Sun, 20 Jul 2014 15:28:36 +0200, j...@v2v.cc wrote:
>> >> On 07/20/2014 03:13 PM, Anton Khirnov wrote:
>> >>> Could you share the sample?
>> >>> This really sounds like a bug elsewhere that should be fixed.
>> >>
>> >> Here a short clip http://v2v.cc/~j/samples/emtpy_language.mpg
>> >>
>> >
>> > Then your patch does not seem to work.
>> > This was the source of my initial confusion, since in the patch you're 
>> > testing
>> > for a NULL pointer in the tag value, but the dict API should not allow 
>> > that to
>> > happen ever. But in this sample, the value is not a NULL pointer, but an 
>> > empty
>> > string (i.e. a valid pointer pointing to a zero byte), which is a perfectly
>> > valid dictionary entry (though admittedly not a valid language 
>> > description).
>>
>> you are right, not sure why my test did not fail with the first patch.
>> the second patch to mpegts.js works as expected though.
>>
>> > Perhaps we could use the table from libavformat/avlanguage.c to actually 
>> > check
>> > whether the language is valid.
>>
>> that might be a good idea too, do you know if this kind of thing is done
>> somehere else in libav already?
>
> Does not seem so.
>
> But adding a function for checking whether a given string is in the given
> codespace in the table should be simple enough.
>

(this should just provide some context for the previous two pings)
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/2] mpegts: use av_islang before setting language

2016-03-19 Thread Vittorio Giovara
On Thu, Jul 24, 2014 at 3:55 AM, Jan Gerber  wrote:
> ---
>  libavformat/mpegts.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> index 5d8b08c..fa784ac 100644
> --- a/libavformat/mpegts.c
> +++ b/libavformat/mpegts.c
> @@ -29,6 +29,7 @@
> #include "libavcodec/bytestream.h"
> #include "libavcodec/get_bits.h"
> #include "avformat.h"
>+#include "avlanguage.h"
> #include "mpegts.h"
> #include "internal.h"
> #include "avio_internal.h"
> @@ -1414,7 +1415,9 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, 
> AVStream *st, int stream_type
> }
> if (i) {
> language[i - 1] = 0;
> -av_dict_set(>metadata, "language", language, 0);
> +if (av_islang(language)) {
> +av_dict_set(>metadata, "language", language, 0);
> +}
>  }
>  break;
> case 0x05: /* registration descriptor */

also this one needs review
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/2] avlanguage: add av_islang

2016-03-19 Thread Vittorio Giovara
On Thu, Jul 24, 2014 at 3:55 AM, Jan Gerber  wrote:
> ---
>  libavformat/avlanguage.c | 14 ++
>  libavformat/avlanguage.h |  5 +
>  2 files changed, 19 insertions(+)
>
> diff --git a/libavformat/avlanguage.c b/libavformat/avlanguage.c
> index e606ef2..a4b916f 100644
> --- a/libavformat/avlanguage.c
> +++ b/libavformat/avlanguage.c
> @@ -763,3 +763,17 @@ const char *av_convert_lang_to(const char *lang, enum 
> AVLangCodespace target_cod
>
> return NULL;
>  }
> +
> +int av_islang(const char *lang)
> +{
> +const LangEntry *entry = NULL;
> +const int NB_LANGENTRIES = FF_ARRAY_ELEMS(lang_table);
> +
> +entry = bsearch(lang,
> +lang_table,
> +NB_LANGENTRIES,
> +sizeof(LangEntry),
> +lang_table_compare);
> +
> +return entry != NULL;
> +}
> diff --git a/libavformat/avlanguage.h b/libavformat/avlanguage.h
> index 2ec3e2d..24f3187 100644
> --- a/libavformat/avlanguage.h
> +++ b/libavformat/avlanguage.h
> @@ -36,4 +36,9 @@ enum AVLangCodespace {
> */
> const char *av_convert_lang_to(const char *lang, enum AVLangCodespace 
> target_codespace);
>
> +/**
> + * Check if lang is a valid language.
> + */
> +int av_islang(const char *lang);
> +
> #endif /* AVFORMAT_AVLANGUAGE_H */

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


Re: [libav-devel] [RFC] no longer marking native aac encoder as experimental

2016-03-19 Thread Vittorio Giovara
On Sun, Nov 30, 2014 at 6:06 PM, Luca Barbato  wrote:
> On 30/11/14 23:43, Andreas Cadhalpun wrote:
>>
>> On 20.11.2014 17:59, Andreas Cadhalpun wrote:
>>>
>>> Hi,
>>>
>>> currently the native aac encoder is marked as experimental, while the
>>> libvo_aacenc encoder is not.
>>>
>>> However, after reading the wiki [1] and especially the mentioned mail
>>> [2], it seems the native encoder is better.
>>>
>>> Thus I'm wondering if it would make sense to no longer mark the native
>>> aac encoder as experimental.
>>>
>>> This would also solve problems like [3].
>>>
>>> Please comment.
>>
>>
>> Since nobody complained about the idea, I'm attaching a patch for this.
>>
>
> Let me 2 days next week to check if I can reproduce and fix a bug I noticed
> when testing it.
>
> lu

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


Re: [libav-devel] [FFmpeg-devel] [PATCH] aacpsy: avoid norm_fac becoming NaN

2016-03-19 Thread Vittorio Giovara
On Tue, Apr 21, 2015 at 12:50 PM, Andreas Cadhalpun
 wrote:
> On 21.04.2015 02:20, Claudio Freire wrote:
>> On Mon, Apr 20, 2015 at 9:13 PM, Michael Niedermayer  
>> wrote:
>>> On Mon, Apr 20, 2015 at 09:07:14PM -0300, Claudio Freire wrote:
 On Mon, Apr 20, 2015 at 8:59 PM, Claudio Freire  
 wrote:
> On Mon, Apr 20, 2015 at 8:32 PM, Andreas Cadhalpun
>  wrote:
> The long version:
>
> ath should approximate the shape of the absolute hearing threshold, so
> yes, it's best if it really uses the minimum, since that will prevent
> clipping of the ath curve and result in a more accurate threshold
> computation.

 So you agree with my patch fixing minath?
 Or would you prefer a version with:
 minath = ath(3410 - 0.733 * ATH_ADD, ATH_ADD)
>>>
>>> Well, that's not really closer to the minimum (a few tests with gnuplot 
>>> say).
>>
>> Are you sure your plots were done correctly?
>> Because I'm quite sure this is the correct first order approximation
>> of the minimum.
>>
>> For ATH_ADD = 4 this gives 3407.068, which is quite close to Michael's 
>> value
>> (3407.080774800152).
>
> I checked the formula several times, but still, I could have made a 
> mistake.


 This is what I did if you want to check it out (maybe you spot the mistake)

 gnuplot> ath(f,a) = _ath(f/1000.0, a)
 gnuplot> _ath(f,a) = 3.64 * f**(-0.8) - 6.8 * exp(-0.6 * (f-3.4) *
 (f-3.4)) + 6.0 * exp(-0.15 * (f-8.7) * (f-8.7)) + (0.6 + 0.04 * a) *
 0.001 * f * f * f
>>>   ^^
>>> missing * f
>>
>> Much better now :)
>>
>> So yes. I'd say it's a good change.
>
> OK, patch attached.
>
> Best regards,
> Andreas

Is this patch still needed?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] takdec: ensure chan2 is a valid channel index

2016-03-19 Thread Vittorio Giovara
On Tue, Jun 9, 2015 at 8:26 PM, Luca Barbato  wrote:
> On 10/06/15 00:12, Andreas Cadhalpun wrote:
>> If chan2 is not smaller than the number of channels, it can cause
>> segmentation faults due to dereferencing a NULL pointer.
>>
>> Signed-off-by: Andreas Cadhalpun 
>> ---
>>  libavcodec/takdec.c | 6 ++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
>> index a453da8..4225030 100644
>> --- a/libavcodec/takdec.c
>> +++ b/libavcodec/takdec.c
>> @@ -801,6 +801,12 @@ static int tak_decode_frame(AVCodecContext *avctx, void 
>> *data,
>>  if (s->mcdparams[i].present) {
>>  s->mcdparams[i].index = get_bits(gb, 2);
>>  s->mcdparams[i].chan2 = get_bits(gb, 4);
>> +if (s->mcdparams[i].chan2 >= avctx->channels) {
>> +av_log(avctx, AV_LOG_ERROR,
>> +   "invalid channel 2 (%d) for %d 
>> channel(s)\n",
>> +   s->mcdparams[i].chan2, avctx->channels);
>> +return AVERROR_INVALIDDATA;
>> +}
>>  if (s->mcdparams[i].index == 1) {
>>  if ((nbit == s->mcdparams[i].chan2) ||
>>  (ch_mask & 1 << s->mcdparams[i].chan2))
>>
>
> Looks fine to me.

Correct me if I'm wrong but I think this wasn't applied to the tree.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 5/6] avio: Add avio_read wrapper to simplify error checking

2016-03-19 Thread Vittorio Giovara
On Sun, Jun 7, 2015 at 1:07 PM, Luca Barbato  wrote:
> On 07/06/15 16:30, Andreas Cadhalpun wrote:
>> It seems Luca accidentally pushed an old version of this patch.
>> The pushed version still has the ffio_read_size name and Luca's
>> comment about the error handling is also not addressed.
>
> Good thing it is an internal function and thanks for spotting!

Should we start coming back to this?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] img2: Provide an option take the path verbatim

2016-03-19 Thread Vittorio Giovara
On Sat, Feb 7, 2015 at 8:22 AM, Luca Barbato  wrote:
> On 02/02/15 01:36, Luca Barbato wrote:
>> There can be valid files path sporting %-sequences or have
>> files ending with .V in the the same directory but not related.
>> ---
>>
>> Mainly an rfc and pro-memoria.
>>
>
> Derek does it work for your use-case?
>
> lu

Maybe this could go in as is.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] lavf: add a format flag for separate carriers, and an event for detecting carrier presence.

2016-03-19 Thread Vittorio Giovara
On Mon, Jun 8, 2015 at 5:28 AM, John Högberg  wrote:
> Luca Barbato wrote:
>> Please do. I thought about the alternative to support your scenario (beside
>> having a callback API that I'll blog about soonish) and another way to do 
>> that
>> is to have an AVSTREAM_EVENT_FLAG_LOST to signal that the stream is gone and
>> an AVFMT_EVENT_FLAG_ACTIVE_STREAM_CHANGED to signal the fact the number of
>> active stream changed.
>>
>> The semantics compared to metadata update is changed slightly, since we want
>> to keep the AVSTREAM_EVENT_FLAG_LOST as they are until they change while
>> wiping the AVFMT_EVENT_FLAG_ACTIVE_STREAM_CHANGED.
>>
>> This should be enough to avoid to introduce a function to explicitly to check
>> and reset even if I'd consider adding it nonetheless.
>
> A general notification above stream level would be useful, yes. As an aside,
> the new semantics are "present" rather than "lost" as per Anton's feedback. It
> feels like I've submitted every possible way of implementing this right now. 
> :|
>
>> Another option is having a generic AVFMT_EVENT_FLAG_STREAM_EVENT to signal
>> that the stream event flags had been set (and spare some iterations over the
>> stream list).
>>
>> How does it sound?
>
> I'd prefer the generic solution. There's little to be gained by "inheriting" 
> the
> specific flags of the underlying streams since you'll need to check them all
> anyway.
>
>> lu

Is this patch still needed?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [FFmpeg-devel] [PATCH 2/2] matroskadec: validate audio channels and bitdepth

2016-03-19 Thread Vittorio Giovara
On Tue, Jun 16, 2015 at 3:55 PM, Andreas Cadhalpun
 wrote:
> On 16.06.2015 00:37, Luca Barbato wrote:
>> On 16/06/15 00:14, Andreas Cadhalpun wrote:
 I wonder if the sanity check in the decoder would be enough to not have
 other problems down the line.
>>>
>>> No, because the problem is in the two lines below the check.
>>
>> Not here =)
>
> The avio_wl16 calls are also present in Libav and writing something larger
> than 16bit with them is a bug. The av_assert2 in FFmpeg is only a means
> to detect such a bug.
>
 I'd provide an explode mode and as best effort mode I'd just mark the
 data as corrupted.
>>>
>>> What do you mean with marking the data as corrupted?
>>
>> There is a packet flag, AV_PKT_FLAG_CORRUPT, to mark the data that
>> shouldn't be trusted.
>
> This flag is used rather rarely. I'm not convinced that it would be
> particularly useful for this corner case.
>
> Best regards,
> Andreas

Any update about this patch?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] x86: Add SSSE3_SLOW CPU flag and related convenience macros

2016-03-19 Thread Vittorio Giovara
On Tue, Jan 19, 2016 at 7:55 AM, Diego Biurrun  wrote:
> ---
>
> Fixed FAST_SLOW typo.
>
>  doc/APIchanges  | 3 +++
>  libavutil/cpu.h | 1 +
>  libavutil/version.h | 2 +-
>  libavutil/x86/cpu.h | 6 ++
>  4 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index ffa270e..f2e6bea 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,9 @@ libavutil: 2015-08-28
>
>  API changes, most recent first:
>
> +2016-01-19 - xxx - lavu 55.6.0 - cpu.h
> +  Add AV_CPU_FLAG_SSSE3SLOW.
> +
>  2015-xx-xx - xxx - lavc 57.12.0 - avcodec.h
>Add AVCodecDescriptor.profiles and avcodec_profile_name().
>
> diff --git a/libavutil/cpu.h b/libavutil/cpu.h
> index d640e79..deff4cc 100644
> --- a/libavutil/cpu.h
> +++ b/libavutil/cpu.h
> @@ -38,6 +38,7 @@
>  #define AV_CPU_FLAG_SSE3SLOW 0x2000 ///< SSE3 supported, but usually not 
> faster
>  ///< than regular MMX/SSE (e.g. 
> Core1)
>  #define AV_CPU_FLAG_SSSE30x0080 ///< Conroe SSSE3 functions
> +#define AV_CPU_FLAG_SSSE3SLOW 0x400 ///< SSSE3 supported, but usually 
> not faster
>  #define AV_CPU_FLAG_ATOM 0x1000 ///< Atom processor, some SSSE3 
> instructions are slower
>  #define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions
>  #define AV_CPU_FLAG_SSE420x0200 ///< Nehalem SSE4.2 functions
> diff --git a/libavutil/version.h b/libavutil/version.h
> index 25457ac..ebd548f 100644
> --- a/libavutil/version.h
> +++ b/libavutil/version.h
> @@ -54,7 +54,7 @@
>   */
>
>  #define LIBAVUTIL_VERSION_MAJOR 55
> -#define LIBAVUTIL_VERSION_MINOR  5
> +#define LIBAVUTIL_VERSION_MINOR  6
>  #define LIBAVUTIL_VERSION_MICRO  0
>
>  #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
> diff --git a/libavutil/x86/cpu.h b/libavutil/x86/cpu.h
> index 0695436..c0a525d 100644
> --- a/libavutil/x86/cpu.h
> +++ b/libavutil/x86/cpu.h
> @@ -38,6 +38,8 @@
>  #define X86_SSE3_FAST(flags)CPUEXT_FAST(flags, SSE3)
>  #define X86_SSE3_SLOW(flags)CPUEXT_SLOW(flags, SSE3)
>  #define X86_SSSE3(flags)CPUEXT(flags, SSSE3)
> +#define X86_SSSE3_FAST(flags)   CPUEXT_FAST(flags, SSSE3)
> +#define X86_SSSE3_SLOW(flags)   CPUEXT_SLOW(flags, SSSE3)
>  #define X86_SSE4(flags) CPUEXT(flags, SSE4)
>  #define X86_SSE42(flags)CPUEXT(flags, SSE42)
>  #define X86_AVX(flags)  CPUEXT(flags, AVX)
> @@ -60,6 +62,8 @@
>  #define EXTERNAL_SSE3_FAST(flags)   CPUEXT_SUFFIX_FAST(flags, _EXTERNAL, 
> SSE3)
>  #define EXTERNAL_SSE3_SLOW(flags)   CPUEXT_SUFFIX_SLOW(flags, _EXTERNAL, 
> SSE3)
>  #define EXTERNAL_SSSE3(flags)   CPUEXT_SUFFIX(flags, _EXTERNAL, SSSE3)
> +#define EXTERNAL_SSSE3_FAST(flags)  CPUEXT_SUFFIX_FAST(flags, _EXTERNAL, 
> SSSE3)
> +#define EXTERNAL_SSSE3_SLOW(flags)  CPUEXT_SUFFIX_SLOW(flags, _EXTERNAL, 
> SSSE3)
>  #define EXTERNAL_SSE4(flags)CPUEXT_SUFFIX(flags, _EXTERNAL, SSE4)
>  #define EXTERNAL_SSE42(flags)   CPUEXT_SUFFIX(flags, _EXTERNAL, SSE42)
>  #define EXTERNAL_AVX(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AVX)
> @@ -82,6 +86,8 @@
>  #define INLINE_SSE3_FAST(flags) CPUEXT_SUFFIX_FAST(flags, _INLINE, SSE3)
>  #define INLINE_SSE3_SLOW(flags) CPUEXT_SUFFIX_SLOW(flags, _INLINE, SSE3)
>  #define INLINE_SSSE3(flags) CPUEXT_SUFFIX(flags, _INLINE, SSSE3)
> +#define INLINE_SSSE3_FAST(flags)CPUEXT_SUFFIX_FAST(flags, _INLINE, SSSE3)
> +#define INLINE_SSSE3_SLOW(flags)CPUEXT_SUFFIX_SLOW(flags, _INLINE, SSSE3)
>  #define INLINE_SSE4(flags)  CPUEXT_SUFFIX(flags, _INLINE, SSE4)
>  #define INLINE_SSE42(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE42)
>  #define INLINE_AVX(flags)   CPUEXT_SUFFIX(flags, _INLINE, AVX)

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


Re: [libav-devel] [PATCH] movenc: check for the error in the AVIOContext and write

2016-03-19 Thread Vittorio Giovara
On Thu, Aug 27, 2015 at 7:20 AM, Luca Barbato  wrote:
> On 27/08/15 13:10, Martin Storsjö wrote:
>> On Thu, 27 Aug 2015, Alexandra Hájková wrote:
>>
>>> the error message if there is some error. MOV has its header
>>> at the end of the file so the output will be corrupted if
>>> writing to the output will fail before header is written.
>>
>> This isn't true for all mov modes, only the non-fragmented ones.
>>
>>> Bug-Id: 881
>>> ---
>>> libavformat/movenc.c | 5 +
>>> 1 file changed, 5 insertions(+)
>>>
>>> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
>>> index ee2f089..a6436e6 100644
>>> --- a/libavformat/movenc.c
>>> +++ b/libavformat/movenc.c
>>> @@ -3559,6 +3559,11 @@ int ff_mov_write_packet(AVFormatContext *s,
>>> AVPacket *pkt)
>>> if (trk->hint_track >= 0 && trk->hint_track < mov->nb_streams)
>>> ff_mov_add_hinted_packet(s, pkt, trk->hint_track, trk->entry,
>>>  reformatted_data, size);
>>> +if (pb->error < 0) {
>>> +av_log(s, AV_LOG_ERROR, "Error while writing mov packet, "
>>> +   "the output will be corrupted. \n");
>>
>> Stray space before the newline
>>
>>> +ret = pb->error;
>>> +}
>>
>> The message isn't completely true if mov->flags & FF_MOV_FLAG_FRAGMENT
>> is set. I guess it still makes sense to return the error code though,
>> but the file won't be corrupted, only truncated.
>>
>> Even though this might be important for fixing this particular bug,
>> wouldn't it make more sense to do this generically like in Sean's patch?
>> Does this add anything else than just the message?
>>
>
> I'd keep some error message mov-specific and have it also in the generic
> path (in which it would be less problematic).
>
> lu

Any update on this patch?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] hevc: Parse the encoder info SEI

2016-03-19 Thread Vittorio Giovara
On Sat, Oct 17, 2015 at 6:25 PM, Luca Barbato  wrote:
> On 16/10/15 19:46, Anton Khirnov wrote:
>>
>> If the block above got executed, won't it attemp to skip it again?
>
>
> it starts skipping from whenever `i` was before, alternatively I can just
> process all the buffer and not just the first arbitrary amount of it.
>
> lu

Ping on this patch. I had a comment too that got lost

> +for (i = 0; i < sizeof(info) - 1 && i < size; i++) {
> +int byte = get_bits(gb, 8);
> +if (isprint(byte))
> +info[i] = byte;

this if is not useful, skipping a byte here will set info[i] to 0,
making it end the string on printing.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] asfdec: hadle invalid Object size properly

2016-03-19 Thread Vittorio Giovara
On Mon, Feb 8, 2016 at 3:12 PM, Vittorio Giovara
<vittorio.giov...@gmail.com> wrote:
> On Tue, Jun 30, 2015 at 5:19 AM, Luca Barbato <lu_z...@gentoo.org> wrote:
>> On 30/06/15 11:35, Alexandra Hájková wrote:
>>> ---
>>>  libavformat/asfdec.c | 12 ++--
>>>  1 file changed, 10 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
>>> index 8f46098..cf0b3a5 100644
>>> --- a/libavformat/asfdec.c
>>> +++ b/libavformat/asfdec.c
>>> @@ -904,7 +904,7 @@ static int asf_read_data(AVFormatContext *s, const 
>>> GUIDParseTable *g)
>>>  uint64_t size   = asf->data_size = avio_rl64(pb);
>>>  int i;
>>>
>>> -if (!asf->data_reached && pb->seekable) {
>>> +if (!asf->data_reached) {
>>>  asf->data_reached   = 1;
>>>  asf->data_offset= asf->offset;
>>>  }
>>> @@ -1660,7 +1660,15 @@ static int asf_read_header(AVFormatContext *s)
>>>  return ret;
>>>  } else {
>>>  size = avio_rl64(pb);
>>> -align_position(pb, asf->offset, size);
>>> +if (size < INT64_MAX)
>>> +align_position(pb, asf->offset, size);
>>> +else {
>>> +if (asf->data_reached) {
>>> +avio_seek(pb, asf->first_packet_offset, SEEK_SET);
>>> +break;
>>> +} else
>>> +return AVERROR_INVALIDDATA;
>>> +}
>>>  }
>>>  if (asf->data_reached && !pb->seekable)
>>>  break;
>>>
>>
>> Seems quite ok. I'd fix the subject with the missing n in handle and
>> push later.
>
> What happened to this patch? Is it still needed?

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

Re: [libav-devel] [PATCH] libavcodec/util: Fix timebase overflow check

2016-03-19 Thread Vittorio Giovara
On Wed, Jan 27, 2016 at 5:19 PM, Derek Buitenhuis
 wrote:
> On 1/27/2016 10:16 PM, Luca Barbato wrote:
>> When it is zero? (isn't there a check before to sanitize the time_base ?)
>
> I only see a check for audio.

What happened to this patch?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] avconv: Move the reporting in a separate thread

2016-03-19 Thread Vittorio Giovara
On Thu, Feb 4, 2016 at 7:07 AM, Luca Barbato <lu_z...@gentoo.org> wrote:
> On 04/02/16 12:52, Vittorio Giovara wrote:
>> is this still needed?
>
> Yes, I'll send and update on this Friday.
>
> lu

I might have forgotten to check, and couldn't find it in the tree,
where is the new version?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] diracdec: Move strides to bytes, and pointer types to uint8_t.

2016-03-19 Thread Vittorio Giovara
On Sun, Dec 6, 2015 at 8:57 AM, Diego Biurrun  wrote:
> On Sun, Dec 06, 2015 at 12:36:24PM +, Kieran Kunhya wrote:
>> Start templating functions for move to support 10-bit
>> Parts of this patch were written by Rostislav Pehlivanov
>> --- a/libavcodec/diracdec.c
>> +++ b/libavcodec/diracdec.c
>> @@ -507,6 +479,38 @@ static inline int coeff_unpack_golomb(GetBitContext 
>> *gb, int qfactor, int qoffse
>>  return coeff;
>>  }
>>
>> +#define UNPACK_ARITH(n, type) \
>> +static inline void coeff_unpack_arith_##n(DiracArith *c, int qfactor, 
>> int qoffset, \
>> +  SubBand *b, type *buf, int x, 
>> int y) \
>
> I'd suggest dropping the indentation here, we do that for function macros
> in other places.
>
>> @@ -554,41 +558,69 @@ static inline void codeblock(DiracContext *s, SubBand 
>> *b,
>>
>> +#define PARSE_VALUES(type, gb, ebits, buf1, buf2) \
>
> This is used much later (~250 lines), I'd move it directly above its usage.
>
>> +*(type *)buf1 = coeff_unpack_golomb(gb, qfactor, qoffset); \
>
> Ugh, pointer type punning :-/
>
> Diego

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


Re: [libav-devel] [PATCH] opus_silk: fix out of array read in silk_lsf2lpc

2016-03-19 Thread Vittorio Giovara
On Sat, Mar 19, 2016 at 4:44 PM, Vittorio Giovara
<vittorio.giov...@gmail.com> wrote:
> On Tue, Dec 15, 2015 at 4:41 PM, Andreas Cadhalpun
> <andreas.cadhal...@googlemail.com> wrote:
>> On 15.12.2015 08:17, Anton Khirnov wrote:
>>> Can you share the sample that shows the problem?
>>
>> I could, but it's of no use for comparing with libopus, because their
>> decoder errors out in an unrelated check.
>>
>>> From what I can see, libopus does not do any clipping at that point, so
>>> something else must ensure that there is no overflow.
>>
>> Indeed, the real problem is just a silly typo...
>> It might have been caused by the fact that the specification uses
>> i and k in exactly the opposite way than the code.
>>
>> New patch attached.
>
> This patch might have been forgotten, ping reviewers.
> --
> Vittorio

never mind, found it (17776638c392d104975aba169e17b186490e1d5e)
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] avio: Add avio_check2

2016-03-19 Thread Vittorio Giovara
On Thu, Feb 4, 2016 at 6:56 AM, Vittorio Giovara
<vittorio.giov...@gmail.com> wrote:
> On Sun, Nov 8, 2015 at 5:12 PM, Luca Barbato <lu_z...@gentoo.org> wrote:
>> On 08/11/15 16:43, Anton Khirnov wrote:
>>> Ok, now that sounds like a real use case. But that's really only applies
>>> to img2dec (which is itself a hack that should go away eventually, but I
>>> digress), not to avconv. So, unless there are other arguments, I would
>>> keep this private.
>>
>> We should deprecate avio_check or warn that it works only for files then.
>>
>> lu
>
> what happened to this?

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


Re: [libav-devel] [PATCH 1/3] x264: Optionally forward the input frame type

2016-03-19 Thread Vittorio Giovara
On Sat, Feb 6, 2016 at 6:02 AM, Luca Barbato <lu_z...@gentoo.org> wrote:
> On 04/02/16 13:09, Vittorio Giovara wrote:
>> On Tue, Sep 1, 2015 at 12:50 AM, Luca Barbato <lu_z...@gentoo.org> wrote:
>>> On 31/08/15 20:55, Anton Khirnov wrote:
>>>> Looks like a hack to me. If you don't want to force the frame type,
>>>> just don't set it.
>>>
>>> So I should move that on an option that does selectively forward only
>>> some kind of the information... Feasible I guess.
>>>
>>> lu
>>
>> any update on this?
>>
>
> I'll rethink that later I guess.

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


Re: [libav-devel] [PATCH] opus_silk: fix out of array read in silk_lsf2lpc

2016-03-19 Thread Vittorio Giovara
On Tue, Dec 15, 2015 at 4:41 PM, Andreas Cadhalpun
 wrote:
> On 15.12.2015 08:17, Anton Khirnov wrote:
>> Can you share the sample that shows the problem?
>
> I could, but it's of no use for comparing with libopus, because their
> decoder errors out in an unrelated check.
>
>> From what I can see, libopus does not do any clipping at that point, so
>> something else must ensure that there is no overflow.
>
> Indeed, the real problem is just a silly typo...
> It might have been caused by the fact that the specification uses
> i and k in exactly the opposite way than the code.
>
> New patch attached.

This patch might have been forgotten, ping reviewers.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] rtsp: Factor out the rtp stream opening

2016-03-19 Thread Vittorio Giovara
On Thu, Feb 4, 2016 at 7:08 AM, Luca Barbato <lu_z...@gentoo.org> wrote:
> On 04/02/16 12:54, Vittorio Giovara wrote:
>
>> is this still needed?
>>
>
> Yes.

so.. any reason it's not pushed?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 6/7] avio: Disable incompatible pointer type warnings

2016-03-19 Thread Vittorio Giovara
On Sat, Feb 6, 2016 at 6:09 AM, Luca Barbato <lu_z...@gentoo.org> wrote:
> On 04/02/16 13:04, Vittorio Giovara wrote:
>> On Thu, Nov 26, 2015 at 5:17 PM, Luca Barbato <lu_z...@gentoo.org> wrote:
>>> ---
>>>  libavformat/avio.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/libavformat/avio.c b/libavformat/avio.c
>>> index ff740a2..359371c 100644
>>> --- a/libavformat/avio.c
>>> +++ b/libavformat/avio.c
>>> @@ -21,6 +21,7 @@
>>>
>>>  #include "libavutil/avstring.h"
>>>  #include "libavutil/dict.h"
>>> +#include "libavutil/internal.h"
>>>  #include "libavutil/opt.h"
>>>  #include "libavutil/time.h"
>>>  #include "os_support.h"
>>> @@ -281,9 +282,11 @@ int ffurl_write(URLContext *h, const unsigned char 
>>> *buf, int size)
>>>  if (h->max_packet_size && size > h->max_packet_size)
>>>  return AVERROR(EIO);
>>>
>>> +FF_DISABLE_POINTER_TYPES_WARNINGS
>>>  return retry_transfer_wrapper(h, buf, size, size,
>>>(int (*)(struct URLContext *, uint8_t *, 
>>> int))
>>>h->prot->url_write);
>>> +FF_ENABLE_POINTER_TYPES_WARNINGS
>>>  }
>>>
>>>  int64_t ffurl_seek(URLContext *h, int64_t pos, int whence)
>>> --
>>> 2.6.1
>>
>> what happened to this set?
>>
>
> Diego took it over.

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


Re: [libav-devel] [PATCH] h264: Use isprint to sanitize the SEI debug message

2016-03-19 Thread Vittorio Giovara
On Sat, Feb 6, 2016 at 3:22 PM, Luca Barbato  wrote:
> On 06/02/16 19:39, Henrik Gramner wrote:
>> On Sat, Feb 6, 2016 at 7:34 PM, Luca Barbato  wrote:
>>> Give how this function is used it is not really important, its purpose
>>> is to not break the terminal printing garbage.
>>
>> That's true I guess.
>>
>>> Do you have time to get me a function that is local independent?
>>
>> static inline av_const int av_isprint(int c)
>> {
>> return c > 31 && c < 127;
>> }
>
> fine for me =) Anybody has a different preference?

Any status update for this patch? If not, it could be probably applied.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] mpegts: Forward the errors on mpeg4 objects parsing

2016-03-19 Thread Vittorio Giovara
On Tue, Feb 16, 2016 at 8:23 PM, Luca Barbato  wrote:
> ---
>  libavformat/mpegts.c | 25 -
>  1 file changed, 16 insertions(+), 9 deletions(-)

This patch is approved but not applied, what's the hold up?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 4/8] opt: Add const to av_opt_next in the next major bump

2016-03-19 Thread Vittorio Giovara
On Sat, Mar 19, 2016 at 11:14 AM, Anton Khirnov  wrote:
> Quoting Martin Storsjö (2016-03-18 13:01:38)
>> From: Lukasz Marek 
>>
>> Also add const to pointers in static functions within opt.c where
>> possible.
>> ---
>> Or can we freely add const here without waiting for a major bump?
>> I don't see any case where adding const actually would break third
>> party code.
>
> Maybe some c++ wrappers would complain about this?

I'm pretty sure we did add const to function parameters in the past
with no problem.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 2/9] lavf: generic hardware surface upload and download

2016-03-19 Thread Vittorio Giovara
On Tue, Mar 15, 2016 at 6:57 PM, Mark Thompson  wrote:
> ---
>  libavfilter/Makefile|   2 +
>  libavfilter/allfilters.c|   2 +
>  libavfilter/avfilter.c  |   2 +
>  libavfilter/avfilter.h  |   9 ++
>  libavfilter/vf_hwdownload.c | 212 ++
>  libavfilter/vf_hwupload.c   | 241 
> 
>  6 files changed, 468 insertions(+)
>  create mode 100644 libavfilter/vf_hwdownload.c
>  create mode 100644 libavfilter/vf_hwupload.c

Note to the committer: please use lavfi for libavfilter tags, as lavf
generally refers to libavformat.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] qsv: Fix loading multiple plugins

2016-03-15 Thread Vittorio Giovara
On Tue, Mar 15, 2016 at 9:10 AM, Luca Barbato  wrote:
> av_get_token does not strip the trailing separator.
> ---
>  libavcodec/qsv.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
> index 3e892e8..e08518b 100644
> --- a/libavcodec/qsv.c
> +++ b/libavcodec/qsv.c
> @@ -133,6 +133,8 @@ int ff_qsv_init_internal_session(AVCodecContext *avctx, 
> mfxSession *session,
>  goto load_plugin_fail;
>  }
>
> +if (*load_plugins)
> +load_plugins++;
>  load_plugin_fail:
>  av_freep();
>  if (err < 0)
> --

ok I think
this is so common we could tinker something about
get_token_and_strip_separator probably
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] mov: Check the entries value when parsing dref boxes

2016-03-09 Thread Vittorio Giovara
On Wed, Mar 9, 2016 at 9:42 PM, Luca Barbato  wrote:
> On 08/03/16 12:05, Luca Barbato wrote:
>> And properly reset the entries count when resetting the entries.
>>
>> CC: libav-sta...@libav.org
>>
>> Bug-Id: 929
>> ---
>>
>
> CVE-2016-3062

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


Re: [libav-devel] [PATCH] hwcontext_vdpau: Use correct array member in comparison

2016-03-08 Thread Vittorio Giovara
On Tue, Mar 8, 2016 at 3:22 PM, Diego Biurrun  wrote:
> libavutil/hwcontext_vdpau.c:305:37: warning: cast from pointer to integer of 
> different size
> ---
>  libavutil/hwcontext_vdpau.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavutil/hwcontext_vdpau.c b/libavutil/hwcontext_vdpau.c
> index faae5f8..e1545d5 100644
> --- a/libavutil/hwcontext_vdpau.c
> +++ b/libavutil/hwcontext_vdpau.c
> @@ -302,7 +302,7 @@ static int vdpau_transfer_data_from(AVHWFramesContext 
> *ctx, AVFrame *dst,
>
>  for (i = 0; i< FF_ARRAY_ELEMS(data) && dst->data[i]; i++) {
>  data[i] = dst->data[i];
> -if (dst->linesize[i] < 0 || (uint64_t)dst->linesize > UINT32_MAX) {
> +if (dst->linesize[i] < 0 || (uint64_t)dst->linesize[i] > UINT32_MAX) 
> {
>  av_log(ctx, AV_LOG_ERROR,
> "The linesize %d cannot be represented as uint32\n",
> dst->linesize[i]);
> @@ -353,7 +353,7 @@ static int vdpau_transfer_data_to(AVHWFramesContext *ctx, 
> AVFrame *dst,
>
>  for (i = 0; i< FF_ARRAY_ELEMS(data) && src->data[i]; i++) {
>  data[i] = src->data[i];
> -if (src->linesize[i] < 0 || (uint64_t)src->linesize > UINT32_MAX) {
> +if (src->linesize[i] < 0 || (uint64_t)src->linesize[i] > UINT32_MAX) 
> {
>  av_log(ctx, AV_LOG_ERROR,
> "The linesize %d cannot be represented as uint32\n",
> src->linesize[i]);
> --

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


Re: [libav-devel] [PATCH] h264: Add missing ff_ prefix to public h264_init_dequant_tables()

2016-03-08 Thread Vittorio Giovara
On Tue, Mar 8, 2016 at 11:55 AM, Diego Biurrun  wrote:
> ---
>  libavcodec/h264.c   | 2 +-
>  libavcodec/h264.h   | 2 +-
>  libavcodec/h264_slice.c | 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)

I'd use "internally public function" to avoid confusion with "public
api" in the commit title

> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> index 0b5b6c2..e9c13cc 100644
> --- a/libavcodec/h264.c
> +++ b/libavcodec/h264.c
> @@ -424,7 +424,7 @@ int ff_h264_alloc_tables(H264Context *h)
>  }
>
>  if (!h->dequant4_coeff[0])
> -h264_init_dequant_tables(h);
> +ff_h264_init_dequant_tables(h);
>
>  return 0;
>
> diff --git a/libavcodec/h264.h b/libavcodec/h264.h
> index 72ad352..f96dab0 100644
> --- a/libavcodec/h264.h
> +++ b/libavcodec/h264.h
> @@ -849,7 +849,7 @@ int ff_h264_decode_mb_cabac(const H264Context *h, 
> H264SliceContext *sl);
>
>  void ff_h264_init_cabac_states(const H264Context *h, H264SliceContext *sl);
>
> -void h264_init_dequant_tables(H264Context *h);
> +void ff_h264_init_dequant_tables(H264Context *h);
>
>  void ff_h264_direct_dist_scale_factor(const H264Context *const h, 
> H264SliceContext *sl);
>  void ff_h264_direct_ref_list_init(const H264Context *const h, 
> H264SliceContext *sl);
> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> index 8dde140..67cbc02 100644
> --- a/libavcodec/h264_slice.c
> +++ b/libavcodec/h264_slice.c
> @@ -371,7 +371,7 @@ static void init_dequant4_coeff_table(H264Context *h)
>  }
>  }
>
> -void h264_init_dequant_tables(H264Context *h)
> +void ff_h264_init_dequant_tables(H264Context *h)
>  {
>  int i, x;
>  init_dequant4_coeff_table(h);
> @@ -1230,7 +1230,7 @@ int ff_h264_decode_slice_header(H264Context *h, 
> H264SliceContext *sl)
>
>  if (sl == h->slice_ctx && h->dequant_coeff_pps != pps_id) {
>  h->dequant_coeff_pps = pps_id;
> -h264_init_dequant_tables(h);
> +ff_h264_init_dequant_tables(h);
>  }
>
>  frame_num = get_bits(>gb, h->sps.log2_max_frame_num);

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


Re: [libav-devel] [PATCH 6/6] lavc: deprecate old functions

2016-03-07 Thread Vittorio Giovara
On Mon, Mar 7, 2016 at 3:12 PM, wm4  wrote:
> And replace some doxygen references to them.
> ---
>  libavcodec/avcodec.h   | 12 +---
>  libavformat/avformat.h |  4 ++--
>  2 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 3517584..0d15d13 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -1501,7 +1501,7 @@ typedef struct AVCodecContext {
>   * the decoded frame is cropped before being output.
>   *
>   * @note Those field may not match the value of the last
> - * AVFrame outputted by avcodec_decode_video2 due frame
> + * AVFrame outputted by avcodec_receive_frame() due frame
>   * reordering.
>   *
>   * - encoding: unused
> @@ -1528,7 +1528,7 @@ typedef struct AVCodecContext {
>   * May be overriden by the decoder if it knows better.
>   *
>   * @note This field may not match the value of the last
> - * AVFrame outputted by avcodec_decode_video2 due frame
> + * AVFrame outputted by avcodec_receive_frame() due frame
>   * reordering.
>   *
>   * - encoding: Set by user.
> @@ -3655,7 +3655,7 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
>   * @warning This function is not thread safe!
>   *
>   * @note Always call this function before using decoding routines (such as
> - * @ref avcodec_decode_video2()).
> + * @ref avcodec_receive_frame()).
>   *
>   * @code
>   * avcodec_register_all();
> @@ -4053,7 +4053,10 @@ void avcodec_align_dimensions2(AVCodecContext *s, int 
> *width, int *height,
>   * @return A negative error code is returned if an error occurred during
>   * decoding, otherwise the number of bytes consumed from the input
>   * AVPacket is returned.
> + *
> +* @deprecated Use avcodec_send_packet() and avcodec_receive_frame().
>   */
> +attribute_deprecated
>  int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
>int *got_frame_ptr, AVPacket *avpkt);
>
> @@ -4099,7 +4102,10 @@ int avcodec_decode_audio4(AVCodecContext *avctx, 
> AVFrame *frame,
>   * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, 
> otherwise, it is nonzero.
>   * @return On error a negative value is returned, otherwise the number of 
> bytes
>   * used or zero if no frame could be decompressed.
> + *
> + * @deprecated Use avcodec_send_packet() and avcodec_receive_frame().
>   */
> +attribute_deprecated
>  int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
>   int *got_picture_ptr,
>   AVPacket *avpkt);
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 6db17f7..1a99948 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -149,8 +149,8 @@
>   * av_read_frame() on it. Each call, if successful, will return an AVPacket
>   * containing encoded data for one AVStream, identified by
>   * AVPacket.stream_index. This packet may be passed straight into the 
> libavcodec
> - * decoding functions avcodec_decode_video2(), avcodec_decode_audio4() or
> - * avcodec_decode_subtitle2() if the caller wishes to decode the data.
> + * decoding functions avcodec_send_packet() or avcodec_decode_subtitle2() if 
> the
> + * caller wishes to decode the data.
>   *
>   * AVPacket.pts, AVPacket.dts and AVPacket.duration timing information will 
> be
>   * set if known. They may also be unset (i.e. AV_NOPTS_VALUE for
> --
> 2.7.0

I would add more info in doc/APIchanges too.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/2] configure: Support msan as toolchain

2016-03-07 Thread Vittorio Giovara
On Mon, Mar 7, 2016 at 2:52 AM, Luca Barbato  wrote:
> ---
>  configure | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/configure b/configure
> index d8b8c07..f0c4f0a 100755
> --- a/configure
> +++ b/configure
> @@ -2701,6 +2701,11 @@ case "$toolchain" in
>  add_cflags  -fsanitize=address
>  add_ldflags -fsanitize=address
>  ;;
> +*-msan)
> +cc_default="${toolchain%-msan}"
> +add_cflags  -fsanitize=memory -fsanitize-memory-track-origins
> +add_ldflags -fsanitize=memory
> +;;
>  *-tsan)
>  cc_default="${toolchain%-tsan}"
>  add_cflags  -fsanitize=thread -pie
> --

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


Re: [libav-devel] [PATCH 2/2] configure: Add support for clang llvm-cov

2016-03-07 Thread Vittorio Giovara
On Mon, Mar 7, 2016 at 2:52 AM, Luca Barbato  wrote:
> ---
>  configure | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/configure b/configure
> index f0c4f0a..9ffb679 100755
> --- a/configure
> +++ b/configure
> @@ -2778,6 +2778,10 @@ case "$toolchain" in
>  add_cflags  -fprofile-arcs -ftest-coverage
>  add_ldflags -fprofile-arcs -ftest-coverage
>  ;;
> +llvm-cov)
> +add_cflags -fprofile-arcs -ftest-coverage
> +add_ldflags --coverage
> +;;
>  hardened)
>  add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
>  add_cflags   -fno-strict-overflow -fstack-protector-all
> --

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


Re: [libav-devel] [PATCH] avcodec/cfhd: Fixes cfhd_odd.mov which has a resolution of 496x241

2016-03-05 Thread Vittorio Giovara
On Sat, Mar 5, 2016 at 1:06 PM, Kieran Kunhya <kie...@kunhya.com> wrote:
> In this case container width/height is better however.
> Thanks to koda for the sample
> ---
>  libavcodec/cfhd.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
> index e37bef0..98f16d3 100644
> --- a/libavcodec/cfhd.c
> +++ b/libavcodec/cfhd.c
> @@ -467,6 +467,9 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, 
> int *got_frame,
>  coeff_data += lowpass_width;
>  }
>
> +/* Align to mod-4 position to continue reading tags */
> +bytestream2_seek(, bytestream2_tell() & 3, SEEK_CUR);
> +
>  /* Copy last line of coefficients if odd height */
>  if (lowpass_height & 1) {
>  memcpy(_data[lowpass_height * lowpass_width],
> --

Confirmed to work with the sample. Here is an addendum to avoid
displaying garbage (untested with other samples)

commit 658fdd157f12633006533bc67ffb3b0d44a198df
Author: Vittorio Giovara <vittorio.giov...@gmail.com>
Date:   Sat Mar 5 13:32:54 2016 -0500

cfhd: Crop visible height

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index e37bef0..4d2e933 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -420,6 +420,8 @@ static int cfhd_decode(AVCodecContext *avctx, void
*data, int *got_frame,
 break;
 }
 planes = av_pix_fmt_count_planes(s->coded_format);
+} else if (tag == -85) {
+avctx->height = data;
 } else
 av_log(avctx, AV_LOG_DEBUG,  "Unknown tag %i data %x\n",
tag, data);


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


[libav-devel] [PATCH][Release/11] asfenc: Check pts leading to integer overflow

2016-03-03 Thread Vittorio Giovara
From: Michael Niedermayer 

Bug-Id: CVE-2016-2326
Sample-Id: 
0063df8be3aaa30dd6d76f59c8f818c8/signal_sigsegv_7b7b59_3634_bf418b6822bbfa68734411d96b667be3.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
Note: untested, people with the sample please confirm.
Vittorio

 libavformat/asfenc.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 90d5c26..87993b6 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -964,6 +964,11 @@ static int asf_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 
 pts = (pkt->pts != AV_NOPTS_VALUE) ? pkt->pts : pkt->dts;
 av_assert0(pts != AV_NOPTS_VALUE);
+if (   pts < - PREROLL_TIME
+|| pts > (INT_MAX-3)/1LL * ASF_INDEXED_INTERVAL - PREROLL_TIME) {
+av_log(s, AV_LOG_ERROR, "input pts %"PRId64" is invalid\n", pts);
+return AVERROR(EINVAL);
+}
 pts *= 1;
 asf->duration = FFMAX(asf->duration, pts + pkt->duration * 1);
 
-- 
2.7.0

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


Re: [libav-devel] [PATCH] mov: check atom nesting depth and limit it to 10

2016-03-02 Thread Vittorio Giovara
On Tue, Feb 9, 2016 at 5:45 PM, Luca Barbato <lu_z...@gentoo.org> wrote:
> On 09/02/16 23:23, Vittorio Giovara wrote:
>> From: Michael Niedermayer <michae...@gmx.at>
>>
>> Fixes call stack overflow
>> Fixes: case1_call_stack_overflow.mp4
>> Found-by: Michal Zalewski <lcam...@coredump.cx>
>> Signed-off-by: Michael Niedermayer <michae...@gmx.at>
>> ---
>>  libavformat/isom.h |  1 +
>>  libavformat/mov.c  | 13 -
>>  2 files changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/isom.h b/libavformat/isom.h
>> index f8e398b..b4f0202 100644
>> --- a/libavformat/isom.h
>> +++ b/libavformat/isom.h
>> @@ -190,6 +190,7 @@ typedef struct MOVContext {
>>  int has_looked_for_mfra;
>>  MOVFragmentIndex** fragment_index_data;
>>  unsigned fragment_index_count;
>> +int atom_depth;
>>  } MOVContext;
>>
>>  int ff_mp4_read_descr_len(AVIOContext *pb);
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index 8bfe974..be2728c 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -3412,6 +3412,12 @@ static int mov_read_default(MOVContext *c, 
>> AVIOContext *pb, MOVAtom atom)
>>  MOVAtom a;
>>  int i;
>>
>> +if (c->atom_depth > 10) {
>> +av_log(c->fc, AV_LOG_ERROR, "Atoms too deeply nested\n");
>> +return AVERROR_INVALIDDATA;
>> +}
>
> why 10? Is it the nesting limit specified somehow?
>
> I'm not against the general idea, but I'm not so keen in having possibly
> valid/borderline files unreadable just because something got nested 11
> level deep.

So what is the definite idea for this patch?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] mov: Trim dref absolute path

2016-03-02 Thread Vittorio Giovara
On Wed, Feb 24, 2016 at 5:16 PM, Luca Barbato <lu_z...@gentoo.org> wrote:
> On 24/02/16 18:23, Vittorio Giovara wrote:
>> Which way? Patch as is or the other version that trims by 1 character only?
>>
>
> As is, it is fine.

Adding this to the push queue, any more comments/objections?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 2/3] mpegvideo_motion: Fix undefined negative shifts in mpeg_motion_internal

2016-03-02 Thread Vittorio Giovara
From: Michael Niedermayer <michae...@gmx.at>

Found-by: Clang -fsanitize=shift
Reported-by: Thierry Foucu <tfo...@google.com>
Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 libavcodec/mpegvideo_motion.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c
index 05375a1..04f4020 100644
--- a/libavcodec/mpegvideo_motion.c
+++ b/libavcodec/mpegvideo_motion.c
@@ -318,23 +318,25 @@ void mpeg_motion_internal(MpegEncContext *s,
src_y);
 return;
 }
+src_y = (unsigned)src_y << field_based;
 s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr_y,
  s->linesize, s->linesize,
  17, 17 + field_based,
- src_x, src_y << field_based,
+ src_x, src_y,
  s->h_edge_pos, s->v_edge_pos);
 ptr_y = s->sc.edge_emu_buffer;
 if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
 uint8_t *uvbuf = s->sc.edge_emu_buffer + 18 * s->linesize;
+uvsrc_y = (unsigned)uvsrc_y << field_based;
 s->vdsp.emulated_edge_mc(uvbuf, ptr_cb,
  s->uvlinesize, s->uvlinesize,
  9, 9 + field_based,
- uvsrc_x, uvsrc_y << field_based,
+ uvsrc_x, uvsrc_y,
  s->h_edge_pos >> 1, s->v_edge_pos >> 1);
 s->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr,
  s->uvlinesize, s->uvlinesize,
  9, 9 + field_based,
- uvsrc_x, uvsrc_y << field_based,
+ uvsrc_x, uvsrc_y,
  s->h_edge_pos >> 1, s->v_edge_pos >> 1);
 ptr_cb = uvbuf;
 ptr_cr = uvbuf + 16;
-- 
2.7.0

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


[libav-devel] [PATCH 1/3] mpegvideo: Fix undefined negative shifts in ff_init_block_index

2016-03-02 Thread Vittorio Giovara
From: Luca Barbato <lu_z...@gentoo.org>

Found-by: gcc5-ubsan.

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 libavcodec/mpegvideo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index e0787a6..5974e18 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1754,9 +1754,9 @@ void ff_init_block_index(MpegEncContext *s){ //FIXME 
maybe rename
 s->block_index[5]= s->mb_stride*(s->mb_y + s->mb_height + 2) + 
s->b8_stride*s->mb_height*2 + s->mb_x - 1;
 //block_index is not used by mpeg2, so it is not affected by chroma_format
 
-s->dest[0] = s->current_picture.f->data[0] + ((s->mb_x - 1) <<  mb_size);
-s->dest[1] = s->current_picture.f->data[1] + ((s->mb_x - 1) << (mb_size - 
s->chroma_x_shift));
-s->dest[2] = s->current_picture.f->data[2] + ((s->mb_x - 1) << (mb_size - 
s->chroma_x_shift));
+s->dest[0] = s->current_picture.f->data[0] + (s->mb_x - 1) * (1 << 
mb_size);
+s->dest[1] = s->current_picture.f->data[1] + (s->mb_x - 1) * (1 << 
(mb_size - s->chroma_x_shift));
+s->dest[2] = s->current_picture.f->data[2] + (s->mb_x - 1) * (1 << 
(mb_size - s->chroma_x_shift));
 
 if(!(s->pict_type==AV_PICTURE_TYPE_B && s->avctx->draw_horiz_band && 
s->picture_structure==PICT_FRAME))
 {
-- 
2.7.0

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


[libav-devel] [PATCH 3/3] idct8x8: Fix undefined negative shifts

2016-03-02 Thread Vittorio Giovara
From: Katerina Barone-Adesi 

The original code left-shifts negative values, which is undefined
in the C99 specification (the one used during normal Libav compilation).
This change multiplies by (1 << shift), which is functionally equivalent,
but has defined behavior.

With this change, fate-idct8x8 compiled with --fsanitize=undefined works.

Bug-Id: 686
---
 libavcodec/jfdctint_template.c|  4 ++--
 libavcodec/jrevdct.c  | 36 ++--
 libavcodec/simple_idct_template.c | 10 +-
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/libavcodec/jfdctint_template.c b/libavcodec/jfdctint_template.c
index c6a1638..3ea2f5d 100644
--- a/libavcodec/jfdctint_template.c
+++ b/libavcodec/jfdctint_template.c
@@ -216,8 +216,8 @@ static av_always_inline void FUNC(row_fdct)(int16_t *data)
 tmp11 = tmp1 + tmp2;
 tmp12 = tmp1 - tmp2;
 
-dataptr[0] = (int16_t) ((tmp10 + tmp11) << PASS1_BITS);
-dataptr[4] = (int16_t) ((tmp10 - tmp11) << PASS1_BITS);
+dataptr[0] = (int16_t) ((tmp10 + tmp11) * (1 << PASS1_BITS));
+dataptr[4] = (int16_t) ((tmp10 - tmp11) * (1 << PASS1_BITS));
 
 z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
 dataptr[2] = (int16_t) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
diff --git a/libavcodec/jrevdct.c b/libavcodec/jrevdct.c
index 8261269..96a884a 100644
--- a/libavcodec/jrevdct.c
+++ b/libavcodec/jrevdct.c
@@ -251,8 +251,8 @@ void ff_j_rev_dct(DCTBLOCK data)
   /* AC terms all zero */
   if (d0) {
   /* Compute a 32 bit value to assign. */
-  int16_t dcval = (int16_t) (d0 << PASS1_BITS);
-  register int v = (dcval & 0x) | ((dcval << 16) & 0x);
+  int16_t dcval = (int16_t) (d0 * (1 << PASS1_BITS));
+  register int v = (dcval & 0x) | ((dcval * (1 << 16)) & 
0x);
 
   idataptr[0] = v;
   idataptr[1] = v;
@@ -274,8 +274,8 @@ void ff_j_rev_dct(DCTBLOCK data)
 tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065);
 tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865);
 
-tmp0 = (d0 + d4) << CONST_BITS;
-tmp1 = (d0 - d4) << CONST_BITS;
+tmp0 = (d0 + d4) * CONST_SCALE;
+tmp1 = (d0 - d4) * CONST_SCALE;
 
 tmp10 = tmp0 + tmp3;
 tmp13 = tmp0 - tmp3;
@@ -286,8 +286,8 @@ void ff_j_rev_dct(DCTBLOCK data)
 tmp2 = MULTIPLY(-d6, FIX_1_306562965);
 tmp3 = MULTIPLY(d6, FIX_0_541196100);
 
-tmp0 = (d0 + d4) << CONST_BITS;
-tmp1 = (d0 - d4) << CONST_BITS;
+tmp0 = (d0 + d4) * CONST_SCALE;
+tmp1 = (d0 - d4) * CONST_SCALE;
 
 tmp10 = tmp0 + tmp3;
 tmp13 = tmp0 - tmp3;
@@ -300,8 +300,8 @@ void ff_j_rev_dct(DCTBLOCK data)
 tmp2 = MULTIPLY(d2, FIX_0_541196100);
 tmp3 = MULTIPLY(d2, FIX_1_306562965);
 
-tmp0 = (d0 + d4) << CONST_BITS;
-tmp1 = (d0 - d4) << CONST_BITS;
+tmp0 = (d0 + d4) * CONST_SCALE;
+tmp1 = (d0 - d4) * CONST_SCALE;
 
 tmp10 = tmp0 + tmp3;
 tmp13 = tmp0 - tmp3;
@@ -309,8 +309,8 @@ void ff_j_rev_dct(DCTBLOCK data)
 tmp12 = tmp1 - tmp2;
 } else {
 /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
-tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
-tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
+tmp10 = tmp13 = (d0 + d4) * CONST_SCALE;
+tmp11 = tmp12 = (d0 - d4) * CONST_SCALE;
 }
   }
 
@@ -620,8 +620,8 @@ void ff_j_rev_dct(DCTBLOCK data)
 tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065);
 tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865);
 
-tmp0 = (d0 + d4) << CONST_BITS;
-tmp1 = (d0 - d4) << CONST_BITS;
+tmp0 = (d0 + d4) * CONST_SCALE;
+tmp1 = (d0 - d4) * CONST_SCALE;
 
 tmp10 = tmp0 + tmp3;
 tmp13 = tmp0 - tmp3;
@@ -632,8 +632,8 @@ void ff_j_rev_dct(DCTBLOCK data)
 tmp2 = MULTIPLY(-d6, FIX_1_306562965);
 tmp3 = MULTIPLY(d6, FIX_0_541196100);
 
-tmp0 = (d0 + d4) << CONST_BITS;
-tmp1 = (d0 - d4) << CONST_BITS;
+tmp0 = (d0 + d4) * CONST_SCALE;
+tmp1 = (d0 - d4) * CONST_SCALE;
 
 tmp10 = tmp0 + tmp3;
 tmp13 = tmp0 - tmp3;
@@ -646,8 +646,8 @@ void ff_j_rev_dct(DCTBLOCK data)
 tmp2 = MULTIPLY(d2, FIX_0_541196100);
 tmp3 = MULTIPLY(d2, FIX_1_306562965);
 
-tmp0 = (d0 + d4) << CONST_BITS;
- 

[libav-devel] [PATCH] vdpau: Add missing deprecation guards

2016-03-01 Thread Vittorio Giovara
---
 libavcodec/vdpau.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
index dd48c04..bf5f8d9 100644
--- a/libavcodec/vdpau.c
+++ b/libavcodec/vdpau.c
@@ -317,6 +317,7 @@ int ff_vdpau_add_buffer(struct vdpau_picture_context 
*pic_ctx,
 return 0;
 }
 
+#if FF_API_VDPAU_PROFILE
 int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile)
 {
 #define PROFILE(prof)  \
@@ -363,6 +364,7 @@ do {   \
 return AVERROR(EINVAL);
 #undef PROFILE
 }
+#endif /* FF_API_VDPAU_PROFILE */
 
 AVVDPAUContext *av_vdpau_alloc_context(void)
 {
-- 
2.7.0

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


Re: [libav-devel] [PATCH 2/2] fate: Add separate target for all indeo3 tests

2016-03-01 Thread Vittorio Giovara
On Tue, Mar 1, 2016 at 7:52 AM, Diego Biurrun  wrote:
> ---
>  tests/fate/indeo.mak| 11 +++
>  tests/ref/fate/{indeo3 => indeo3-1} |  0
>  2 files changed, 7 insertions(+), 4 deletions(-)
>  rename tests/ref/fate/{indeo3 => indeo3-1} (100%)
>
> diff --git a/tests/fate/indeo.mak b/tests/fate/indeo.mak
> index ad39bf3..a275bda 100644
> --- a/tests/fate/indeo.mak
> +++ b/tests/fate/indeo.mak
> @@ -7,12 +7,15 @@ fate-indeo2-delta: CMD = framecrc -i 
> $(TARGET_SAMPLES)/rt21/ISKATE.AVI -an
>  FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, INDEO2) += $(FATE_INDEO2)
>  fate-indeo2: $(FATE_INDEO2)
>
> -FATE_INDEO-$(call DEMDEC, MOV, INDEO3) += fate-indeo3
> -fate-indeo3: CMD = framecrc -i $(TARGET_SAMPLES)/iv32/cubes.mov
> +FATE_INDEO3-$(CONFIG_MOV_DEMUXER) += fate-indeo3-1
> +fate-indeo3-1: CMD = framecrc -i $(TARGET_SAMPLES)/iv32/cubes.mov
>
> -FATE_INDEO-$(call DEMDEC, AVI, INDEO3) += fate-indeo3-2
> +FATE_INDEO3-$(CONFIG_AVI_DEMUXER) += fate-indeo3-2
>  fate-indeo3-2: CMD = framecrc -i $(TARGET_SAMPLES)/iv32/OPENINGH.avi
>
> +FATE_SAMPLES_AVCONV-$(CONFIG_INDEO3_DECODER) += $(FATE_INDEO3-yes)
> +fate-indeo3: $(FATE_INDEO3-yes)
> +
>  FATE_INDEO-$(call DEMDEC, AVI, INDEO4) += fate-indeo4
>  fate-indeo4: CMD = framecrc -i $(TARGET_SAMPLES)/iv41/indeo41-partial.avi -an
>
> @@ -20,4 +23,4 @@ FATE_INDEO-$(call DEMDEC, AVI, INDEO5) += fate-indeo5
>  fate-indeo5: CMD = framecrc -i 
> $(TARGET_SAMPLES)/iv50/Educ_Movie_DeadlyForce.avi -an
>
>  FATE_SAMPLES_AVCONV += $(FATE_INDEO-yes)
> -fate-indeo: $(FATE_INDEO2) $(FATE_INDEO-yes)
> +fate-indeo: $(FATE_INDEO2) $(FATE_INDEO3-yes) $(FATE_INDEO-yes)
> diff --git a/tests/ref/fate/indeo3 b/tests/ref/fate/indeo3-1
> similarity index 100%
> rename from tests/ref/fate/indeo3
> rename to tests/ref/fate/indeo3-1
> --
> 2.5.0

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


Re: [libav-devel] [PATCH 1/6] lavu: improve documentation of some AVFrame functions

2016-02-27 Thread Vittorio Giovara
On Sat, Feb 27, 2016 at 9:15 AM, wm4  wrote:
> ---
>  libavutil/frame.h | 14 +-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/libavutil/frame.h b/libavutil/frame.h
> index 5a04177..6f5d733 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -391,6 +391,10 @@ void av_frame_free(AVFrame **frame);
>   * If src is not reference counted, new buffers are allocated and the data is
>   * copied.
>   *
> + * @warning: dst MUST have been either unreferenced with av_frame_unref(dst),
> + *   or newly allocated with av_frame_alloc() before calling this
> + *   function, or undefined behavior will occur.

don't you just have to make sure that the frame is allocated?
what undefined behaviour are we talking about?

> + *
>   * @return 0 on success, a negative AVERROR on error
>   */
>  int av_frame_ref(AVFrame *dst, const AVFrame *src);
> @@ -410,7 +414,11 @@ AVFrame *av_frame_clone(const AVFrame *src);
>  void av_frame_unref(AVFrame *frame);
>
>  /**
> - * Move everythnig contained in src to dst and reset src.
> + * Move everything contained in src to dst and reset src.
> + *
> + * @warning: dst is not unreferenced, but blindly overwritten without 
> checking

it could do without 'blindly' but ok otherwise

> + *   or deallocating its contents. Call av_frame_unref(dst) manually
> + *   before calling this function to ensure that no memory is leaked.
>   */
>  void av_frame_move_ref(AVFrame *dst, AVFrame *src);
>
> @@ -426,6 +434,10 @@ void av_frame_move_ref(AVFrame *dst, AVFrame *src);
>   * necessary, allocate and fill AVFrame.extended_data and 
> AVFrame.extended_buf.
>   * For planar formats, one buffer will be allocated for each plane.
>   *
> + * @warning: if frame already has been allocated, calling this function will
> + *   leak memory. In addition, undefined behavior can occur in 
> certain
> + *   cases.

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


Re: [libav-devel] [PATCH] Update changelog for v11.6

2016-02-26 Thread Vittorio Giovara
On Fri, Feb 26, 2016 at 5:46 PM, Sean McGovern  wrote:
> ---
>  Changelog |8 
>  RELEASE   |2 +-
>  2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/Changelog b/Changelog
> index 08bb70b..6bb13ea 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -1,6 +1,11 @@
>  Entries are sorted chronologically from oldest to youngest within each 
> release,
>  releases are sorted from youngest to oldest.
>
> +version 11.6:
> +
> + - configure: add --enable-rpath
> + - concat: disable by default
> +
>  version 11.5:
>
>   - aac_parser: add required padding for GetBitContext buffer
> @@ -57,6 +62,9 @@ version 11.5:
>   - dvdsubdec: Validate the RLE offsets
>   - avi: Validate the stream-id for DV as well (bug/879)
>   - mov: Use the correct type for size (bug/921)
> + - mov: Force the full parsing of mp3 (bug/899)
> + - mkv: Force the full parsing of mp3
> + - matroska: Always consider S_TEXT/UTF8 as SRT when demuxing
>
>  version 11.4:
>
> diff --git a/RELEASE b/RELEASE
> index 8204473..1ed6da4 100644
> --- a/RELEASE
> +++ b/RELEASE
> @@ -1 +1 @@
> -11.5
> +11.6
> --
> 1.7.9.2

lgtm


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


[libav-devel] [PATCH] avcodec/eatqi: print error on mb decode failure

2016-02-25 Thread Vittorio Giovara
From: Michael Niedermayer 

Reviewed-by: Derek Buitenhuis 
Signed-off-by: Michael Niedermayer 
---
 libavcodec/eatqi.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c
index d3b2a97..8fd5cdb 100644
--- a/libavcodec/eatqi.c
+++ b/libavcodec/eatqi.c
@@ -37,6 +37,7 @@
 #include "mpeg12.h"
 
 typedef struct TqiContext {
+AVCodecContext *avctx;
 GetBitContext gb;
 BlockDSPContext bdsp;
 BswapDSPContext bsdsp;
@@ -79,8 +80,11 @@ static int tqi_decode_mb(TqiContext *t, int16_t (*block)[64])
   t->intra_matrix,
   t->intra_scantable.permutated,
   t->last_dc, block[n], n, 1);
-if (ret < 0)
+if (ret < 0) {
+av_log(t->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n",
+   t->mb_x, t->mb_y);
 return -1;
+}
 }
 
 return 0;
@@ -127,6 +131,8 @@ static int tqi_decode_frame(AVCodecContext *avctx,
 AVFrame *frame = data;
 int ret, w, h;
 
+t->avctx = avctx;
+
 w = AV_RL16([0]);
 h = AV_RL16([2]);
 tqi_calculate_qtable(t, buf[4]);
-- 
2.7.0

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


Re: [libav-devel] [PATCH 19/25] intrax8: Use the generic horizband function

2016-02-24 Thread Vittorio Giovara
On Tue, Feb 23, 2016 at 2:53 PM, Luca Barbato <lu_z...@gentoo.org> wrote:
> On 23/02/16 02:17, Vittorio Giovara wrote:
>> This is assuming that intrax8 has no support for interlacing
>> (hence PICT_FRAME is set and last_frame is NULL).
>> ---
>>  libavcodec/intrax8.c | 5 -
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
>> index b3b1331..44cf141 100644
>> --- a/libavcodec/intrax8.c
>> +++ b/libavcodec/intrax8.c
>> @@ -30,6 +30,7 @@
>>  #include "intrax8huf.h"
>>  #include "intrax8.h"
>>  #include "intrax8dsp.h"
>> +#include "mpegutils.h"
>>
>>  #define MAX_TABLE_DEPTH(table_bits, max_bits) \
>>  ((max_bits + table_bits - 1) / table_bits)
>> @@ -836,7 +837,9 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, 
>> Picture *pict,
>>  w->dest[0] += 8;
>>  }
>>  if (w->mb_y & 1)
>> -ff_mpeg_draw_horiz_band(s, (w->mb_y - 1) * 8, 16);
>> +ff_draw_horiz_band(w->avctx, w->frame, NULL,
>> +   (w->mb_y - 1) * 8, 16,
>> +   PICT_FRAME, 0, lowdelay);
>>  }
>>
>>  error:
>>
>
> What happens if last_frame is non-null?

According to mpegutils.c it used only if lowdealy is true. However
that might not be always the case so, I'll just set the current frame
for both.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] fate: Add test for indeo2 with delta frames

2016-02-24 Thread Vittorio Giovara
Rename to keep indeo2 target separate.
---
 tests/fate/indeo.mak|  12 +++-
 tests/ref/fate/indeo2-delta | 115 
 tests/ref/fate/{indeo2 => indeo2-intra} |   0
 3 files changed, 124 insertions(+), 3 deletions(-)
 create mode 100644 tests/ref/fate/indeo2-delta
 rename tests/ref/fate/{indeo2 => indeo2-intra} (100%)

diff --git a/tests/fate/indeo.mak b/tests/fate/indeo.mak
index e725a6b..49563a8 100644
--- a/tests/fate/indeo.mak
+++ b/tests/fate/indeo.mak
@@ -1,5 +1,11 @@
-FATE_INDEO-$(call DEMDEC, AVI, INDEO2) += fate-indeo2
-fate-indeo2: CMD = framecrc -i $(TARGET_SAMPLES)/rt21/VPAR0026.AVI
+FATE_INDEO2-$(call DEMDEC, AVI, INDEO2) += fate-indeo2-intra
+fate-indeo2-intra: CMD = framecrc -i $(TARGET_SAMPLES)/rt21/VPAR0026.AVI
+
+FATE_INDEO2-$(call DEMDEC, AVI, INDEO2) += fate-indeo2-delta
+fate-indeo2-delta: CMD = framecrc -i $(TARGET_SAMPLES)/rt21/ISKATE.AVI -an
+
+FATE_SAMPLES_AVCONV += $(FATE_INDEO2-yes)
+fate-indeo2: $(FATE_INDEO2-yes)
 
 FATE_INDEO-$(call DEMDEC, MOV, INDEO3) += fate-indeo3
 fate-indeo3: CMD = framecrc -i $(TARGET_SAMPLES)/iv32/cubes.mov
@@ -14,4 +20,4 @@ FATE_INDEO-$(call DEMDEC, AVI, INDEO5) += fate-indeo5
 fate-indeo5: CMD = framecrc -i 
$(TARGET_SAMPLES)/iv50/Educ_Movie_DeadlyForce.avi -an
 
 FATE_SAMPLES_AVCONV += $(FATE_INDEO-yes)
-fate-indeo: $(FATE_INDEO-yes)
+fate-indeo: fate-indeo2 $(FATE_INDEO-yes)
diff --git a/tests/ref/fate/indeo2-delta b/tests/ref/fate/indeo2-delta
new file mode 100644
index 000..c197dcc
--- /dev/null
+++ b/tests/ref/fate/indeo2-delta
@@ -0,0 +1,115 @@
+#tb 0: 16567/25
+0,  0,  0,1,21600, 0xa3e914dd
+0,  1,  1,1,21600, 0x367eb420
+0,  2,  2,1,21600, 0x527488e2
+0,  3,  3,1,21600, 0x5e704dcb
+0,  4,  4,1,21600, 0xfbfb35d4
+0,  5,  5,1,21600, 0xf6e168de
+0,  6,  6,1,21600, 0x0b589818
+0,  7,  7,1,21600, 0xc67b2dbd
+0,  8,  8,1,21600, 0x002f4994
+0,  9,  9,1,21600, 0xe3a476f2
+0, 10, 10,1,21600, 0xbc5f0f39
+0, 11, 11,1,21600, 0xef095e3a
+0, 12, 12,1,21600, 0x6bb4f515
+0, 13, 13,1,21600, 0x1be1f0fa
+0, 14, 14,1,21600, 0x0d855464
+0, 15, 15,1,21600, 0x6711b47d
+0, 16, 16,1,21600, 0x14cb2640
+0, 17, 17,1,21600, 0x5b794027
+0, 18, 18,1,21600, 0xf8cfab3c
+0, 19, 19,1,21600, 0xe639b0c2
+0, 20, 20,1,21600, 0x403b3d7b
+0, 21, 21,1,21600, 0x364cbb6f
+0, 22, 22,1,21600, 0xadff6c72
+0, 23, 23,1,21600, 0x76c85b52
+0, 24, 24,1,21600, 0xbe85ec80
+0, 25, 25,1,21600, 0x1e9f9e50
+0, 26, 26,1,21600, 0xbd31bd82
+0, 27, 27,1,21600, 0x4445a12a
+0, 28, 28,1,21600, 0x08f25888
+0, 29, 29,1,21600, 0x73d45696
+0, 30, 30,1,21600, 0xbc681a10
+0, 31, 31,1,21600, 0x03f502be
+0, 32, 32,1,21600, 0x9206a757
+0, 33, 33,1,21600, 0x3ed5e1be
+0, 34, 34,1,21600, 0x76b636a9
+0, 35, 35,1,21600, 0x7d40ccb0
+0, 36, 36,1,21600, 0xa2955499
+0, 37, 37,1,21600, 0xf4b20c86
+0, 38, 38,1,21600, 0xe497d681
+0, 39, 39,1,21600, 0x831ef973
+0, 40, 40,1,21600, 0x43aa78e6
+0, 41, 41,1,21600, 0x26e4bdb6
+0, 42, 42,1,21600, 0xd04e9feb
+0, 43, 43,1,21600, 0x08ef4b58
+0, 44, 44,1,21600, 0x30b84cc3
+0, 45, 45,1,21600, 0x04e1dec0
+0, 46, 46,1,21600, 0xed4f24d5
+0, 47, 47,1,21600, 0xcc9f8d4c
+0, 48, 48,1,21600, 0x402ff69a
+0, 49, 49,1,21600, 0xd77a4e7b
+0, 50, 50,1,21600, 0xe614de71
+0, 51, 51,1,21600, 0x18daccbd
+0, 52, 52,1,21600, 0x87e896d1
+0, 53, 53,1,21600, 0x51d76264
+0, 54, 54,1,21600, 0x9b910304
+0, 55, 55,1,21600, 0xd3a7aa30
+0, 56, 56,1,21600, 0x40e4e926
+0, 57,   

[libav-devel] [PATCH 4/4] vc1dec: Check group allocations separatedly

2016-02-24 Thread Vittorio Giovara
This avoids summing offsets to NULL pointers in case of error.
---
 libavcodec/vc1dec.c | 25 +++--
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 5c2cf9f..67c14c2 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -324,31 +324,50 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 v->fieldtx_plane= av_mallocz(s->mb_stride * mb_height);
 v->acpred_plane = av_malloc (s->mb_stride * mb_height);
 v->over_flags_plane = av_malloc (s->mb_stride * mb_height);
+if (!v->mv_type_mb_plane || !v->direct_mb_plane || !v->forward_mb_plane ||
+!v->fieldtx_plane || !v->acpred_plane || !v->over_flags_plane)
+goto error;
 
 v->n_allocated_blks = s->mb_width + 2;
 v->block= av_malloc(sizeof(*v->block) * v->n_allocated_blks);
 v->cbp_base = av_malloc(sizeof(v->cbp_base[0]) * 2 * s->mb_stride);
+if (!v->block || !v->cbp_base)
+goto error;
 v->cbp  = v->cbp_base + s->mb_stride;
 v->ttblk_base   = av_malloc(sizeof(v->ttblk_base[0]) * 2 * 
s->mb_stride);
+if (!v->ttblk_base)
+goto error;
 v->ttblk= v->ttblk_base + s->mb_stride;
 v->is_intra_base= av_mallocz(sizeof(v->is_intra_base[0]) * 2 * 
s->mb_stride);
+if (!v->is_intra_base)
+goto error;
 v->is_intra = v->is_intra_base + s->mb_stride;
 v->luma_mv_base = av_malloc(sizeof(v->luma_mv_base[0]) * 2 * 
s->mb_stride);
+if (!v->luma_mv_base)
+goto error;
 v->luma_mv  = v->luma_mv_base + s->mb_stride;
 
 /* allocate block type info in that way so it could be used with 
s->block_index[] */
 v->mb_type_base = av_malloc(s->b8_stride * (mb_height * 2 + 1) + 
s->mb_stride * (mb_height + 1) * 2);
+if (!v->mb_type_base)
+goto error;
 v->mb_type[0]   = v->mb_type_base + s->b8_stride + 1;
 v->mb_type[1]   = v->mb_type_base + s->b8_stride * (mb_height * 2 + 1) + 
s->mb_stride + 1;
 v->mb_type[2]   = v->mb_type[1] + s->mb_stride * (mb_height + 1);
 
 /* allocate memory to store block level MV info */
 v->blk_mv_type_base = av_mallocz( s->b8_stride * (mb_height * 2 + 1) + 
s->mb_stride * (mb_height + 1) * 2);
+if (!v->blk_mv_type_base)
+goto error;
 v->blk_mv_type  = v->blk_mv_type_base + s->b8_stride + 1;
 v->mv_f_base= av_mallocz(2 * (s->b8_stride * (mb_height * 2 + 1) + 
s->mb_stride * (mb_height + 1) * 2));
+if (!v->mv_f_base)
+goto error;
 v->mv_f[0]  = v->mv_f_base + s->b8_stride + 1;
 v->mv_f[1]  = v->mv_f[0] + (s->b8_stride * (mb_height * 2 + 1) + 
s->mb_stride * (mb_height + 1) * 2);
 v->mv_f_next_base   = av_mallocz(2 * (s->b8_stride * (mb_height * 2 + 1) + 
s->mb_stride * (mb_height + 1) * 2));
+if (!v->mv_f_next_base)
+goto error;
 v->mv_f_next[0] = v->mv_f_next_base + s->b8_stride + 1;
 v->mv_f_next[1] = v->mv_f_next[0] + (s->b8_stride * (mb_height * 2 + 
1) + s->mb_stride * (mb_height + 1) * 2);
 
@@ -362,12 +381,6 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 }
 }
 
-if (!v->mv_type_mb_plane || !v->direct_mb_plane || !v->acpred_plane || 
!v->over_flags_plane ||
-!v->block || !v->cbp_base || !v->ttblk_base || !v->is_intra_base || 
!v->luma_mv_base ||
-!v->mb_type_base) {
-goto error;
-}
-
 return 0;
 error:
 ff_vc1_decode_end(s->avctx);
-- 
2.7.0

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


[libav-devel] [PATCH 2/4] vc1dec: Properly call deinit function on error

2016-02-24 Thread Vittorio Giovara
This functions allocates tons of buffers, free on error in a
separate one.
---
 libavcodec/vc1dec.c | 15 ---
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 2cd7a03..104c3a3 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -362,20 +362,13 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 if (!v->mv_type_mb_plane || !v->direct_mb_plane || !v->acpred_plane || 
!v->over_flags_plane ||
 !v->block || !v->cbp_base || !v->ttblk_base || !v->is_intra_base || 
!v->luma_mv_base ||
 !v->mb_type_base) {
-av_freep(>mv_type_mb_plane);
-av_freep(>direct_mb_plane);
-av_freep(>acpred_plane);
-av_freep(>over_flags_plane);
-av_freep(>block);
-av_freep(>cbp_base);
-av_freep(>ttblk_base);
-av_freep(>is_intra_base);
-av_freep(>luma_mv_base);
-av_freep(>mb_type_base);
-return AVERROR(ENOMEM);
+goto error;
 }
 
 return 0;
+error:
+ff_vc1_decode_end(s->avctx);
+return AVERROR(ENOMEM);
 }
 
 av_cold void ff_vc1_init_transposed_scantables(VC1Context *v)
-- 
2.7.0

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


Re: [libav-devel] [PATCH 2/3] idct: Only build prores IDCT if ProRes decoder is enabled

2016-02-24 Thread Vittorio Giovara
On Tue, Feb 23, 2016 at 1:13 PM, Diego Biurrun  wrote:
> ---
>  libavcodec/simple_idct.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/simple_idct.c b/libavcodec/simple_idct.c
> index f61e9e6..6ee1320 100644
> --- a/libavcodec/simple_idct.c
> +++ b/libavcodec/simple_idct.c
> @@ -218,6 +218,7 @@ void ff_simple_idct44_add(uint8_t *dest, int line_size, 
> int16_t *block)
>  }
>  }
>
> +#if CONFIG_PRORES_DECODER
>  void ff_prores_idct(int16_t *block, const int16_t *qmat)
>  {
>  int i;
> @@ -231,3 +232,4 @@ void ff_prores_idct(int16_t *block, const int16_t *qmat)
>  for (i = 0; i < 8; i++)
>  idctSparseCol_10(block + i);
>  }
> +#endif /* CONFIG_PRORES_DECODER */
> --
> 2.5.0

sure

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


Re: [libav-devel] [PATCH] qsv: Move down the implementation query

2016-02-24 Thread Vittorio Giovara
On Wed, Feb 24, 2016 at 9:14 AM, Luca Barbato  wrote:
> The plugin loaded may not match the general implementation capability
> wise.
> ---
>  libavcodec/qsv.c | 32 
>  1 file changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
> index ee6b262..3e892e8 100644
> --- a/libavcodec/qsv.c
> +++ b/libavcodec/qsv.c
> @@ -101,22 +101,6 @@ int ff_qsv_init_internal_session(AVCodecContext *avctx, 
> mfxSession *session,
>  return ff_qsv_error(ret);
>  }
>
> -MFXQueryIMPL(*session, );
> -
> -switch (MFX_IMPL_BASETYPE(impl)) {
> -case MFX_IMPL_SOFTWARE:
> -desc = "software";
> -break;
> -case MFX_IMPL_HARDWARE:
> -case MFX_IMPL_HARDWARE2:
> -case MFX_IMPL_HARDWARE3:
> -case MFX_IMPL_HARDWARE4:
> -desc = "hardware accelerated";
> -break;
> -default:
> -desc = "unknown";
> -}
> -
>  if (load_plugins && *load_plugins) {
>  while (*load_plugins) {
>  mfxPluginUID uid;
> @@ -156,6 +140,22 @@ load_plugin_fail:
>  }
>  }
>
> +MFXQueryIMPL(*session, );
> +
> +switch (MFX_IMPL_BASETYPE(impl)) {
> +case MFX_IMPL_SOFTWARE:
> +desc = "software";
> +break;
> +case MFX_IMPL_HARDWARE:
> +case MFX_IMPL_HARDWARE2:
> +case MFX_IMPL_HARDWARE3:
> +case MFX_IMPL_HARDWARE4:
> +desc = "hardware accelerated";
> +break;
> +default:
> +desc = "unknown";
> +}
> +
>  av_log(avctx, AV_LOG_VERBOSE,
> "Initialized an internal MFX session using %s implementation\n",
> desc);
> --

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


[libav-devel] [PATCH 3/4] vc1dec: Fix leak on error for array allocations

2016-02-24 Thread Vittorio Giovara
The deinit function in the 'error' section will correctly free
everything.
---
 libavcodec/vc1dec.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 104c3a3..5c2cf9f 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -355,8 +355,11 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 ff_intrax8_common_init(>x8,s);
 
 if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == 
AV_CODEC_ID_VC1IMAGE) {
-for (i = 0; i < 4; i++)
-if (!(v->sr_rows[i >> 1][i & 1] = av_malloc(v->output_width))) 
return -1;
+for (i = 0; i < 4; i++) {
+v->sr_rows[i >> 1][i & 1] = av_malloc(v->output_width);
+if (!v->sr_rows[i >> 1][i & 1])
+goto error;
+}
 }
 
 if (!v->mv_type_mb_plane || !v->direct_mb_plane || !v->acpred_plane || 
!v->over_flags_plane ||
-- 
2.7.0

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


[libav-devel] [PATCH 1/4] vc1dec: Drop commented out cruft

2016-02-24 Thread Vittorio Giovara
---
 libavcodec/vc1dec.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index d65c68a..2cd7a03 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -352,14 +352,6 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 v->mv_f_next[0] = v->mv_f_next_base + s->b8_stride + 1;
 v->mv_f_next[1] = v->mv_f_next[0] + (s->b8_stride * (mb_height * 2 + 
1) + s->mb_stride * (mb_height + 1) * 2);
 
-/* Init coded blocks info */
-if (v->profile == PROFILE_ADVANCED) {
-//if (alloc_bitplane(>over_flags_plane, s->mb_width, s->mb_height) 
< 0)
-//return -1;
-//if (alloc_bitplane(>ac_pred_plane, s->mb_width, s->mb_height) < 0)
-//return -1;
-}
-
 ff_intrax8_common_init(>x8,s);
 
 if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == 
AV_CODEC_ID_VC1IMAGE) {
-- 
2.7.0

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


[libav-devel] [PATCH] lavf: Handle query parameters when checking extensions

2016-02-24 Thread Vittorio Giovara
A webserver omits the Content-Type or if mime-magic fails for unexpected
reasons, probing an image HTTP URL with query parameters will fail in
the extension match.

So check the protocol used is http or https, and drop anything after
the first query parameter when evaluating an image URL.

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
Here is the correct patch I had in mind.
Cheers,
Vittorio

 libavformat/format.c | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/libavformat/format.c b/libavformat/format.c
index 24b7205..77e1155 100644
--- a/libavformat/format.c
+++ b/libavformat/format.c
@@ -76,22 +76,34 @@ void av_register_output_format(AVOutputFormat *format)
 
 int av_match_ext(const char *filename, const char *extensions)
 {
-const char *ext, *p;
+const char *ext, *extra, *p;
 char ext1[32], *q;
+int len, is_http;
 
 if (!filename)
 return 0;
 
+is_http = av_strstart(filename, "http://;, NULL) ||
+  av_strstart(filename, "https://;, NULL);
+
 ext = strrchr(filename, '.');
 if (ext) {
 ext++;
+
+len = strlen(ext);
+if (is_http) {
+extra = strrchr(ext, '?');
+if (extra)
+len -= strlen(extra);
+}
+
 p = extensions;
 for (;;) {
 q = ext1;
 while (*p != '\0' && *p != ','  && q - ext1 < sizeof(ext1) - 1)
 *q++ = *p++;
 *q = '\0';
-if (!av_strcasecmp(ext1, ext))
+if (!av_strncasecmp(ext1, ext, len))
 return 1;
 if (*p == '\0')
 break;
-- 
2.7.0

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


Re: [libav-devel] [PATCH] img2dec: Handle query parameters when checking extensions

2016-02-24 Thread Vittorio Giovara
On Wed, Feb 24, 2016 at 1:43 PM, Vittorio Giovara
<vittorio.giov...@gmail.com> wrote:
> A webserver omits the Content-Type or if mime-magic fails for unexpected
> reasons, probing an image HTTP URL with query parameters will fail in
> the extension match.
>
> So check the protocol used is http or https, and drop anything after
> the first query parameter when evaluating an image URL.
>
> Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>

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


[libav-devel] [PATCH] img2dec: Handle query parameters when checking extensions

2016-02-24 Thread Vittorio Giovara
A webserver omits the Content-Type or if mime-magic fails for unexpected
reasons, probing an image HTTP URL with query parameters will fail in
the extension match.

So check the protocol used is http or https, and drop anything after
the first query parameter when evaluating an image URL.

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
This should be the less hack-y version, even though it does not fully
address the image2 decoder.
Vittorio

 libavformat/img2.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/libavformat/img2.c b/libavformat/img2.c
index 3cfc08e..698b907 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -84,13 +84,25 @@ static const IdStrMap img_tags[] = {
 
 static enum AVCodecID str2id(const IdStrMap *tags, const char *str)
 {
+char *extra;
+int len;
+int is_http = av_strstart(str, "http://;, NULL) ||
+  av_strstart(str, "https://;, NULL);
+
 str = strrchr(str, '.');
 if (!str)
 return AV_CODEC_ID_NONE;
 str++;
+len = strlen(str);
+
+if (is_http) {
+extra = strrchr(str, '?');
+if (extra)
+len -= strlen(extra);
+}
 
 while (tags->id) {
-if (!av_strcasecmp(str, tags->str))
+if (!av_strncasecmp(str, tags->str, len))
 return tags->id;
 
 tags++;
-- 
2.7.0

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


Re: [libav-devel] [PATCH 01/25] fate: Add test for WMV2 with jframes

2016-02-24 Thread Vittorio Giovara
On Tue, Feb 23, 2016 at 3:36 PM, Derek Buitenhuis
<derek.buitenh...@gmail.com> wrote:
> On 2/23/2016 1:17 AM, Vittorio Giovara wrote:
>> ---
>> The test sample is already on FATE strangely enough.
>> Vittorio
>>
>>  tests/fate/microsoft.mak|   3 +
>>  tests/ref/fate/wmv8-intrax8 | 475 
>> 
>>  2 files changed, 478 insertions(+)
>>  create mode 100644 tests/ref/fate/wmv8-intrax8
>
> I'm pretty sure it was removed at some point because
> it was not a portable test for some reason or another.

I'll double check on oracle
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] mov: Trim dref absolute path

2016-02-24 Thread Vittorio Giovara
On Wed, Feb 17, 2016 at 2:41 AM, Luca Barbato <lu_z...@gentoo.org> wrote:
> On 16/02/16 22:26, Vittorio Giovara wrote:
>> On Tue, Feb 16, 2016 at 2:19 AM, Luca Barbato <lu_z...@gentoo.org> wrote:
>>> On 16/02/16 03:44, Vittorio Giovara wrote:
>>>> Samples produced by Omneon (Harmonic) store external references with
>>>> paths ending with 0s. Such movs cannot be loaded properly since every
>>>> 0 is converted to '/', to keep the same parsing code for dref type 2
>>>> and type 18: this makes the external reference point to a non-existing
>>>> direactory, rather than to the actual referenced file.
>>>>
>>>> Add a brief trimming loop that drops all ending 0s before trying to
>>>> parse the external reference path.
>>>>
>>>> Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
>>>> ---
>>>> Note: all samples I was given only have one zero appended, so it might
>>>> be enough to just do something like
>>>>
>>>> -if (dref->path[j] == ':' || dref->path[j] == 0)
>>>> +if (dref->path[j] == ':' || (dref->path[j] == 0 && j < len -1))
>>>>
>>>> the loop seems safer but potentially wasteful.
>>>> Opinions?
>>>> Vittorio
>>>>
>>>>  libavformat/mov.c | 7 +++
>>>>  1 file changed, 7 insertions(+)
>>>>
>>>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>>>> index 1cb91b9..7081ead 100644
>>>> --- a/libavformat/mov.c
>>>> +++ b/libavformat/mov.c
>>>> @@ -554,6 +554,13 @@ static int mov_read_dref(MOVContext *c, AVIOContext 
>>>> *pb, MOVAtom atom)
>>>>  memmove(dref->path, dref->path+volume_len, len);
>>>>  dref->path[len] = 0;
>>>>  }
>>>> +// trim string of any ending zeros
>>>> +for (j = len - 1; j >= 0; j--) {
>>>> +if (dref->path[j] == 0)
>>>> +len--;
>>>> +else
>>>> +break;
>>>> +}
>>>>  for (j = 0; j < len; j++)
>>>>  if (dref->path[j] == ':' || dref->path[j] == 0)
>>>>  dref->path[j] = '/';
>>>>
>>>
>>> breaking the other loop in the presence of 0 isn't an option?
>>
>> No because for dref type 18 uses 0 instead of / for setting absolute path
>> I think this software is adding the null terminator even though it's
>> not strictly required, so it might be enough to just opt for the other
>> alternative I proposed.
>>
>
> Then I guess is fine your way.

Which way? Patch as is or the other version that trims by 1 character only?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 4/4] avprobe: switch to codecpar

2016-02-24 Thread Vittorio Giovara
On Wed, Feb 24, 2016 at 10:36 AM, Anton Khirnov  wrote:
> ---
>  avprobe.c | 107 
> ++
>  1 file changed, 65 insertions(+), 42 deletions(-)

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


Re: [libav-devel] [PATCH 3/4] avprobe: add local per-stream state

2016-02-24 Thread Vittorio Giovara
On Wed, Feb 24, 2016 at 10:36 AM, Anton Khirnov  wrote:
> This will be useful in the following commits.
> ---
>  avprobe.c | 20 
>  1 file changed, 20 insertions(+)

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


Re: [libav-devel] [PATCH 2/4] avprobe: add local per-file state

2016-02-24 Thread Vittorio Giovara
On Wed, Feb 24, 2016 at 10:36 AM, Anton Khirnov  wrote:
> Do not pass just a bare AVFormatContext pointer around, wrap it in
> struct. This will be useful in the following commits.
> ---
>  avprobe.c | 38 +++---
>  1 file changed, 23 insertions(+), 15 deletions(-)

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


Re: [libav-devel] [PATCH 1/4] mpegvideo_enc: use avcodec_free_context() instead of av_free()

2016-02-24 Thread Vittorio Giovara
On Wed, Feb 24, 2016 at 10:36 AM, Anton Khirnov  wrote:
> ---
>  libavcodec/mpegvideo_enc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
> index d16e408..96f49ef 100644
> --- a/libavcodec/mpegvideo_enc.c
> +++ b/libavcodec/mpegvideo_enc.c
> @@ -1343,8 +1343,7 @@ static int estimate_best_b_count(MpegEncContext *s)
>  }
>  }
>
> -avcodec_close(c);
> -av_freep();
> +avcodec_free_context();
>
>  return best_b_count;
>  }
> --
> 2.0.0

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


Re: [libav-devel] [PATCH 2/2] APIchanges: add missing hashes and dates

2016-02-24 Thread Vittorio Giovara
On Wed, Feb 24, 2016 at 5:01 AM, Anton Khirnov  wrote:
> Also, remove a stray line (apparently fallout from conflict resolution).
> ---
>  doc/APIchanges | 72 
> --
>  1 file changed, 35 insertions(+), 37 deletions(-)

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


Re: [libav-devel] [PATCH 1/2] lavf: add a missing bump and APIchanges for the codecpar switch

2016-02-24 Thread Vittorio Giovara
On Wed, Feb 24, 2016 at 5:01 AM, Anton Khirnov  wrote:
> ---
>  doc/APIchanges| 3 +++
>  libavformat/version.h | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 70fce18..2db39de 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,9 @@ libavutil: 2015-08-28
>
>  API changes, most recent first:
>
> +2016-02-23 - 9200514 - lavf 57.5.0 - avformat.h
> +  Add AVStream.codecpar, deprecate AVStream.codec.
> +
>  2016-xx-xx - lavc 57.14.0 - avcodec.h
>xxx - Add AVCodecParameters and its related API.
>xxx - Add av_get_audio_frame_duration2().
> diff --git a/libavformat/version.h b/libavformat/version.h
> index 58544c9..f264076 100644
> --- a/libavformat/version.h
> +++ b/libavformat/version.h
> @@ -30,7 +30,7 @@
>  #include "libavutil/version.h"
>
>  #define LIBAVFORMAT_VERSION_MAJOR 57
> -#define LIBAVFORMAT_VERSION_MINOR  4
> +#define LIBAVFORMAT_VERSION_MINOR  5
>  #define LIBAVFORMAT_VERSION_MICRO  0
>
>  #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
> --
> 2.0.0

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


[libav-devel] [RFC] [PATCH 2/2] img2dec: Handle query parameters when checking extensions

2016-02-23 Thread Vittorio Giovara
A webserver omits the Content-Type or if mime-magic fails for unexpected
reasons, probing an image HTTP URL with query parameters will fail in
the extension match.

So check the protocol used is http or https, and drop anything after
the first query parameter when evaluating an image URL.

Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
This fixes http://url/path.jpg?query=1 not being detected at all.
Video streams do not seem to need a similar solution, since they
use more ways to probe data before falling back to extensions.
I'm open to other solutions/ideas/suggestsions.
Cheers,
Vittorio

 libavformat/img2.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/libavformat/img2.c b/libavformat/img2.c
index 3cfc08e..698b907 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -84,13 +84,25 @@ static const IdStrMap img_tags[] = {
 
 static enum AVCodecID str2id(const IdStrMap *tags, const char *str)
 {
+char *extra;
+int len;
+int is_http = av_strstart(str, "http://;, NULL) ||
+  av_strstart(str, "https://;, NULL);
+
 str = strrchr(str, '.');
 if (!str)
 return AV_CODEC_ID_NONE;
 str++;
+len = strlen(str);
+
+if (is_http) {
+extra = strrchr(str, '?');
+if (extra)
+len -= strlen(extra);
+}
 
 while (tags->id) {
-if (!av_strcasecmp(str, tags->str))
+if (!av_strncasecmp(str, tags->str, len))
 return tags->id;
 
 tags++;
-- 
2.7.0

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


[libav-devel] [PATCH 1/2] img2: Drop av_ prefix for a static function

2016-02-23 Thread Vittorio Giovara
This prefix is reserved for public functions only.
---
 libavformat/img2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/img2.c b/libavformat/img2.c
index 9f462d0..3cfc08e 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -82,7 +82,7 @@ static const IdStrMap img_tags[] = {
 { AV_CODEC_ID_NONE,   NULL   }
 };
 
-static enum AVCodecID av_str2id(const IdStrMap *tags, const char *str)
+static enum AVCodecID str2id(const IdStrMap *tags, const char *str)
 {
 str = strrchr(str, '.');
 if (!str)
@@ -100,5 +100,5 @@ static enum AVCodecID av_str2id(const IdStrMap *tags, const 
char *str)
 
 enum AVCodecID ff_guess_image2_codec(const char *filename)
 {
-return av_str2id(img_tags, filename);
+return str2id(img_tags, filename);
 }
-- 
2.7.0

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


Re: [libav-devel] [PATCH 20/25] intrax8: Keep a reference to the decoder blocks

2016-02-23 Thread Vittorio Giovara
On Tue, Feb 23, 2016 at 10:51 AM, Diego Biurrun <di...@biurrun.de> wrote:
> On Mon, Feb 22, 2016 at 08:17:44PM -0500, Vittorio Giovara wrote:
>> ---
>> NOTE: both these elements are not actually used by the decoders:
>> vc1 modifies them only for intra (non-j) or interframes, wmv2 does
>> something similar. I'm not extremely confident in dropping the references,
>> at least not right now, however these two buffers could and should be
>> made local.
>>
>> Opinions?
>
> Does FATE still pass w/o them?

yes, however I am not sure to what size blocks should be allocated
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 01/25] fate: Add test for WMV2 with jframes

2016-02-23 Thread Vittorio Giovara
On Tue, Feb 23, 2016 at 10:37 AM, Diego Biurrun <di...@biurrun.de> wrote:
> On Tue, Feb 23, 2016 at 10:20:56AM -0500, Vittorio Giovara wrote:
>> On Tue, Feb 23, 2016 at 2:05 AM, Diego Biurrun <di...@biurrun.de> wrote:
>> > On Mon, Feb 22, 2016 at 08:17:25PM -0500, Vittorio Giovara wrote:
>> >> --- a/tests/fate/microsoft.mak
>> >> +++ b/tests/fate/microsoft.mak
>> >> @@ -38,6 +38,9 @@ fate-wmv8-drm-nodec: CMD = framecrc -cryptokey 
>> >> 137381538c84c068111902a59c5cf6c34
>> >>  FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, WMV3) += $(FATE_WMV8_DRM)
>> >>  fate-wmv8_drm: $(FATE_WMV8_DRM)
>> >>
>> >> +FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, WMV3) += fate-wmv8-intrax8
>> >> +fate-wmv8-intrax8: CMD = framecrc -flags +bitexact -i 
>> >> $(TARGET_SAMPLES)/wmv8/wmv8_x8intra.wmv -an
>> >
>> > This is wrong, WMV3 is WMV9, not WMV8.  fate-wmv8_drm is misnamed as well.
>>
>> The file is a WMV2 though
>
> Then the condition is wrong.

I see, then locally changed to

FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, WMV2) += fate-wmv8-intrax8
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 13/25] intrax8: Use a local buffer instead of a ScratchpadContext

2016-02-23 Thread Vittorio Giovara
On Tue, Feb 23, 2016 at 8:22 AM, Diego Biurrun <di...@biurrun.de> wrote:
> On Mon, Feb 22, 2016 at 08:17:37PM -0500, Vittorio Giovara wrote:
>> Sustain possible size changes via av_fast_malloc().
>
> Sustain?  That's not the right word, but I'm a tad unsure what you are
> trying to say here.

If there is a parameter change we might need a bigger buffer, so I
opted for this function that frees the old pointer and allocates a new
one.

>> --- a/libavcodec/intrax8.c
>> +++ b/libavcodec/intrax8.c
>> @@ -773,6 +773,7 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, 
>> Picture *pict,
>>  {
>>  MpegEncContext *const s = w->s;
>>  int mb_xy;
>> +int alloc_size = FFALIGN(FFABS(pict->f->linesize[0]) + 32, 32) * 2 * 24;
>
> That's a lot of magic numbers.

indeed, they are the ones used in mpegvideo
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 07/25] vc1dec: wmv2dec: Validate ff_intrax8_common_init return value

2016-02-23 Thread Vittorio Giovara
On Tue, Feb 23, 2016 at 6:09 AM, Diego Biurrun <di...@biurrun.de> wrote:
> On Mon, Feb 22, 2016 at 08:17:31PM -0500, Vittorio Giovara wrote:
>> --- a/libavcodec/vc1dec.c
>> +++ b/libavcodec/vc1dec.c
>> @@ -360,7 +360,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context 
>> *v)
>>
>> -ff_intrax8_common_init(>x8,s);
>> +ret = ff_intrax8_common_init(>x8, s);
>>
>>  if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id 
>> == AV_CODEC_ID_VC1IMAGE) {
>>  for (i = 0; i < 4; i++)
>> @@ -369,7 +369,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context 
>> *v)
>>
>>  if (!v->mv_type_mb_plane || !v->direct_mb_plane || !v->acpred_plane || 
>> !v->over_flags_plane ||
>>  !v->block || !v->cbp_base || !v->ttblk_base || !v->is_intra_base || 
>> !v->luma_mv_base ||
>> -!v->mb_type_base) {
>> +!v->mb_type_base || ret < 0) {
>>  av_freep(>mv_type_mb_plane);
>>  av_freep(>direct_mb_plane);
>
> You should return right away, not pointlessly call those mallocs after
> the failure.

If I return right away I leak all the mallocs above.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 01/25] fate: Add test for WMV2 with jframes

2016-02-23 Thread Vittorio Giovara
On Tue, Feb 23, 2016 at 2:05 AM, Diego Biurrun <di...@biurrun.de> wrote:
> On Mon, Feb 22, 2016 at 08:17:25PM -0500, Vittorio Giovara wrote:
>> --- a/tests/fate/microsoft.mak
>> +++ b/tests/fate/microsoft.mak
>> @@ -38,6 +38,9 @@ fate-wmv8-drm-nodec: CMD = framecrc -cryptokey 
>> 137381538c84c068111902a59c5cf6c34
>>  FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, WMV3) += $(FATE_WMV8_DRM)
>>  fate-wmv8_drm: $(FATE_WMV8_DRM)
>>
>> +FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, WMV3) += fate-wmv8-intrax8
>> +fate-wmv8-intrax8: CMD = framecrc -flags +bitexact -i 
>> $(TARGET_SAMPLES)/wmv8/wmv8_x8intra.wmv -an
>
> This is wrong, WMV3 is WMV9, not WMV8.  fate-wmv8_drm is misnamed as well.

The file is a WMV2 though
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 12/25] intrax8: Pass the output frame to the decoding function

2016-02-22 Thread Vittorio Giovara
---
 libavcodec/intrax8.c   | 21 +++--
 libavcodec/intrax8.h   |  7 +--
 libavcodec/vc1_block.c |  4 +++-
 libavcodec/wmv2dec.c   |  3 ++-
 4 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index d9c156c..d0e7e93 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -333,7 +333,7 @@ static int x8_setup_spatial_predictor(IntraX8Context *const 
w, const int chroma)
 int quant;
 
 w->dsp.setup_spatial_compensation(w->dest[chroma], s->sc.edge_emu_buffer,
-  s->current_picture.f->linesize[chroma > 
0],
+  w->frame->linesize[chroma > 0],
   , , w->edges);
 if (chroma) {
 w->orient = w->chroma_orient;
@@ -664,7 +664,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, 
const int chroma)
 
 dsp_x8_put_solidcolor(av_clip_uint8((dc_level * dc_quant + 4) >> 
3),
   w->dest[chroma],
-  s->current_picture.f->linesize[!!chroma]);
+  w->frame->linesize[!!chroma]);
 
 goto block_placed;
 }
@@ -690,15 +690,15 @@ static int x8_decode_intra_mb(IntraX8Context *const w, 
const int chroma)
 
 if (w->flat_dc) {
 dsp_x8_put_solidcolor(w->predicted_dc, w->dest[chroma],
-  s->current_picture.f->linesize[!!chroma]);
+  w->frame->linesize[!!chroma]);
 } else {
 w->dsp.spatial_compensation[w->orient](s->sc.edge_emu_buffer,
w->dest[chroma],
-   
s->current_picture.f->linesize[!!chroma]);
+   w->frame->linesize[!!chroma]);
 }
 if (!zeros_only)
 w->idsp.idct_add(w->dest[chroma],
- s->current_picture.f->linesize[!!chroma],
+ w->frame->linesize[!!chroma],
  s->block[0]);
 
 block_placed:
@@ -707,7 +707,7 @@ block_placed:
 
 if (w->loopfilter) {
 uint8_t *ptr = w->dest[chroma];
-int linesize = s->current_picture.f->linesize[!!chroma];
+int linesize = w->frame->linesize[!!chroma];
 
 if (!((w->edges & 2) || (zeros_only && (w->orient | 4) == 4)))
 w->dsp.h_loop_filter(ptr, linesize, w->quant);
@@ -768,8 +768,8 @@ av_cold void ff_intrax8_common_end(IntraX8Context *w)
 av_freep(>prediction_table);
 }
 
-int ff_intrax8_decode_picture(IntraX8Context *const w, int dquant,
-  int quant_offset, int loopfilter)
+int ff_intrax8_decode_picture(IntraX8Context *const w, Picture *pict,
+  int dquant, int quant_offset, int loopfilter)
 {
 MpegEncContext *const s = w->s;
 int mb_xy;
@@ -779,6 +779,7 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, int 
dquant,
 w->dquant = dquant;
 w->quant  = dquant >> 1;
 w->qsum   = quant_offset;
+w->frame  = pict->f;
 w->loopfilter = loopfilter;
 
 w->divide_quant_dc_luma = ((1 << 16) + (w->quant >> 1)) / w->quant;
@@ -795,7 +796,7 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, int 
dquant,
 s->resync_mb_y = 0;
 
 for (s->mb_y = 0; s->mb_y < s->mb_height * 2; s->mb_y++) {
-x8_init_block_index(w, s->current_picture.f, s->mb_y);
+x8_init_block_index(w, w->frame, s->mb_y);
 mb_xy = (s->mb_y >> 1) * s->mb_stride;
 
 for (s->mb_x = 0; s->mb_x < s->mb_width * 2; s->mb_x++) {
@@ -824,7 +825,7 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, int 
dquant,
 /* emulate MB info in the relevant tables */
 s->mbskip_table[mb_xy] = 0;
 s->mbintra_table[mb_xy]= 1;
-s->current_picture.qscale_table[mb_xy] = w->quant;
+pict->qscale_table[mb_xy] = w->quant;
 mb_xy++;
 }
 w->dest[0] += 8;
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
index ba3a207..e82a432 100644
--- a/libavcodec/intrax8.h
+++ b/libavcodec/intrax8.h
@@ -23,6 +23,7 @@
 #include "mpegvideo.h"
 #include "idctdsp.h"
 #include "intrax8dsp.h"
+#include "mpegpicture.h"
 
 typedef struct IntraX8Context {
 VLC *j_ac_vlc[4]; // they point to the static j_mb_vlc
@@ -43,6 +44,7 @@ typedef struct IntraX8Context {
 int dquant;
 int qsum;
 int loopfilter;
+AVFrame *frame;
 
 // calculated per frame
 int quant_dc_chroma;
@@ -86,11 +88,12 @@ void ff_intrax8_common_end(IntraX8Context *w);
  * calling this function.
  * This function does not use ff_mpv_decode_mb().
  * @param w pointer to IntraX8Context
+ * @param pict the output Picture containing an AVFrame
  * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
  * @param 

[libav-devel] [PATCH 10/25] intrax8: Keep a reference to the context idctdsp

2016-02-22 Thread Vittorio Giovara
Use it instead of the embedded mpegvideo one. Update init function
signature to load it directly from the callers.
---
 configure|  2 +-
 libavcodec/intrax8.c | 14 --
 libavcodec/intrax8.h |  6 +-
 libavcodec/vc1dec.c  |  2 +-
 libavcodec/wmv2dec.c |  2 +-
 5 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index d8b8c07..d11b128 100755
--- a/configure
+++ b/configure
@@ -1860,7 +1860,7 @@ error_resilience_select="me_cmp"
 faandct_deps="faan fdctdsp"
 faanidct_deps="faan idctdsp"
 h264dsp_select="startcode"
-intrax8_select="error_resilience"
+intrax8_select="error_resilience idctdsp"
 mdct_select="fft"
 rdft_select="fft"
 me_cmp_select="fdctdsp idctdsp pixblockdsp"
diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 7af5f65..5aa9c36 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -484,7 +484,7 @@ static void x8_ac_compensation(IntraX8Context *const w, int 
const direction,
 {
 MpegEncContext *const s = w->s;
 int t;
-#define B(x, y) s->block[0][s->idsp.idct_permutation[(x) + (y) * 8]]
+#define B(x, y) s->block[0][w->idsp.idct_permutation[(x) + (y) * 8]]
 #define T(x)  ((x) * dc_level + 0x8000) >> 16;
 switch (direction) {
 case 0:
@@ -697,7 +697,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, 
const int chroma)

s->current_picture.f->linesize[!!chroma]);
 }
 if (!zeros_only)
-s->idsp.idct_add(w->dest[chroma],
+w->idsp.idct_add(w->dest[chroma],
  s->current_picture.f->linesize[!!chroma],
  s->block[0]);
 
@@ -736,12 +736,14 @@ static void x8_init_block_index(IntraX8Context *w, 
AVFrame *frame, int mb_y)
 w->dest[2] += (mb_y & (~1)) * uvlinesize << 2;
 }
 
-av_cold int ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s)
+av_cold int ff_intrax8_common_init(IntraX8Context *w, IDCTDSPContext *idsp,
+   MpegEncContext *const s)
 {
 int ret = x8_vlc_init();
 if (ret < 0)
 return ret;
 
+w->idsp = *idsp;
 w->s = s;
 
 // two rows, 2 blocks per cannon mb
@@ -749,11 +751,11 @@ av_cold int ff_intrax8_common_init(IntraX8Context *w, 
MpegEncContext *const s)
 if (!w->prediction_table)
 return AVERROR(ENOMEM);
 
-ff_init_scantable(s->idsp.idct_permutation, >scantable[0],
+ff_init_scantable(w->idsp.idct_permutation, >scantable[0],
   ff_wmv1_scantable[0]);
-ff_init_scantable(s->idsp.idct_permutation, >scantable[1],
+ff_init_scantable(w->idsp.idct_permutation, >scantable[1],
   ff_wmv1_scantable[2]);
-ff_init_scantable(s->idsp.idct_permutation, >scantable[2],
+ff_init_scantable(w->idsp.idct_permutation, >scantable[2],
   ff_wmv1_scantable[3]);
 
 ff_intrax8dsp_init(>dsp);
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
index 5df51ea..a40450f 100644
--- a/libavcodec/intrax8.h
+++ b/libavcodec/intrax8.h
@@ -21,6 +21,7 @@
 
 #include "get_bits.h"
 #include "mpegvideo.h"
+#include "idctdsp.h"
 #include "intrax8dsp.h"
 
 typedef struct IntraX8Context {
@@ -37,6 +38,7 @@ typedef struct IntraX8Context {
 // set by the caller codec
 MpegEncContext *s;
 IntraX8DSPContext dsp;
+IDCTDSPContext idsp;
 int quant;
 int dquant;
 int qsum;
@@ -61,10 +63,12 @@ typedef struct IntraX8Context {
  * Initialize IntraX8 frame decoder.
  * Requires valid MpegEncContext with valid s->mb_width before calling.
  * @param w pointer to IntraX8Context
+ * @param idsp pointer to IDCTDSPContext
  * @param s pointer to MpegEncContext of the parent codec
  * @return 0 on success, < 0 on error
  */
-int ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s);
+int ff_intrax8_common_init(IntraX8Context *w, IDCTDSPContext *idsp,
+   MpegEncContext *const s);
 
 /**
  * Destroy IntraX8 frame structure.
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index e60a084..ffd9f96 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -360,7 +360,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 //return -1;
 }
 
-ret = ff_intrax8_common_init(>x8, s);
+ret = ff_intrax8_common_init(>x8, >idsp, s);
 
 if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == 
AV_CODEC_ID_VC1IMAGE) {
 for (i = 0; i < 4; i++)
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 9418086..84532eb 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -467,7 +467,7 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
 
 ff_wmv2_common_init(w);
 
-return ff_intrax8_common_init(>x8, >s);
+return ff_intrax8_common_init(>x8, >s.idsp, >s);
 }
 
 static av_cold int wmv2_decode_end(AVCodecContext *avctx)
-- 
2.7.0

___
libav-devel mailing list

[libav-devel] [PATCH 22/25] intrax8: Keep a reference to the error resilience context

2016-02-22 Thread Vittorio Giovara
---
This one bugs me since intrax8 decoding process requires no error resilience
whatsoever, and it's only there to make things work with mpegvideo.

I'd really really like to remove error resilience altogether, but that
would require adding two er function calls to the dependent decoders.
Would that be ok?

Vittorio

 libavcodec/intrax8.c |  5 +++--
 libavcodec/intrax8.h | 11 ++-
 libavcodec/vc1dec.c  |  2 +-
 libavcodec/wmv2dec.c |  2 +-
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 2613bf7..b306aa3 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -725,7 +725,7 @@ static void x8_init_block_index(IntraX8Context *w, AVFrame 
*frame)
 
 av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
IntraX8Context *w, IDCTDSPContext *idsp,
-   int16_t (*block)[64],
+   ERContext *er, int16_t (*block)[64],
int block_last_index[12],
int mb_width, int mb_height,
MpegEncContext *const s)
@@ -736,6 +736,7 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
 
 w->avctx = avctx;
 w->idsp = *idsp;
+w->er = *er;
 w->mb_x = 0;
 w->mb_y = 0;
 w->mb_width  = mb_width;
@@ -841,7 +842,7 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, 
Picture *pict,
 }
 
 error:
-ff_er_add_slice(>er, 0, 0,
+ff_er_add_slice(>er, 0, 0,
 (w->mb_x >> 1) - 1, (w->mb_y >> 1) - 1,
 ER_MB_END);
 return 0;
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
index 6e7549c..d4d9c71 100644
--- a/libavcodec/intrax8.h
+++ b/libavcodec/intrax8.h
@@ -21,6 +21,7 @@
 
 #include "blockdsp.h"
 #include "get_bits.h"
+#include "error_resilience.h"
 #include "mpegvideo.h"
 #include "idctdsp.h"
 #include "intrax8dsp.h"
@@ -45,6 +46,7 @@ typedef struct IntraX8Context {
 IntraX8DSPContext dsp;
 IDCTDSPContext idsp;
 BlockDSPContext bdsp;
+ERContext er;
 int quant;
 int dquant;
 int qsum;
@@ -80,6 +82,7 @@ typedef struct IntraX8Context {
  * @param avctx pointer to AVCodecContext
  * @param w pointer to IntraX8Context
  * @param idsp pointer to IDCTDSPContext
+ * @param er pointer to ERContext
  * @param block pointer to the array of blocks
  * @param block_last_index pointer to the array of indexes
  * @param mb_width macroblock width
@@ -89,7 +92,7 @@ typedef struct IntraX8Context {
  */
 int ff_intrax8_common_init(AVCodecContext *avctx,
IntraX8Context *w, IDCTDSPContext *idsp,
-   int16_t (*block)[64],
+   ERContext *er, int16_t (*block)[64],
int block_last_index[12],
int mb_width, int mb_height,
MpegEncContext *const s);
@@ -102,10 +105,8 @@ void ff_intrax8_common_end(IntraX8Context *w);
 
 /**
  * Decode single IntraX8 frame.
- * The parent codec must call ff_mpv_frame_start(), ff_er_frame_start()
- * before calling this function.
- * The parent codec must call ff_er_frame_end(), ff_mpv_frame_end() after
- * calling this function.
+ * The parent codec must call ff_mpv_frame_start() before calling this 
function.
+ * The parent codec must call ff_mpv_frame_end() after calling this function.
  * This function does not use ff_mpv_decode_mb().
  * @param w pointer to IntraX8Context
  * @param pict the output Picture containing an AVFrame
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 023e387..ec65d58 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -360,7 +360,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 //return -1;
 }
 
-ret = ff_intrax8_common_init(s->avctx, >x8, >idsp,
+ret = ff_intrax8_common_init(s->avctx, >x8, >idsp, >er,
  s->block, s->block_last_index,
  s->mb_width, s->mb_height,
  s);
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 9edfdd3..0a04b04 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -469,7 +469,7 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
 
 ff_wmv2_common_init(w);
 
-return ff_intrax8_common_init(avctx, >x8, >s.idsp,
+return ff_intrax8_common_init(avctx, >x8, >s.idsp, >s.er,
   w->s.block, w->s.block_last_index,
   w->s.mb_width, w->s.mb_height, >s);
 }
-- 
2.7.0

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


[libav-devel] [PATCH 02/25] intrax8: Wrap multiline macros in do{}while(0) clauses

2016-02-22 Thread Vittorio Giovara
---
 libavcodec/intrax8.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 3cd84dc..509a8d2 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -62,7 +62,7 @@ static av_cold void x8_vlc_init(void){
 
 static VLC_TYPE table[28150][2];
 
-#define  init_ac_vlc(dst,src) \
+#define  init_ac_vlc(dst,src) do { \
 dst.table = [offset]; \
 dst.table_allocated = sizes[sizeidx]; \
 offset += sizes[sizeidx++]; \
@@ -70,7 +70,8 @@ static av_cold void x8_vlc_init(void){
   AC_VLC_BITS,77, \
   [1],4,2, \
   [0],4,2, \
-  INIT_VLC_USE_NEW_STATIC)
+  INIT_VLC_USE_NEW_STATIC); \
+} while(0)
 //set ac tables
 for(i=0;i<8;i++){
 init_ac_vlc( j_ac_vlc[0][0][i], x8_ac0_highquant_table[i][0] );
@@ -81,7 +82,7 @@ static av_cold void x8_vlc_init(void){
 #undef init_ac_vlc
 
 //set dc tables
-#define init_dc_vlc(dst,src) \
+#define init_dc_vlc(dst,src) do { \
 dst.table = [offset]; \
 dst.table_allocated = sizes[sizeidx]; \
 offset += sizes[sizeidx++]; \
@@ -89,7 +90,8 @@ static av_cold void x8_vlc_init(void){
 DC_VLC_BITS,34, \
 [1],4,2, \
 [0],4,2, \
-INIT_VLC_USE_NEW_STATIC);
+INIT_VLC_USE_NEW_STATIC); \
+} while(0)
 for(i=0;i<8;i++){
 init_dc_vlc( j_dc_vlc[0][i], x8_dc_highquant_table[i][0]);
 init_dc_vlc( j_dc_vlc[1][i], x8_dc_lowquant_table [i][0]);
@@ -97,7 +99,7 @@ static av_cold void x8_vlc_init(void){
 #undef init_dc_vlc
 
 //set orient tables
-#define init_or_vlc(dst,src) \
+#define init_or_vlc(dst,src) do { \
 dst.table = [offset]; \
 dst.table_allocated = sizes[sizeidx]; \
 offset += sizes[sizeidx++]; \
@@ -105,12 +107,13 @@ static av_cold void x8_vlc_init(void){
 OR_VLC_BITS,12, \
 [1],4,2, \
 [0],4,2, \
-INIT_VLC_USE_NEW_STATIC);
+INIT_VLC_USE_NEW_STATIC); \
+} while(0)
 for(i=0;i<2;i++){
 init_or_vlc( j_orient_vlc[0][i], x8_orient_highquant_table[i][0]);
 }
 for(i=0;i<4;i++){
-init_or_vlc( j_orient_vlc[1][i], x8_orient_lowquant_table [i][0])
+init_or_vlc( j_orient_vlc[1][i], x8_orient_lowquant_table [i][0]);
 }
 if (offset != sizeof(table)/sizeof(VLC_TYPE)/2)
 av_log(NULL, AV_LOG_ERROR, "table size %i does not match needed %i\n", 
(int)(sizeof(table)/sizeof(VLC_TYPE)/2), offset);
-- 
2.7.0

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


[libav-devel] [PATCH 04/25] intrax8: Move documentation from implementation to header files

2016-02-22 Thread Vittorio Giovara
---
 libavcodec/intrax8.c | 20 
 libavcodec/intrax8.h | 24 
 2 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 8b6de0d..9e9479b 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -732,12 +732,6 @@ static void x8_init_block_index(MpegEncContext *s)
 s->dest[2] += (s->mb_y & (~1)) * uvlinesize << 2;
 }
 
-/**
- * Initialize IntraX8 frame decoder.
- * Requires valid MpegEncContext with valid s->mb_width before calling.
- * @param w pointer to IntraX8Context
- * @param s pointer to MpegEncContext of the parent codec
- */
 av_cold void ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s)
 {
 w->s = s;
@@ -757,25 +751,11 @@ av_cold void ff_intrax8_common_init(IntraX8Context *w, 
MpegEncContext *const s)
 ff_intrax8dsp_init(>dsp);
 }
 
-/**
- * Destroy IntraX8 frame structure.
- * @param w pointer to IntraX8Context
- */
 av_cold void ff_intrax8_common_end(IntraX8Context *w)
 {
 av_freep(>prediction_table);
 }
 
-/**
- * Decode single IntraX8 frame.
- * The parent codec must fill s->loopfilter and s->gb (bitstream).
- * The parent codec must call ff_mpv_frame_start(), ff_er_frame_start() before 
calling this function.
- * The parent codec must call ff_er_frame_end(), ff_mpv_frame_end() after 
calling this function.
- * This function does not use ff_mpv_decode_mb().
- * @param w pointer to IntraX8Context
- * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
- * @param quant_offset offset away from zero
- */
 int ff_intrax8_decode_picture(IntraX8Context *const w, int dquant,
   int quant_offset)
 {
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
index 83e984b..ebff2f3 100644
--- a/libavcodec/intrax8.h
+++ b/libavcodec/intrax8.h
@@ -56,8 +56,32 @@ typedef struct IntraX8Context {
 int est_run;
 } IntraX8Context;
 
+/**
+ * Initialize IntraX8 frame decoder.
+ * Requires valid MpegEncContext with valid s->mb_width before calling.
+ * @param w pointer to IntraX8Context
+ * @param s pointer to MpegEncContext of the parent codec
+ */
 void ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s);
+
+/**
+ * Destroy IntraX8 frame structure.
+ * @param w pointer to IntraX8Context
+ */
 void ff_intrax8_common_end(IntraX8Context *w);
+
+/**
+ * Decode single IntraX8 frame.
+ * The parent codec must fill s->loopfilter and s->gb (bitstream).
+ * The parent codec must call ff_mpv_frame_start(), ff_er_frame_start()
+ * before calling this function.
+ * The parent codec must call ff_er_frame_end(), ff_mpv_frame_end() after
+ * calling this function.
+ * This function does not use ff_mpv_decode_mb().
+ * @param w pointer to IntraX8Context
+ * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
+ * @param quant_offset offset away from zero
+ */
 int ff_intrax8_decode_picture(IntraX8Context *w, int quant, int halfpq);
 
 #endif /* AVCODEC_INTRAX8_H */
-- 
2.7.0

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


[libav-devel] [PATCH 24/25] intrax8: Remove mpegvideo dependency

2016-02-22 Thread Vittorio Giovara
---
 libavcodec/intrax8.c |  7 +--
 libavcodec/intrax8.h | 10 +-
 libavcodec/vc1dec.c  |  3 +--
 libavcodec/wmv2dec.c |  2 +-
 4 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 9c82ef9..c289dd4 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -25,7 +25,6 @@
 #include "error_resilience.h"
 #include "get_bits.h"
 #include "idctdsp.h"
-#include "mpegvideo.h"
 #include "msmpeg4data.h"
 #include "intrax8huf.h"
 #include "intrax8.h"
@@ -727,8 +726,7 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
IntraX8Context *w, IDCTDSPContext *idsp,
ERContext *er, int16_t (*block)[64],
int block_last_index[12],
-   int mb_width, int mb_height,
-   MpegEncContext *const s)
+   int mb_width, int mb_height)
 {
 int ret = x8_vlc_init();
 if (ret < 0)
@@ -743,7 +741,6 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
 w->mb_height = mb_height;
 w->block = block;
 w->block_last_index = block_last_index;
-w->s = s;
 
 // two rows, 2 blocks per cannon mb
 w->prediction_table = av_mallocz(w->mb_width * 2 * 2);
@@ -774,10 +771,8 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, 
Picture *pict,
   int dquant, int quant_offset,
   int loopfilter, int lowdelay)
 {
-MpegEncContext *const s = w->s;
 int mb_xy;
 int alloc_size = FFALIGN(FFABS(pict->f->linesize[0]) + 32, 32) * 2 * 24;
-assert(s);
 
 w->gb = gb;
 w->dquant = dquant;
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
index d4d9c71..bb8e97d 100644
--- a/libavcodec/intrax8.h
+++ b/libavcodec/intrax8.h
@@ -22,7 +22,6 @@
 #include "blockdsp.h"
 #include "get_bits.h"
 #include "error_resilience.h"
-#include "mpegvideo.h"
 #include "idctdsp.h"
 #include "intrax8dsp.h"
 #include "mpegpicture.h"
@@ -42,7 +41,6 @@ typedef struct IntraX8Context {
 int16_t (*block)[64];
 
 // set by the caller codec
-MpegEncContext *s;
 IntraX8DSPContext dsp;
 IDCTDSPContext idsp;
 BlockDSPContext bdsp;
@@ -78,7 +76,6 @@ typedef struct IntraX8Context {
 
 /**
  * Initialize IntraX8 frame decoder.
- * Requires valid MpegEncContext with valid s->mb_width before calling.
  * @param avctx pointer to AVCodecContext
  * @param w pointer to IntraX8Context
  * @param idsp pointer to IDCTDSPContext
@@ -87,15 +84,13 @@ typedef struct IntraX8Context {
  * @param block_last_index pointer to the array of indexes
  * @param mb_width macroblock width
  * @param mb_height macroblock height
- * @param s pointer to MpegEncContext of the parent codec
  * @return 0 on success, < 0 on error
  */
 int ff_intrax8_common_init(AVCodecContext *avctx,
IntraX8Context *w, IDCTDSPContext *idsp,
ERContext *er, int16_t (*block)[64],
int block_last_index[12],
-   int mb_width, int mb_height,
-   MpegEncContext *const s);
+   int mb_width, int mb_height);
 
 /**
  * Destroy IntraX8 frame structure.
@@ -105,9 +100,6 @@ void ff_intrax8_common_end(IntraX8Context *w);
 
 /**
  * Decode single IntraX8 frame.
- * The parent codec must call ff_mpv_frame_start() before calling this 
function.
- * The parent codec must call ff_mpv_frame_end() after calling this function.
- * This function does not use ff_mpv_decode_mb().
  * @param w pointer to IntraX8Context
  * @param pict the output Picture containing an AVFrame
  * @param gb open bitstream reader
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index ec65d58..c938b60 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -362,8 +362,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 
 ret = ff_intrax8_common_init(s->avctx, >x8, >idsp, >er,
  s->block, s->block_last_index,
- s->mb_width, s->mb_height,
- s);
+ s->mb_width, s->mb_height);
 
 if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == 
AV_CODEC_ID_VC1IMAGE) {
 for (i = 0; i < 4; i++)
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 0a04b04..bcefa8c 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -471,7 +471,7 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
 
 return ff_intrax8_common_init(avctx, >x8, >s.idsp, >s.er,
   w->s.block, w->s.block_last_index,
-  w->s.mb_width, w->s.mb_height, >s);
+  w->s.mb_width, w->s.mb_height);
 }
 
 static av_cold int wmv2_decode_end(AVCodecContext *avctx)

[libav-devel] [PATCH 25/25] build: Add a formal dependency to intrax8

2016-02-22 Thread Vittorio Giovara
intrax8 needs tables from msmpeg4, which are normally supplied by either
VC1 or WMV2.
---
 libavcodec/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 256dee3..ea47273 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -66,7 +66,7 @@ OBJS-$(CONFIG_HUFFYUVENCDSP)   += huffyuvencdsp.o
 OBJS-$(CONFIG_IDCTDSP) += idctdsp.o simple_idct.o jrevdct.o
 OBJS-$(CONFIG_IIRFILTER)   += iirfilter.o
 OBJS-$(CONFIG_IMDCT15) += imdct15.o
-OBJS-$(CONFIG_INTRAX8) += intrax8.o intrax8dsp.o
+OBJS-$(CONFIG_INTRAX8) += intrax8.o intrax8dsp.o msmpeg4data.o
 OBJS-$(CONFIG_IVIDSP)  += ivi_dsp.o
 OBJS-$(CONFIG_JPEGTABLES)  += jpegtables.o
 OBJS-$(CONFIG_LIBXVID) += libxvid_rc.o
-- 
2.7.0

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


[libav-devel] [PATCH 19/25] intrax8: Use the generic horizband function

2016-02-22 Thread Vittorio Giovara
This is assuming that intrax8 has no support for interlacing
(hence PICT_FRAME is set and last_frame is NULL).
---
 libavcodec/intrax8.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index b3b1331..44cf141 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -30,6 +30,7 @@
 #include "intrax8huf.h"
 #include "intrax8.h"
 #include "intrax8dsp.h"
+#include "mpegutils.h"
 
 #define MAX_TABLE_DEPTH(table_bits, max_bits) \
 ((max_bits + table_bits - 1) / table_bits)
@@ -836,7 +837,9 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, 
Picture *pict,
 w->dest[0] += 8;
 }
 if (w->mb_y & 1)
-ff_mpeg_draw_horiz_band(s, (w->mb_y - 1) * 8, 16);
+ff_draw_horiz_band(w->avctx, w->frame, NULL,
+   (w->mb_y - 1) * 8, 16,
+   PICT_FRAME, 0, lowdelay);
 }
 
 error:
-- 
2.7.0

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


[libav-devel] [PATCH 15/25] intrax8: Reference the currect AVCodecContext decoder

2016-02-22 Thread Vittorio Giovara
It will be needed in later commits.
---
 libavcodec/intrax8.c | 4 +++-
 libavcodec/intrax8.h | 5 -
 libavcodec/vc1dec.c  | 2 +-
 libavcodec/wmv2dec.c | 2 +-
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 7675d06..b03da68 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -730,13 +730,15 @@ static void x8_init_block_index(IntraX8Context *w, 
AVFrame *frame, int mb_y)
 w->dest[2] += (mb_y & (~1)) * uvlinesize << 2;
 }
 
-av_cold int ff_intrax8_common_init(IntraX8Context *w, IDCTDSPContext *idsp,
+av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
+   IntraX8Context *w, IDCTDSPContext *idsp,
MpegEncContext *const s)
 {
 int ret = x8_vlc_init();
 if (ret < 0)
 return ret;
 
+w->avctx = avctx;
 w->idsp = *idsp;
 w->s = s;
 
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
index 1ab686d..5d73d79 100644
--- a/libavcodec/intrax8.h
+++ b/libavcodec/intrax8.h
@@ -35,6 +35,7 @@ typedef struct IntraX8Context {
 // set by ff_intrax8_common_init
 uint8_t *prediction_table; // 2 * (mb_w * 2)
 ScanTable scantable[3];
+AVCodecContext *avctx;
 
 // set by the caller codec
 MpegEncContext *s;
@@ -68,12 +69,14 @@ typedef struct IntraX8Context {
 /**
  * Initialize IntraX8 frame decoder.
  * Requires valid MpegEncContext with valid s->mb_width before calling.
+ * @param avctx pointer to AVCodecContext
  * @param w pointer to IntraX8Context
  * @param idsp pointer to IDCTDSPContext
  * @param s pointer to MpegEncContext of the parent codec
  * @return 0 on success, < 0 on error
  */
-int ff_intrax8_common_init(IntraX8Context *w, IDCTDSPContext *idsp,
+int ff_intrax8_common_init(AVCodecContext *avctx,
+   IntraX8Context *w, IDCTDSPContext *idsp,
MpegEncContext *const s);
 
 /**
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index ffd9f96..b929401 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -360,7 +360,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 //return -1;
 }
 
-ret = ff_intrax8_common_init(>x8, >idsp, s);
+ret = ff_intrax8_common_init(s->avctx, >x8, >idsp, s);
 
 if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == 
AV_CODEC_ID_VC1IMAGE) {
 for (i = 0; i < 4; i++)
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 3089c9f..381a3da 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -469,7 +469,7 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
 
 ff_wmv2_common_init(w);
 
-return ff_intrax8_common_init(>x8, >s.idsp, >s);
+return ff_intrax8_common_init(avctx, >x8, >s.idsp, >s);
 }
 
 static av_cold int wmv2_decode_end(AVCodecContext *avctx)
-- 
2.7.0

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


[libav-devel] [PATCH 18/25] intrax8: Carry over lowdelay value in ff_intrax8_decode_picture

2016-02-22 Thread Vittorio Giovara
---
 libavcodec/intrax8.c   | 3 ++-
 libavcodec/intrax8.h   | 3 ++-
 libavcodec/vc1_block.c | 2 +-
 libavcodec/wmv2dec.c   | 2 +-
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 8ac3417..b3b1331 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -768,7 +768,8 @@ av_cold void ff_intrax8_common_end(IntraX8Context *w)
 
 int ff_intrax8_decode_picture(IntraX8Context *const w, Picture *pict,
   GetBitContext *gb,
-  int dquant, int quant_offset, int loopfilter)
+  int dquant, int quant_offset,
+  int loopfilter, int lowdelay)
 {
 MpegEncContext *const s = w->s;
 int mb_xy;
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
index 29fac89..39597cd 100644
--- a/libavcodec/intrax8.h
+++ b/libavcodec/intrax8.h
@@ -110,6 +110,7 @@ void ff_intrax8_common_end(IntraX8Context *w);
  */
 int ff_intrax8_decode_picture(IntraX8Context *w, Picture *pict,
   GetBitContext *gb,
-  int quant, int halfpq, int loopfilter);
+  int quant, int halfpq,
+  int loopfilter, int lowdelay);
 
 #endif /* AVCODEC_INTRAX8_H */
diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c
index fbc054f..fb649ad 100644
--- a/libavcodec/vc1_block.c
+++ b/libavcodec/vc1_block.c
@@ -3024,7 +3024,7 @@ void ff_vc1_decode_blocks(VC1Context *v)
 if (v->x8_type) {
 ff_intrax8_decode_picture(>x8, >s.current_picture, >s.gb,
   2 * v->pq + v->halfpq, v->pq * 
!v->pquantizer,
-  v->s.loop_filter);
+  v->s.loop_filter, v->s.low_delay);
 } else {
 v->cur_blk_idx =  0;
 v->left_blk_idx= -1;
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index 1eccc1f..a1620b0 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -230,7 +230,7 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext 
*s)
 if (w->j_type) {
 ff_intrax8_decode_picture(>x8, >current_picture, >gb,
   2 * s->qscale, (s->qscale - 1) | 1,
-  s->loop_filter);
+  s->loop_filter, s->low_delay);
 return 1;
 }
 
-- 
2.7.0

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


[libav-devel] [PATCH 17/25] intrax8: Pass macroblock size to ff_intrax8_common_init

2016-02-22 Thread Vittorio Giovara
---
 libavcodec/intrax8.c | 65 ++--
 libavcodec/intrax8.h |  7 ++
 libavcodec/vc1dec.c  |  4 +++-
 libavcodec/wmv2dec.c |  3 ++-
 4 files changed, 44 insertions(+), 35 deletions(-)

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 18803b4..8ac3417 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -381,9 +381,7 @@ static int x8_setup_spatial_predictor(IntraX8Context *const 
w, const int chroma)
 static void x8_update_predictions(IntraX8Context *const w, const int orient,
   const int est_run)
 {
-MpegEncContext *const s = w->s;
-
-w->prediction_table[s->mb_x * 2 + (s->mb_y & 1)] = (est_run << 2) + 1 * 
(orient == 4) + 2 * (orient == 8);
+w->prediction_table[w->mb_x * 2 + (w->mb_y & 1)] = (est_run << 2) + 1 * 
(orient == 4) + 2 * (orient == 8);
 /*
  * y = 2n + 0 -> // 0 2 4
  * y = 2n + 1 -> // 1 3 5
@@ -392,11 +390,9 @@ static void x8_update_predictions(IntraX8Context *const w, 
const int orient,
 
 static void x8_get_prediction_chroma(IntraX8Context *const w)
 {
-MpegEncContext *const s = w->s;
-
-w->edges  = 1 * (!(s->mb_x >> 1));
-w->edges |= 2 * (!(s->mb_y >> 1));
-w->edges |= 4 * (s->mb_x >= (2 * s->mb_width - 1)); // mb_x for chroma 
would always be odd
+w->edges  = 1 * (!(w->mb_x >> 1));
+w->edges |= 2 * (!(w->mb_y >> 1));
+w->edges |= 4 * (w->mb_x >= (2 * w->mb_width - 1)); // mb_x for chroma 
would always be odd
 
 w->raw_orient = 0;
 if (w->edges & 3) {
@@ -405,29 +401,28 @@ static void x8_get_prediction_chroma(IntraX8Context 
*const w)
 return;
 }
 // block[x - 1][y | 1 - 1)]
-w->chroma_orient = (w->prediction_table[2 * s->mb_x - 2] & 0x03) << 2;
+w->chroma_orient = (w->prediction_table[2 * w->mb_x - 2] & 0x03) << 2;
 }
 
 static void x8_get_prediction(IntraX8Context *const w)
 {
-MpegEncContext *const s = w->s;
 int a, b, c, i;
 
-w->edges  = 1 * (!s->mb_x);
-w->edges |= 2 * (!s->mb_y);
-w->edges |= 4 * (s->mb_x >= (2 * s->mb_width - 1));
+w->edges  = 1 * (!w->mb_x);
+w->edges |= 2 * (!w->mb_y);
+w->edges |= 4 * (w->mb_x >= (2 * w->mb_width - 1));
 
 switch (w->edges & 3) {
 case 0:
 break;
 case 1:
 // take the one from the above block[0][y - 1]
-w->est_run = w->prediction_table[!(s->mb_y & 1)] >> 2;
+w->est_run = w->prediction_table[!(w->mb_y & 1)] >> 2;
 w->orient  = 1;
 return;
 case 2:
 // take the one from the previous block[x - 1][0]
-w->est_run = w->prediction_table[2 * s->mb_x - 2] >> 2;
+w->est_run = w->prediction_table[2 * w->mb_x - 2] >> 2;
 w->orient  = 2;
 return;
 case 3:
@@ -436,15 +431,15 @@ static void x8_get_prediction(IntraX8Context *const w)
 return;
 }
 // no edge cases
-b = w->prediction_table[2 * s->mb_x + !(s->mb_y & 1)]; // block[x
][y- 1]
-a = w->prediction_table[2 * s->mb_x - 2 + (s->mb_y & 1)];  // block[x - 
1][y   ]
-c = w->prediction_table[2 * s->mb_x - 2 + !(s->mb_y & 1)]; // block[x - 
1][y -1]
+b = w->prediction_table[2 * w->mb_x + !(w->mb_y & 1)]; // block[x
][y- 1]
+a = w->prediction_table[2 * w->mb_x - 2 + (w->mb_y & 1)];  // block[x - 
1][y   ]
+c = w->prediction_table[2 * w->mb_x - 2 + !(w->mb_y & 1)]; // block[x - 
1][y -1]
 
 w->est_run = FFMIN(b, a);
 /* This condition has nothing to do with w->edges, even if it looks
  * similar it would trigger if e.g. x = 3; y = 2;
  * I guess somebody wrote something wrong and it became standard. */
-if ((s->mb_x & s->mb_y) != 0)
+if ((w->mb_x & w->mb_y) != 0)
 w->est_run = FFMIN(c, w->est_run);
 w->est_run >>= 2;
 
@@ -713,7 +708,7 @@ block_placed:
 }
 
 // FIXME maybe merge with ff_*
-static void x8_init_block_index(IntraX8Context *w, AVFrame *frame, int mb_y)
+static void x8_init_block_index(IntraX8Context *w, AVFrame *frame)
 {
 // not parent codec linesize as this would be wrong for field pics
 // not that IntraX8 has interlacing support ;)
@@ -724,14 +719,15 @@ static void x8_init_block_index(IntraX8Context *w, 
AVFrame *frame, int mb_y)
 w->dest[1] = frame->data[1];
 w->dest[2] = frame->data[2];
 
-w->dest[0] += mb_y * linesize << 3;
+w->dest[0] += w->mb_y * linesize << 3;
 // chroma blocks are on add rows
-w->dest[1] += (mb_y & (~1)) * uvlinesize << 2;
-w->dest[2] += (mb_y & (~1)) * uvlinesize << 2;
+w->dest[1] += (w->mb_y & (~1)) * uvlinesize << 2;
+w->dest[2] += (w->mb_y & (~1)) * uvlinesize << 2;
 }
 
 av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
IntraX8Context *w, IDCTDSPContext *idsp,
+   int mb_width, int mb_height,
MpegEncContext *const s)
 {
 int ret = x8_vlc_init();
@@ -740,10 +736,14 @@ av_cold int 

[libav-devel] [PATCH 07/25] vc1dec: wmv2dec: Validate ff_intrax8_common_init return value

2016-02-22 Thread Vittorio Giovara
---
 libavcodec/vc1dec.c  | 6 +++---
 libavcodec/wmv2dec.c | 4 +---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index d65c68a..e60a084 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -314,7 +314,7 @@ static void vc1_sprite_flush(AVCodecContext *avctx)
 av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 {
 MpegEncContext *s = >s;
-int i;
+int i, ret;
 int mb_height = FFALIGN(s->mb_height, 2);
 
 /* Allocate mb bitplanes */
@@ -360,7 +360,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 //return -1;
 }
 
-ff_intrax8_common_init(>x8,s);
+ret = ff_intrax8_common_init(>x8, s);
 
 if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == 
AV_CODEC_ID_VC1IMAGE) {
 for (i = 0; i < 4; i++)
@@ -369,7 +369,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
 
 if (!v->mv_type_mb_plane || !v->direct_mb_plane || !v->acpred_plane || 
!v->over_flags_plane ||
 !v->block || !v->cbp_base || !v->ttblk_base || !v->is_intra_base || 
!v->luma_mv_base ||
-!v->mb_type_base) {
+!v->mb_type_base || ret < 0) {
 av_freep(>mv_type_mb_plane);
 av_freep(>direct_mb_plane);
 av_freep(>acpred_plane);
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index c71fd3d..9418086 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -467,9 +467,7 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
 
 ff_wmv2_common_init(w);
 
-ff_intrax8_common_init(>x8, >s);
-
-return 0;
+return ff_intrax8_common_init(>x8, >s);
 }
 
 static av_cold int wmv2_decode_end(AVCodecContext *avctx)
-- 
2.7.0

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


[libav-devel] [PATCH 21/25] intrax8: Drop two unused variables

2016-02-22 Thread Vittorio Giovara
These are not changed in the function, nor in the dependent decoders.
---
 libavcodec/intrax8.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index ffb40b6..2613bf7 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -800,9 +800,6 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, 
Picture *pict,
 }
 x8_reset_vlc_tables(w);
 
-s->resync_mb_x = 0;
-s->resync_mb_y = 0;
-
 for (w->mb_y = 0; w->mb_y < w->mb_height * 2; w->mb_y++) {
 x8_init_block_index(w, w->frame);
 mb_xy = (w->mb_y >> 1) * (w->mb_width + 1);
@@ -844,7 +841,7 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, 
Picture *pict,
 }
 
 error:
-ff_er_add_slice(>er, s->resync_mb_x, s->resync_mb_y,
+ff_er_add_slice(>er, 0, 0,
 (w->mb_x >> 1) - 1, (w->mb_y >> 1) - 1,
 ER_MB_END);
 return 0;
-- 
2.7.0

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


<    7   8   9   10   11   12   13   14   15   16   >