[libav-devel] [PATCH] Makefile: fix checking whether reconfiguring is required

2016-10-18 Thread Anton Khirnov
It didn't take into account the new pattern used for bitstream filters
and protocols.
---
 Makefile | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 34f0c9c..d76173c 100644
--- a/Makefile
+++ b/Makefile
@@ -121,8 +121,14 @@ $(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
 
 tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
 
+CONFIGURABLE_COMPONENTS =   \
+$(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \
+$(SRC_PATH)/libavformat/protocols.c \
+$(SRC_PATH)/libavcodec/bitstream_filters.c  \
+
+
 config.h: .config
-.config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
+.config: $(CONFIGURABLE_COMPONENTS)
@-tput bold 2>/dev/null
@-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
@-tput sgr0 2>/dev/null
-- 
2.0.0

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


[libav-devel] [PATCH 2/2] mov: Update colr values

2016-10-18 Thread Vittorio Giovara
For 'nclx', the latest edition of the standard switched from JPEG XR
to 23001-8, which matches the current order of our entries.
For 'nclc', qtff edition 2016-09-13 introduced a few new entries.

Signed-off-by: Vittorio Giovara 
---
 libavformat/mov.c | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 36e75d5..e1d87cd 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1083,16 +1083,7 @@ static int mov_read_colr(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 st->codecpar->color_range = AVCOL_RANGE_JPEG;
 else
 st->codecpar->color_range = AVCOL_RANGE_MPEG;
-/* 14496-12 references JPEG XR specs (rather than the more complete
- * 23001-8) so some adjusting is required */
-if (color_primaries >= AVCOL_PRI_FILM)
-color_primaries = AVCOL_PRI_UNSPECIFIED;
-if ((color_trc >= AVCOL_TRC_LINEAR &&
- color_trc <= AVCOL_TRC_LOG_SQRT) ||
-color_trc >= AVCOL_TRC_BT2020_10)
-color_trc = AVCOL_TRC_UNSPECIFIED;
-if (color_matrix >= AVCOL_SPC_BT2020_NCL)
-color_matrix = AVCOL_SPC_UNSPECIFIED;
+
 st->codecpar->color_primaries = color_primaries;
 st->codecpar->color_trc   = color_trc;
 st->codecpar->color_space = color_matrix;
@@ -1102,17 +1093,22 @@ static int mov_read_colr(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 case 1: st->codecpar->color_primaries = AVCOL_PRI_BT709; break;
 case 5: st->codecpar->color_primaries = AVCOL_PRI_SMPTE170M; break;
 case 6: st->codecpar->color_primaries = AVCOL_PRI_SMPTE240M; break;
+case 9: st->codecpar->color_primaries = AVCOL_PRI_BT2020; break;
+case 10: st->codecpar->color_primaries = AVCOL_PRI_SMPTE431; break;
+case 11: st->codecpar->color_primaries = AVCOL_PRI_SMPTE432; break;
 }
 /* color transfer, Table 4-5 */
 switch (color_trc) {
 case 1: st->codecpar->color_trc = AVCOL_TRC_BT709; break;
 case 7: st->codecpar->color_trc = AVCOL_TRC_SMPTE240M; break;
+case 17: st->codecpar->color_trc = AVCOL_TRC_SMPTE428; break;
 }
 /* color matrix, Table 4-6 */
 switch (color_matrix) {
 case 1: st->codecpar->color_space = AVCOL_SPC_BT709; break;
 case 6: st->codecpar->color_space = AVCOL_SPC_BT470BG; break;
 case 7: st->codecpar->color_space = AVCOL_SPC_SMPTE240M; break;
+case 9: st->codecpar->color_space = AVCOL_SPC_BT2020_NCL; break;
 }
 }
 av_log(c->fc, AV_LOG_TRACE, "\n");
-- 
2.10.0

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


[libav-devel] [PATCH 1/2] lavu: Add JEDEC P22 color primaries

2016-10-18 Thread Vittorio Giovara
---
 libavcodec/options_table.h | 1 +
 libavutil/pixdesc.c| 1 +
 libavutil/pixfmt.h | 1 +
 3 files changed, 3 insertions(+)

diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 5090806..04cb20d 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -438,6 +438,7 @@ static const AVOption avcodec_options[] = {
 {"smpte428","SMPTE 428-1", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVCOL_PRI_SMPTE428 },   INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
 {"smpte431","SMPTE 431-2", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVCOL_PRI_SMPTE431 },INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
 {"smpte432","SMPTE 422-1", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVCOL_PRI_SMPTE432 },INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
+{"jedec-p22","JEDEC P22",  0, AV_OPT_TYPE_CONST, {.i64 = 
AVCOL_PRI_JEDEC_P22 },   INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
 {"unspecified", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVCOL_PRI_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
 {"smptest428_1", "SMPTE 428-1", 0, AV_OPT_TYPE_CONST, {.i64 = 
AVCOL_PRI_SMPTE428 },   INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
 {"color_trc", "color transfer characteristics", OFFSET(color_trc), 
AV_OPT_TYPE_INT, {.i64 = AVCOL_TRC_UNSPECIFIED }, 1, AVCOL_TRC_NB-1, V|E|D, 
"color_trc_type"},
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 80bdee7..7987f29 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -1763,6 +1763,7 @@ static const char *color_primaries_names[] = {
 [AVCOL_PRI_SMPTE428] = "smpte428",
 [AVCOL_PRI_SMPTE431] = "smpte431",
 [AVCOL_PRI_SMPTE432] = "smpte432",
+[AVCOL_PRI_JEDEC_P22] = "jedec-p22",
 };
 
 static const char *color_transfer_names[] = {
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 917fa57..0bee724 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -326,6 +326,7 @@ enum AVColorPrimaries {
 AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428,
 AVCOL_PRI_SMPTE431= 11, ///< SMPTE ST 431-2 (2011) / DCI P3
 AVCOL_PRI_SMPTE432= 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display 
P3
+AVCOL_PRI_JEDEC_P22   = 22, ///< JEDEC P22 phosphors
 AVCOL_PRI_NB,  ///< Not part of ABI
 };
 
-- 
2.10.0

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


Re: [libav-devel] [PATCH 1/3] avprobe: Add -show_stream_entry to get a single stream property

2016-10-18 Thread Vittorio Giovara
On Tue, Oct 18, 2016 at 3:38 PM, Anton Khirnov  wrote:
> Quoting Vittorio Giovara (2016-10-14 00:23:08)
>> This is needed for improved fate testing and it is modeled after
>> -show_format_entry. The main behavioral difference is that when a print
>> function is called with an empty key, rather than discarding it, the
>> closes key in the hierarchy is used instead.
>
> And why the difference?

because the display matrix is printed as an array, so it uses
probe_int(NULL, ...) within a "matrix" block

without this change `-show_stream_entry matrix` would not report
anything, since the key used in the dictionary was NULL
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/2] hevc: factor out a repeated condition

2016-10-18 Thread Vittorio Giovara
On Tue, Oct 18, 2016 at 3:24 PM, Anton Khirnov  wrote:
> ---
>  libavcodec/hevcdec.c | 20 
>  1 file changed, 8 insertions(+), 12 deletions(-)

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


Re: [libav-devel] [PATCH 1/2] hevc: move the SliceType enum to hevc.h

2016-10-18 Thread Vittorio Giovara
On Tue, Oct 18, 2016 at 3:24 PM, Anton Khirnov  wrote:
> Those values are decoder-independent and are also use by the VA-API
> encoder.
> ---

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


Re: [libav-devel] [PATCH 3/3] mov: Evaluate the movie display matrix

2016-10-18 Thread Anton Khirnov
Quoting Vittorio Giovara (2016-10-14 00:23:10)
> This matrix needs to be applied after all others have (currently only
> display matrix from trak), but cannot be handled in movie box, since
> streams are not allocated yet.
> 
> So store it in main context and if not identity, apply it when appropriate,
> handling the case when trak display matrix is identity and when it is not.
> 
> Fate tests are updated accordingly.
> 
> Signed-off-by: Vittorio Giovara 
> ---
>  libavformat/isom.h|  2 ++
>  libavformat/mov.c | 57 
> +--
>  tests/ref/fate/mov-ar |  4 +--
>  tests/ref/fate/mov-display-matrix |  2 +-
>  4 files changed, 48 insertions(+), 17 deletions(-)
> 
> diff --git a/libavformat/isom.h b/libavformat/isom.h
> index 58f0a20..1aa2091 100644
> --- a/libavformat/isom.h
> +++ b/libavformat/isom.h
> @@ -167,6 +167,8 @@ typedef struct MOVContext {
>  int export_all;
>  int export_xmp;
>  int enable_drefs;
> +
> +int32_t movie_display_matrix[3][3]; ///< display matrix from mvhd
>  } MOVContext;
>  
>  int ff_mp4_read_descr_len(AVIOContext *pb);
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 36e75d5..c082ee4 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -950,6 +950,7 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, 
> MOVAtom atom)
>  
>  static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>  {
> +int i;
>  time_t creation_time;
>  int version = avio_r8(pb); /* version */
>  avio_rb24(pb); /* flags */
> @@ -973,7 +974,12 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, 
> MOVAtom atom)
>  
>  avio_skip(pb, 10); /* reserved */
>  
> -avio_skip(pb, 36); /* display matrix */
> +/* movie display matrix, store it in main context and use it later on */
> +for (i = 0; i < 3; i++) {
> +c->movie_display_matrix[i][0] = avio_rb32(pb); // 16.16 fixed point
> +c->movie_display_matrix[i][1] = avio_rb32(pb); // 16.16 fixed point
> +c->movie_display_matrix[i][2] = avio_rb32(pb); //  2.30 fixed point
> +}
>  
>  avio_rb32(pb); /* preview time */
>  avio_rb32(pb); /* preview duration */
> @@ -2747,17 +2753,34 @@ static int mov_read_meta(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  return 0;
>  }
>  
> +// return 0 when matrix is identity, 1 otherwise
> +#define IS_MATRIX_FULL(matrix)   \

nit: I'd flip the meaning and make it IS_MATRIX_ID(ENTITY), since "full"
is confusing in this context.

> +(matrix[0][0] != (1 << 16) ||\
> + matrix[1][1] != (1 << 16) ||\
> + matrix[2][2] != (1 << 30) ||\
> + matrix[0][1] || matrix[0][2] || \
> + matrix[1][0] || matrix[1][2] || \
> + matrix[2][0] || matrix[2][1])
> +
> +// fixed point to double
> +#define CONV_FP(x, sh) ((double) (x)) / (1 << (sh))
> +
> +// double to fixed point
> +#define CONV_DB(x, sh) ((int32_t) ((x) * (1 << (sh
> +
>  static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>  {
> -int i;
> +int i, j, e;
>  int width;
>  int height;
>  int64_t disp_transform[2];
>  int display_matrix[3][3];
> +int res_display_matrix[3][3];
>  AVStream *st;
>  MOVStreamContext *sc;
>  int version;
>  int flags;
> +double val = 0;
>  
>  if (c->fc->nb_streams < 1)
>  return 0;
> @@ -2803,15 +2826,21 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  sc->width = width >> 16;
>  sc->height = height >> 16;
>  
> -// save the matrix when it is not the default identity
> -if (display_matrix[0][0] != (1 << 16) ||
> -display_matrix[1][1] != (1 << 16) ||
> -display_matrix[2][2] != (1 << 30) ||
> -display_matrix[0][1] || display_matrix[0][2] ||
> -display_matrix[1][0] || display_matrix[1][2] ||
> -display_matrix[2][0] || display_matrix[2][1]) {
> -int i, j;
> +// apply the moov display matrix
> +for (i = 0; i < 3; i++) {
> +for (j = 0; j < 3; j++) {
> +int sh = j == 2 ? 30 : 16;
> +for (e = 0; e < 3; e++) {
> +val += CONV_FP(display_matrix[i][e], sh) *
> +   CONV_FP(c->movie_display_matrix[e][j], sh);
> +}
> +res_display_matrix[i][j] = CONV_DB(val, sh);
> +val = 0;

This reinitialization is weird, just make val local to this block.

Making the multiplication floating point is unpleasant, but I guess
fixed point is more effort.

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


Re: [libav-devel] [PATCH 1/3] avprobe: Add -show_stream_entry to get a single stream property

2016-10-18 Thread Anton Khirnov
Quoting Vittorio Giovara (2016-10-14 00:23:08)
> This is needed for improved fate testing and it is modeled after
> -show_format_entry. The main behavioral difference is that when a print
> function is called with an empty key, rather than discarding it, the
> closes key in the hierarchy is used instead.

And why the difference?

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


Re: [libav-devel] [PATCH] fate: Add tests for mov display matrix

2016-10-18 Thread Anton Khirnov
Quoting Diego Biurrun (2016-10-14 01:15:32)
> On Fri, Oct 14, 2016 at 01:13:42AM +0200, Diego Biurrun wrote:
> > On Thu, Oct 13, 2016 at 07:03:01PM -0400, Vittorio Giovara wrote:
> > > --- /dev/null
> > > +++ b/tests/fate/mov.mak
> > > @@ -0,0 +1,12 @@
> > > +FATE_MOV += fate-mov-display-matrix
> > > +fate-mov-display-matrix: CMD = run avprobe -v 0 -show_stream_entry 
> > > matrix $(TARGET_SAMPLES)/mov/displaymatrix.mov
> > > +
> > > +FATE_MOV += fate-mov-rotation
> > > +fate-mov-rotation: CMD = run avprobe -v 0 -show_stream_entry rotation 
> > > $(TARGET_SAMPLES)/mov/displaymatrix.mov
> > > +
> > > +FATE_MOV += fate-mov-ar
> > > +fate-mov-ar: CMD = probear $(TARGET_SAMPLES)/mov/displaymatrix.mov
> > > +
> > > +$(FATE_MOV): avprobe$(EXESUF)
> > > +FATE_SAMPLES-$(call ALLYES, AVPROBE, MOV_DEMUXER) += $(FATE_MOV)
> > 
> > ALLYES does not work this way, the second ',' is wrong.
> > 
> > IMO this should go in probe.mak. That would also fix the deps, you are
> > missing at least a dependency on the avprobe program.
> 
> I'm blind today, you have the dependency of course. probe.mak still looks
> like a better place to me.

It really is not. Do not be confused by similar-sounding names,
probe.mak is for testing avformat file type probing. This is for testing
correct decoding of some mov feature, it has nothing to do with file
type probing.

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


[libav-devel] [PATCH 2/2] hevc: factor out a repeated condition

2016-10-18 Thread Anton Khirnov
---
 libavcodec/hevcdec.c | 20 
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index db45608..e58d5f8 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -1684,6 +1684,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, 
int y0,
 struct MvField current_mv = {{{ 0 }}};
 
 int min_pu_width = s->ps.sps->min_pu_width;
+int weighted_pred = (s->sh.slice_type == HEVC_SLICE_P && 
s->ps.pps->weighted_pred_flag) ||
+(s->sh.slice_type == HEVC_SLICE_B && 
s->ps.pps->weighted_bipred_flag);
 
 MvField *tab_mvf = s->ref->tab_mvf;
 RefPicList  *refPicList = s->ref->refPicList;
@@ -1746,8 +1748,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, 
int y0,
 luma_mc(s, tmp, tmpstride, ref0->frame,
 _mv.mv[0], x0, y0, nPbW, nPbH, pred_idx);
 
-if ((s->sh.slice_type == HEVC_SLICE_P && 
s->ps.pps->weighted_pred_flag) ||
-(s->sh.slice_type == HEVC_SLICE_B && 
s->ps.pps->weighted_bipred_flag)) {
+if (weighted_pred) {
 s->hevcdsp.weighted_pred[pred_idx](s->sh.luma_log2_weight_denom,

s->sh.luma_weight_l0[current_mv.ref_idx[0]],

s->sh.luma_offset_l0[current_mv.ref_idx[0]],
@@ -1759,8 +1760,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, 
int y0,
 chroma_mc(s, tmp, tmp2, tmpstride, ref0->frame,
   _mv.mv[0], x0 / 2, y0 / 2, nPbW / 2, nPbH / 2, 
pred_idx);
 
-if ((s->sh.slice_type == HEVC_SLICE_P && 
s->ps.pps->weighted_pred_flag) ||
-(s->sh.slice_type == HEVC_SLICE_B && 
s->ps.pps->weighted_bipred_flag)) {
+if (weighted_pred) {
 
s->hevcdsp.weighted_pred_chroma[pred_idx](s->sh.chroma_log2_weight_denom,
   
s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0],
   
s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0],
@@ -1782,8 +1782,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, 
int y0,
 luma_mc(s, tmp, tmpstride, ref1->frame,
 _mv.mv[1], x0, y0, nPbW, nPbH, pred_idx);
 
-if ((s->sh.slice_type == HEVC_SLICE_P && 
s->ps.pps->weighted_pred_flag) ||
-(s->sh.slice_type == HEVC_SLICE_B && 
s->ps.pps->weighted_bipred_flag)) {
+if (weighted_pred) {
 s->hevcdsp.weighted_pred[pred_idx](s->sh.luma_log2_weight_denom,

s->sh.luma_weight_l1[current_mv.ref_idx[1]],

s->sh.luma_offset_l1[current_mv.ref_idx[1]],
@@ -1796,8 +1795,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, 
int y0,
 chroma_mc(s, tmp, tmp2, tmpstride, ref1->frame,
   _mv.mv[1], x0 / 2, y0 / 2, nPbW / 2, nPbH / 2, 
pred_idx);
 
-if ((s->sh.slice_type == HEVC_SLICE_P && 
s->ps.pps->weighted_pred_flag) ||
-(s->sh.slice_type == HEVC_SLICE_B && 
s->ps.pps->weighted_bipred_flag)) {
+if (weighted_pred) {
 
s->hevcdsp.weighted_pred_chroma[pred_idx](s->sh.chroma_log2_weight_denom,
   
s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0],
   
s->sh.chroma_offset_l1[current_mv.ref_idx[1]][0],
@@ -1821,8 +1819,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, 
int y0,
 luma_mc(s, tmp2, tmpstride, ref1->frame,
 _mv.mv[1], x0, y0, nPbW, nPbH, pred_idx);
 
-if ((s->sh.slice_type == HEVC_SLICE_P && 
s->ps.pps->weighted_pred_flag) ||
-(s->sh.slice_type == HEVC_SLICE_B && 
s->ps.pps->weighted_bipred_flag)) {
+if (weighted_pred) {
 
s->hevcdsp.weighted_pred_avg[pred_idx](s->sh.luma_log2_weight_denom,

s->sh.luma_weight_l0[current_mv.ref_idx[0]],

s->sh.luma_weight_l1[current_mv.ref_idx[1]],
@@ -1840,8 +1837,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, 
int y0,
 chroma_mc(s, tmp3, tmp4, tmpstride, ref1->frame,
   _mv.mv[1], x0 / 2, y0 / 2, nPbW / 2, nPbH / 2, 
pred_idx);
 
-if ((s->sh.slice_type == HEVC_SLICE_P && 
s->ps.pps->weighted_pred_flag) ||
-(s->sh.slice_type == HEVC_SLICE_B && 
s->ps.pps->weighted_bipred_flag)) {
+if (weighted_pred) {
 
s->hevcdsp.weighted_pred_avg_chroma[pred_idx](s->sh.chroma_log2_weight_denom,
   
s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0],
   
s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0],
-- 
2.0.0

___
libav-devel mailing list

[libav-devel] [PATCH 1/2] hevc: move the SliceType enum to hevc.h

2016-10-18 Thread Anton Khirnov
Those values are decoder-independent and are also use by the VA-API
encoder.
---
Sorry for the previous breakage, updated my libva-dev so it shouldn't happen 
again.
I think this is the more proper thing to do, the intent is that hevcdec.h should
only be included by the decoder itself.
---
 libavcodec/hevc.h  |  6 +
 libavcodec/hevc_cabac.c|  3 ++-
 libavcodec/hevc_mvs.c  |  9 ---
 libavcodec/hevc_refs.c |  2 +-
 libavcodec/hevcdec.c   | 58 +-
 libavcodec/hevcdec.h   |  8 +-
 libavcodec/vaapi_encode_h265.c | 20 +++
 7 files changed, 54 insertions(+), 52 deletions(-)

diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h
index 9536608..bb4f660 100644
--- a/libavcodec/hevc.h
+++ b/libavcodec/hevc.h
@@ -52,6 +52,12 @@ enum HEVCNALUnitType {
 HEVC_NAL_SEI_SUFFIX = 40,
 };
 
+enum HEVCSliceType {
+HEVC_SLICE_B = 0,
+HEVC_SLICE_P = 1,
+HEVC_SLICE_I = 2,
+};
+
 /**
  * 7.4.2.1
  */
diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c
index eb16f57..0432330 100644
--- a/libavcodec/hevc_cabac.c
+++ b/libavcodec/hevc_cabac.c
@@ -25,6 +25,7 @@
 #include "libavutil/common.h"
 
 #include "cabac_functions.h"
+#include "hevc.h"
 #include "hevcdec.h"
 
 #define CABAC_MAX_BIN 31
@@ -358,7 +359,7 @@ static void cabac_init_state(HEVCContext *s)
 int init_type = 2 - s->sh.slice_type;
 int i;
 
-if (s->sh.cabac_init_flag && s->sh.slice_type != I_SLICE)
+if (s->sh.cabac_init_flag && s->sh.slice_type != HEVC_SLICE_I)
 init_type ^= 3;
 
 for (i = 0; i < HEVC_CONTEXTS; i++) {
diff --git a/libavcodec/hevc_mvs.c b/libavcodec/hevc_mvs.c
index 90aff97..be32e6c 100644
--- a/libavcodec/hevc_mvs.c
+++ b/libavcodec/hevc_mvs.c
@@ -21,6 +21,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "hevc.h"
 #include "hevcdec.h"
 
 static const uint8_t l0_l1_cand_idx[12][2] = {
@@ -355,7 +356,7 @@ static void derive_spatial_merge_candidates(HEVCContext *s, 
int x0, int y0,
 const int xB2_pu = xB2 >> s->ps.sps->log2_min_pu_size;
 const int yB2_pu = yB2 >> s->ps.sps->log2_min_pu_size;
 
-const int nb_refs = (s->sh.slice_type == P_SLICE) ?
+const int nb_refs = (s->sh.slice_type == HEVC_SLICE_P) ?
 s->sh.nb_refs[0] : FFMIN(s->sh.nb_refs[0], 
s->sh.nb_refs[1]);
 int check_MER   = 1;
 int check_MER_1 = 1;
@@ -473,7 +474,7 @@ static void derive_spatial_merge_candidates(HEVCContext *s, 
int x0, int y0,
 Mv mv_l0_col = { 0 }, mv_l1_col = { 0 };
 int available_l0 = temporal_luma_motion_vector(s, x0, y0, nPbW, nPbH,
0, _l0_col, 0);
-int available_l1 = (s->sh.slice_type == B_SLICE) ?
+int available_l1 = (s->sh.slice_type == HEVC_SLICE_B) ?
temporal_luma_motion_vector(s, x0, y0, nPbW, nPbH,
0, _l1_col, 1) : 0;
 
@@ -494,7 +495,7 @@ static void derive_spatial_merge_candidates(HEVCContext *s, 
int x0, int y0,
 nb_orig_merge_cand = nb_merge_cand;
 
 // combined bi-predictive merge candidates  (applies for B slices)
-if (s->sh.slice_type == B_SLICE && nb_orig_merge_cand > 1 &&
+if (s->sh.slice_type == HEVC_SLICE_B && nb_orig_merge_cand > 1 &&
 nb_orig_merge_cand < s->sh.max_num_merge_cand) {
 int comb_idx;
 
@@ -526,7 +527,7 @@ static void derive_spatial_merge_candidates(HEVCContext *s, 
int x0, int y0,
 // append Zero motion vector candidates
 while (nb_merge_cand < s->sh.max_num_merge_cand) {
 mergecandlist[nb_merge_cand].pred_flag[0] = 1;
-mergecandlist[nb_merge_cand].pred_flag[1] = s->sh.slice_type == 
B_SLICE;
+mergecandlist[nb_merge_cand].pred_flag[1] = s->sh.slice_type == 
HEVC_SLICE_B;
 AV_ZERO32(mergecandlist[nb_merge_cand].mv + 0);
 AV_ZERO32(mergecandlist[nb_merge_cand].mv + 1);
 mergecandlist[nb_merge_cand].is_intra = 0;
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index 0b6beb5..30409ba 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -249,7 +249,7 @@ int ff_hevc_slice_rpl(HEVCContext *s)
 {
 SliceHeader *sh = >sh;
 
-uint8_t nb_list = sh->slice_type == B_SLICE ? 2 : 1;
+uint8_t nb_list = sh->slice_type == HEVC_SLICE_B ? 2 : 1;
 uint8_t list_idx;
 int i, j, ret;
 
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 72fdd22..db45608 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -243,7 +243,7 @@ static void pred_weight_table(HEVCContext *s, GetBitContext 
*gb)
 s->sh.chroma_offset_l0[i][1] = 0;
 }
 }
-if (s->sh.slice_type == B_SLICE) {
+if (s->sh.slice_type == HEVC_SLICE_B) {
 for (i = 0; i < s->sh.nb_refs[L1]; i++) {
 luma_weight_l1_flag[i] = get_bits1(gb);
 if (!luma_weight_l1_flag[i]) 

Re: [libav-devel] [PATCH] lavf: check that the codec is supported by extract_extradata

2016-10-18 Thread Luca Barbato
On 18/10/2016 20:50, Anton Khirnov wrote:
> Avoids superfluous error message spam after
> 8e2ea691351c5079cdab245ff7bfa5c0f3e3bfe4
> ---
>  libavformat/utils.c | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 1c93326..37ba5a8 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -2099,6 +2099,16 @@ static int extract_extradata_init(AVStream *st)
>  if (!f)
>  goto finish;
>  
> +/* check that the codec id is supported */
> +if (f->codec_ids) {
> +const enum AVCodecID *ids;
> +for (ids = f->codec_ids; *ids != AV_CODEC_ID_NONE; ids++)
> +if (*ids == st->codecpar->codec_id)
> +break;
> +if (*ids == AV_CODEC_ID_NONE)
> +goto finish;
> +}
> +
>  i->extract_extradata.pkt = av_packet_alloc();
>  if (!i->extract_extradata.pkt)
>  return AVERROR(ENOMEM);
> 

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


[libav-devel] [PATCH] lavf: check that the codec is supported by extract_extradata

2016-10-18 Thread Anton Khirnov
Avoids superfluous error message spam after
8e2ea691351c5079cdab245ff7bfa5c0f3e3bfe4
---
 libavformat/utils.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 1c93326..37ba5a8 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2099,6 +2099,16 @@ static int extract_extradata_init(AVStream *st)
 if (!f)
 goto finish;
 
+/* check that the codec id is supported */
+if (f->codec_ids) {
+const enum AVCodecID *ids;
+for (ids = f->codec_ids; *ids != AV_CODEC_ID_NONE; ids++)
+if (*ids == st->codecpar->codec_id)
+break;
+if (*ids == AV_CODEC_ID_NONE)
+goto finish;
+}
+
 i->extract_extradata.pkt = av_packet_alloc();
 if (!i->extract_extradata.pkt)
 return AVERROR(ENOMEM);
-- 
2.0.0

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


[libav-devel] [PATCHv2] arm: vp9: Add NEON itxfm routines

2016-10-18 Thread Martin Storsjö
This work is sponsored by, and copyright, Google.

For the transforms up to 8x8, we can fit all the data (including
temporaries) in registers and just do a straightforward transform
of all the data. For 16x16, we do a transform of 4x16 pixels in
4 slices, using a temporary buffer. For 32x32, we transform 4x32
pixels at a time, in two steps of 4x16 pixels each.

Examples of relative speedup compared to the C version, from checkasm:
 Cortex   A7 A8 A9A53
vp9_inv_adst_adst_4x4_add_neon: 3.39   5.80   4.18   3.92
vp9_inv_adst_adst_8x8_add_neon: 3.94   4.82   4.25   3.89
vp9_inv_adst_adst_16x16_add_neon:   3.33   4.27   4.08   4.05
vp9_inv_dct_dct_4x4_add_neon:   3.73   5.06   4.26   4.28
vp9_inv_dct_dct_8x8_add_neon:   4.59   5.81   5.03   4.73
vp9_inv_dct_dct_16x16_add_neon: 3.40   3.39   3.33   3.68
vp9_inv_dct_dct_32x32_add_neon: 4.00   3.51   3.80   4.40
vp9_inv_wht_wht_4x4_add_neon:   3.24   5.16   3.52   3.67

Thus, the speedup vs C code is around 3-5x.

This is mostly marginally faster than the corresponding routines
in libvpx on most cores, tested with their 32x32 idct (compared to
vpx_idct32x32_1024_add_neon). These numbers are slightly in libvpx's
favour since their version doesn't clear the input buffer like ours
do (although the effect of that on the total runtime probably is
negligible.)

   Cortex   A7   A8   A9  A53
vp9_inv_dct_dct_32x32_add_neon:18852.0  16831.6  14217.4  11988.6
libvpx vpx_idct32x32_1024_add_neon 20789.0  13344.3  15049.9  13030.5

Only on the Cortex A8, the libvpx function is faster. On the other cores,
ours is slightly faster even though ours has got source block clearing
integrated.
---
v2: Updated some broken macro comments, optimized the transposes by
using the q registers for part of transposes.

Suggestions very much welcome on names for the macros - no idea if
the current ones make sense or what one commonly would call these
combinations.

I'm a bit reluctant to expanding the macros (to be able to schedule
instructions better), in order to keep things readable. (Although,
I guess this is kinda write-only code, which nobody ever touches
afterwards).
---
 libavcodec/arm/Makefile  |3 +-
 libavcodec/arm/vp9dsp_init_arm.c |   51 +-
 libavcodec/arm/vp9itxfm_neon.S   | 1166 ++
 3 files changed, 1218 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/arm/vp9itxfm_neon.S

diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
index 2638230..01630ac 100644
--- a/libavcodec/arm/Makefile
+++ b/libavcodec/arm/Makefile
@@ -139,4 +139,5 @@ NEON-OBJS-$(CONFIG_RV40_DECODER)   += 
arm/rv34dsp_neon.o\
   arm/rv40dsp_neon.o
 NEON-OBJS-$(CONFIG_VORBIS_DECODER) += arm/vorbisdsp_neon.o
 NEON-OBJS-$(CONFIG_VP6_DECODER)+= arm/vp6dsp_neon.o
-NEON-OBJS-$(CONFIG_VP9_DECODER)+= arm/vp9mc_neon.o
+NEON-OBJS-$(CONFIG_VP9_DECODER)+= arm/vp9itxfm_neon.o   \
+  arm/vp9mc_neon.o
diff --git a/libavcodec/arm/vp9dsp_init_arm.c b/libavcodec/arm/vp9dsp_init_arm.c
index db8c683..2ba2644 100644
--- a/libavcodec/arm/vp9dsp_init_arm.c
+++ b/libavcodec/arm/vp9dsp_init_arm.c
@@ -94,7 +94,7 @@ define_8tap_2d_funcs(8)
 define_8tap_2d_funcs(4)
 
 
-av_cold void ff_vp9dsp_init_arm(VP9DSPContext *dsp)
+static av_cold void vp9dsp_mc_init_arm(VP9DSPContext *dsp)
 {
 int cpu_flags = av_get_cpu_flags();
 
@@ -138,3 +138,52 @@ av_cold void ff_vp9dsp_init_arm(VP9DSPContext *dsp)
 init_mc_funcs_dirs(4, 4);
 }
 }
+
+#define define_itxfm(type_a, type_b, sz)   \
+void ff_vp9_##type_a##_##type_b##_##sz##x##sz##_add_neon(uint8_t *_dst,\
+ ptrdiff_t stride, \
+ int16_t *_block, int 
eob)
+
+#define define_itxfm_funcs(sz)  \
+define_itxfm(idct,  idct,  sz); \
+define_itxfm(iadst, idct,  sz); \
+define_itxfm(idct,  iadst, sz); \
+define_itxfm(iadst, iadst, sz)
+
+define_itxfm_funcs(4);
+define_itxfm_funcs(8);
+define_itxfm_funcs(16);
+define_itxfm(idct, idct, 32);
+define_itxfm(iwht, iwht, 4);
+
+
+static av_cold void vp9dsp_itxfm_init_arm(VP9DSPContext *dsp)
+{
+int cpu_flags = av_get_cpu_flags();
+
+if (have_neon(cpu_flags)) {
+#define init_itxfm(tx, sz) \
+dsp->itxfm_add[tx][DCT_DCT]   = ff_vp9_idct_idct_##sz##_add_neon;  \
+dsp->itxfm_add[tx][DCT_ADST]  = ff_vp9_iadst_idct_##sz##_add_neon; \
+dsp->itxfm_add[tx][ADST_DCT]  = ff_vp9_idct_iadst_##sz##_add_neon; \
+dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_iadst_iadst_##sz##_add_neon
+
+#define init_idct(tx, nm)   \
+dsp->itxfm_add[tx][DCT_DCT]   = \
+dsp->itxfm_add[tx][ADST_DCT]  = \
+dsp->itxfm_add[tx][DCT_ADST]  

[libav-devel] [PATCH] aarch64: vp9: Add NEON itxfm routines

2016-10-18 Thread Martin Storsjö
This work is sponsored by, and copyright, Google.

These are ported from the ARM version; thanks to the larger
amount of registers available, we can do the 16x16 and 32x32
transforms in slices 8 pixels wide instead of 4. This gives
a speedup of around 1.4x compared to the 32 bit version.

The fact that aarch64 doesn't have the same d/q register
aliasing makes some of the macros quite a bit simpler as well.

Examples of runtimes vs the 32 bit version, on a Cortex A53:
   ARM  AArch64
vp9_inv_adst_adst_4x4_add_neon:   92.0 87.5
vp9_inv_adst_adst_8x8_add_neon:  411.0359.5
vp9_inv_adst_adst_16x16_add_neon:   2584.3   1871.5
vp9_inv_dct_dct_4x4_add_neon: 77.0 72.5
vp9_inv_dct_dct_8x8_add_neon:279.0260.5
vp9_inv_dct_dct_16x16_add_neon: 2020.7   1390.9
vp9_inv_dct_dct_32x32_add_neon:11988.6   8383.3
vp9_inv_wht_wht_4x4_add_neon: 65.0 57.5

The speedup vs C code (2-4x) is smaller than in the 32 bit case,
mostly because the C code ends up significantly faster (around
1.6x faster, with GCC 5.4) when built for aarch64.
---
Comments on how to name the macros are still very much welcome.

General comments on this and/or the arm version will be applied
to both, where applicable.
---
 libavcodec/aarch64/Makefile  |3 +-
 libavcodec/aarch64/vp9dsp_init_aarch64.c |   51 +-
 libavcodec/aarch64/vp9itxfm_neon.S   | 1152 ++
 3 files changed, 1204 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/aarch64/vp9itxfm_neon.S

diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile
index 6f1227a..0b06b33 100644
--- a/libavcodec/aarch64/Makefile
+++ b/libavcodec/aarch64/Makefile
@@ -44,4 +44,5 @@ NEON-OBJS-$(CONFIG_MPEGAUDIODSP)+= 
aarch64/mpegaudiodsp_neon.o
 NEON-OBJS-$(CONFIG_DCA_DECODER) += aarch64/dcadsp_neon.o   
\
aarch64/synth_filter_neon.o
 NEON-OBJS-$(CONFIG_VORBIS_DECODER)  += aarch64/vorbisdsp_neon.o
-NEON-OBJS-$(CONFIG_VP9_DECODER) += aarch64/vp9mc_neon.o
+NEON-OBJS-$(CONFIG_VP9_DECODER) += aarch64/vp9itxfm_neon.o 
\
+   aarch64/vp9mc_neon.o
diff --git a/libavcodec/aarch64/vp9dsp_init_aarch64.c 
b/libavcodec/aarch64/vp9dsp_init_aarch64.c
index 2f772ed..050c0dd 100644
--- a/libavcodec/aarch64/vp9dsp_init_aarch64.c
+++ b/libavcodec/aarch64/vp9dsp_init_aarch64.c
@@ -93,7 +93,7 @@ define_8tap_2d_funcs(16)
 define_8tap_2d_funcs(8)
 define_8tap_2d_funcs(4)
 
-av_cold void ff_vp9dsp_init_aarch64(VP9DSPContext *dsp)
+static av_cold void vp9dsp_mc_init_aarch64(VP9DSPContext *dsp)
 {
 int cpu_flags = av_get_cpu_flags();
 
@@ -137,3 +137,52 @@ av_cold void ff_vp9dsp_init_aarch64(VP9DSPContext *dsp)
 init_mc_funcs_dirs(4, 4);
 }
 }
+
+#define define_itxfm(type_a, type_b, sz)   \
+void ff_vp9_##type_a##_##type_b##_##sz##x##sz##_add_neon(uint8_t *_dst,\
+ ptrdiff_t stride, \
+ int16_t *_block, int 
eob)
+
+#define define_itxfm_funcs(sz)  \
+define_itxfm(idct,  idct,  sz); \
+define_itxfm(iadst, idct,  sz); \
+define_itxfm(idct,  iadst, sz); \
+define_itxfm(iadst, iadst, sz)
+
+define_itxfm_funcs(4);
+define_itxfm_funcs(8);
+define_itxfm_funcs(16);
+define_itxfm(idct, idct, 32);
+define_itxfm(iwht, iwht, 4);
+
+
+static av_cold void vp9dsp_itxfm_init_aarch64(VP9DSPContext *dsp)
+{
+int cpu_flags = av_get_cpu_flags();
+
+if (have_neon(cpu_flags)) {
+#define init_itxfm(tx, sz) \
+dsp->itxfm_add[tx][DCT_DCT]   = ff_vp9_idct_idct_##sz##_add_neon;  \
+dsp->itxfm_add[tx][DCT_ADST]  = ff_vp9_iadst_idct_##sz##_add_neon; \
+dsp->itxfm_add[tx][ADST_DCT]  = ff_vp9_idct_iadst_##sz##_add_neon; \
+dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_iadst_iadst_##sz##_add_neon
+
+#define init_idct(tx, nm)   \
+dsp->itxfm_add[tx][DCT_DCT]   = \
+dsp->itxfm_add[tx][ADST_DCT]  = \
+dsp->itxfm_add[tx][DCT_ADST]  = \
+dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_##nm##_add_neon
+
+init_itxfm(TX_4X4, 4x4);
+init_itxfm(TX_8X8, 8x8);
+init_itxfm(TX_16X16, 16x16);
+init_idct(TX_32X32, idct_idct_32x32);
+init_idct(4, iwht_iwht_4x4);
+}
+}
+
+av_cold void ff_vp9dsp_init_aarch64(VP9DSPContext *dsp)
+{
+vp9dsp_mc_init_aarch64(dsp);
+vp9dsp_itxfm_init_aarch64(dsp);
+}
diff --git a/libavcodec/aarch64/vp9itxfm_neon.S 
b/libavcodec/aarch64/vp9itxfm_neon.S
new file mode 100644
index 000..f91360f
--- /dev/null
+++ b/libavcodec/aarch64/vp9itxfm_neon.S
@@ -0,0 +1,1152 @@
+/*
+ * Copyright (c) 2016 Google Inc.
+ *
+ * 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 

Re: [libav-devel] [PATCH] fate: Update hashes

2016-10-18 Thread Luca Barbato
On 18/10/2016 16:10, Vittorio Giovara wrote:
> How about
> 
> 
> fate: Update gbrap12le hash
> 
> Missing from be9dba5c8abc6ecf0b8ee4ccb11c7850327fcf8d.
> 
> 

Fine for me.

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


Re: [libav-devel] [PATCH] fate: Update hashes

2016-10-18 Thread Vittorio Giovara
How about


fate: Update gbrap12le hash

Missing from be9dba5c8abc6ecf0b8ee4ccb11c7850327fcf8d.


On Tue, Oct 18, 2016 at 9:00 AM, Luca Barbato  wrote:
> The previous commit lacked this.
> ---
>
> Looks like the hashes weren't updated...
>
>  tests/ref/fate/filter-pixfmts-scale | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/ref/fate/filter-pixfmts-scale 
> b/tests/ref/fate/filter-pixfmts-scale
> index 97f29be..2a60f72 100644
> --- a/tests/ref/fate/filter-pixfmts-scale
> +++ b/tests/ref/fate/filter-pixfmts-scale
> @@ -14,7 +14,7 @@ bgr8e731ba3dbec294e1daa7313e08e88034
>  bgra6e1f417ae41636f631de1cfe39ce1778
>  gbrap   eefdbfd1426765ce5e9790022533db0d
>  gbrap12be   af4acb3ad0a6630f6ec4534e4d2e869a
> -gbrap12le   fb66da21243e922b4e12ca05d8242c42
> +gbrap12le   90ca5271960dc1ebd6ebe14189223e36
>  gbrp5d14768d2ab6cbf3879966b5d5c6befb
>  gbrp10be4192c246f4a52ec7a37919665190cce9
>  gbrp10le170189b2c2dd46f31165d8fa6cadef0a
> --

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


Re: [libav-devel] [PATCH] fate: Update hashes

2016-10-18 Thread Martin Storsjö

On Tue, 18 Oct 2016, Luca Barbato wrote:


The previous commit lacked this.
---

Looks like the hashes weren't updated...

tests/ref/fate/filter-pixfmts-scale | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/ref/fate/filter-pixfmts-scale 
b/tests/ref/fate/filter-pixfmts-scale
index 97f29be..2a60f72 100644
--- a/tests/ref/fate/filter-pixfmts-scale
+++ b/tests/ref/fate/filter-pixfmts-scale
@@ -14,7 +14,7 @@ bgr8e731ba3dbec294e1daa7313e08e88034
bgra6e1f417ae41636f631de1cfe39ce1778
gbrap   eefdbfd1426765ce5e9790022533db0d
gbrap12be   af4acb3ad0a6630f6ec4534e4d2e869a
-gbrap12le   fb66da21243e922b4e12ca05d8242c42
+gbrap12le   90ca5271960dc1ebd6ebe14189223e36
gbrp5d14768d2ab6cbf3879966b5d5c6befb
gbrp10be4192c246f4a52ec7a37919665190cce9
gbrp10le170189b2c2dd46f31165d8fa6cadef0a
--
2.9.2


This is at least the same hash that I'm getting on both x86_64, arm and 
aarch64 now, so I guess it's ok then. No idea if the code actually 
produces the right results though, but at least it's consistent now.


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


Re: [libav-devel] [PATCH] aviocat: Support avio options

2016-10-18 Thread Luca Barbato
On 18/10/2016 14:55, Martin Storsjö wrote:
> Should the dictionary be freed afterwards (in case it contained options
> that weren't used), to make sure it doesn't show any leaks if ran in
> valgrind?

You are absolutely right! Thank you, locally updated =)

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


Re: [libav-devel] [PATCH] checkasm: aarch64: Don't clobber x29 in checkasm_stack_clobber

2016-10-18 Thread Martin Storsjö

On Tue, 18 Oct 2016, Martin Storsjö wrote:


x29 (FP) is a callee saved register and should be restored on
return. Instead of backing up x29 and restoring it here, back up
sp in a register that we are allowed to overwrite.

This fixes crashes in checkasm on aarch64 since f1b3e1313851.
For some reason, gcc builds didn't crash, but clang builds do.
---
tests/checkasm/aarch64/checkasm.S | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)


OK'd by Janne on irc.

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


[libav-devel] [PATCH] fate: Update hashes

2016-10-18 Thread Luca Barbato
The previous commit lacked this.
---

Looks like the hashes weren't updated...

 tests/ref/fate/filter-pixfmts-scale | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/ref/fate/filter-pixfmts-scale 
b/tests/ref/fate/filter-pixfmts-scale
index 97f29be..2a60f72 100644
--- a/tests/ref/fate/filter-pixfmts-scale
+++ b/tests/ref/fate/filter-pixfmts-scale
@@ -14,7 +14,7 @@ bgr8e731ba3dbec294e1daa7313e08e88034
 bgra6e1f417ae41636f631de1cfe39ce1778
 gbrap   eefdbfd1426765ce5e9790022533db0d
 gbrap12be   af4acb3ad0a6630f6ec4534e4d2e869a
-gbrap12le   fb66da21243e922b4e12ca05d8242c42
+gbrap12le   90ca5271960dc1ebd6ebe14189223e36
 gbrp5d14768d2ab6cbf3879966b5d5c6befb
 gbrp10be4192c246f4a52ec7a37919665190cce9
 gbrp10le170189b2c2dd46f31165d8fa6cadef0a
--
2.9.2

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


Re: [libav-devel] [PATCH] fate: Add --skip-tests configure option for omitting specific FATE tests

2016-10-18 Thread Martin Storsjö

On Tue, 18 Oct 2016, Diego Biurrun wrote:


This can be useful to filter out noise in known-broken scenarios like
miscompilation by legacy compilers and similar.
---

Now adds a "fate-" prefix to the test name on its own.

configure  | 4 
tests/Makefile | 2 ++
2 files changed, 6 insertions(+)


Still ok with me, but I'd also appreciate a comment from Janne before 
pushing.


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


Re: [libav-devel] [PATCH] aviocat: Support avio options

2016-10-18 Thread Martin Storsjö

On Tue, 18 Oct 2016, Luca Barbato wrote:


Useful to test protocols that require options to be used.
---
tools/aviocat.c | 23 ---
1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/tools/aviocat.c b/tools/aviocat.c
index 59244a8..fffcbe3 100644
--- a/tools/aviocat.c
+++ b/tools/aviocat.c
@@ -26,7 +26,8 @@

static int usage(const char *argv0, int ret)
{
-fprintf(stderr, "%s [-b bytespersec] [-d duration] input_url 
output_url\n", argv0);
+fprintf(stderr, "%s [-b bytespersec] [-d duration] [-oi ] [-oo 
] input_url output_url\n", argv0);
+fprintf(stderr, ": AVOptions expressed as key=value, 
:-separated\n");
return ret;
}

@@ -38,6 +39,8 @@ int main(int argc, char **argv)
int64_t start_time;
char errbuf[50];
AVIOContext *input, *output;
+AVDictionary *in_opts = NULL;
+AVDictionary *out_opts = NULL;

av_register_all();
avformat_network_init();
@@ -49,6 +52,20 @@ int main(int argc, char **argv)
} else if (!strcmp(argv[i], "-d") && i + 1 < argc) {
duration = atoi(argv[i + 1]);
i++;
+} else if (!strcmp(argv[i], "-oi") && i + 1 < argc) {
+if (av_dict_parse_string(_opts, argv[i + 1], "=", ":", 0) < 0) {
+fprintf(stderr, "Cannot parse option string %s\n",
+argv[i + 1]);
+return usage(argv[0], 1);
+}
+i++;
+} else if (!strcmp(argv[i], "-oo") && i + 1 < argc) {
+if (av_dict_parse_string(_opts, argv[i + 1], "=", ":", 0) < 0) 
{
+fprintf(stderr, "Cannot parse option string %s\n",
+argv[i + 1]);
+return usage(argv[0], 1);
+}
+i++;
} else if (!input_url) {
input_url = argv[i];
} else if (!output_url) {
@@ -60,7 +77,7 @@ int main(int argc, char **argv)
if (!output_url)
return usage(argv[0], 1);

-ret = avio_open2(, input_url, AVIO_FLAG_READ, NULL, NULL);
+ret = avio_open2(, input_url, AVIO_FLAG_READ, NULL, _opts);
if (ret) {
av_strerror(ret, errbuf, sizeof(errbuf));
fprintf(stderr, "Unable to open %s: %s\n", input_url, errbuf);
@@ -75,7 +92,7 @@ int main(int argc, char **argv)
}
bps = size / duration;
}
-ret = avio_open2(, output_url, AVIO_FLAG_WRITE, NULL, NULL);
+ret = avio_open2(, output_url, AVIO_FLAG_WRITE, NULL, _opts);
if (ret) {
av_strerror(ret, errbuf, sizeof(errbuf));
fprintf(stderr, "Unable to open %s: %s\n", output_url, errbuf);
--
2.9.2


Should the dictionary be freed afterwards (in case it contained options 
that weren't used), to make sure it doesn't show any leaks if ran in 
valgrind?


Other than that, LGTM!

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


[libav-devel] [PATCH] aviocat: Support avio options

2016-10-18 Thread Luca Barbato
Useful to test protocols that require options to be used.
---
 tools/aviocat.c | 23 ---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/tools/aviocat.c b/tools/aviocat.c
index 59244a8..fffcbe3 100644
--- a/tools/aviocat.c
+++ b/tools/aviocat.c
@@ -26,7 +26,8 @@
 
 static int usage(const char *argv0, int ret)
 {
-fprintf(stderr, "%s [-b bytespersec] [-d duration] input_url 
output_url\n", argv0);
+fprintf(stderr, "%s [-b bytespersec] [-d duration] [-oi ] [-oo 
] input_url output_url\n", argv0);
+fprintf(stderr, ": AVOptions expressed as key=value, 
:-separated\n");
 return ret;
 }
 
@@ -38,6 +39,8 @@ int main(int argc, char **argv)
 int64_t start_time;
 char errbuf[50];
 AVIOContext *input, *output;
+AVDictionary *in_opts = NULL;
+AVDictionary *out_opts = NULL;
 
 av_register_all();
 avformat_network_init();
@@ -49,6 +52,20 @@ int main(int argc, char **argv)
 } else if (!strcmp(argv[i], "-d") && i + 1 < argc) {
 duration = atoi(argv[i + 1]);
 i++;
+} else if (!strcmp(argv[i], "-oi") && i + 1 < argc) {
+if (av_dict_parse_string(_opts, argv[i + 1], "=", ":", 0) < 0) {
+fprintf(stderr, "Cannot parse option string %s\n",
+argv[i + 1]);
+return usage(argv[0], 1);
+}
+i++;
+} else if (!strcmp(argv[i], "-oo") && i + 1 < argc) {
+if (av_dict_parse_string(_opts, argv[i + 1], "=", ":", 0) < 0) 
{
+fprintf(stderr, "Cannot parse option string %s\n",
+argv[i + 1]);
+return usage(argv[0], 1);
+}
+i++;
 } else if (!input_url) {
 input_url = argv[i];
 } else if (!output_url) {
@@ -60,7 +77,7 @@ int main(int argc, char **argv)
 if (!output_url)
 return usage(argv[0], 1);
 
-ret = avio_open2(, input_url, AVIO_FLAG_READ, NULL, NULL);
+ret = avio_open2(, input_url, AVIO_FLAG_READ, NULL, _opts);
 if (ret) {
 av_strerror(ret, errbuf, sizeof(errbuf));
 fprintf(stderr, "Unable to open %s: %s\n", input_url, errbuf);
@@ -75,7 +92,7 @@ int main(int argc, char **argv)
 }
 bps = size / duration;
 }
-ret = avio_open2(, output_url, AVIO_FLAG_WRITE, NULL, NULL);
+ret = avio_open2(, output_url, AVIO_FLAG_WRITE, NULL, _opts);
 if (ret) {
 av_strerror(ret, errbuf, sizeof(errbuf));
 fprintf(stderr, "Unable to open %s: %s\n", output_url, errbuf);
-- 
2.9.2

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


[libav-devel] [PATCH] fate: Add --skip-tests configure option for omitting specific FATE tests

2016-10-18 Thread Diego Biurrun
This can be useful to filter out noise in known-broken scenarios like
miscompilation by legacy compilers and similar.
---

Now adds a "fate-" prefix to the test name on its own.

 configure  | 4 
 tests/Makefile | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/configure b/configure
index 745b5b7..bec4772 100755
--- a/configure
+++ b/configure
@@ -347,6 +347,8 @@ Developer options (useful when working on Libav itself):
   --random-seed=VALUE  seed value for --enable/disable-random
   --disable-valgrind-backtrace do not print a backtrace under Valgrind
(only applies to --disable-optimizations builds)
+  --skip-tests=TESTS   whitespace-separated list of FATE tests to skip
+   (without "fate-" prefix in the name)
 
 NOTE: Object files are built at the place where configure is launched.
 EOF
@@ -1808,6 +1810,7 @@ CMDLINE_SET="
 pkg_config_flags
 random_seed
 samples
+skip_tests
 sysinclude
 sysroot
 target_exec
@@ -5313,6 +5316,7 @@ SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
 SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
 VERSION_SCRIPT_POSTPROCESS_CMD=${VERSION_SCRIPT_POSTPROCESS_CMD}
 SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
+SKIP_TESTS=$skip_tests
 EOF
 
 get_version(){
diff --git a/tests/Makefile b/tests/Makefile
index 36a3a72..c49116c 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -142,6 +142,8 @@ endif
 
 FATE_UTILS = base64 tiny_psnr
 
+FATE := $(filter-out $(addprefix fate-,$(SKIP_TESTS)),$(FATE))
+
 fate: $(FATE)
 
 $(FATE): $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
-- 
2.1.4

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


[libav-devel] [PATCH] checkasm: aarch64: Don't clobber x29 in checkasm_stack_clobber

2016-10-18 Thread Martin Storsjö
x29 (FP) is a callee saved register and should be restored on
return. Instead of backing up x29 and restoring it here, back up
sp in a register that we are allowed to overwrite.

This fixes crashes in checkasm on aarch64 since f1b3e1313851.
For some reason, gcc builds didn't crash, but clang builds do.
---
 tests/checkasm/aarch64/checkasm.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/checkasm/aarch64/checkasm.S 
b/tests/checkasm/aarch64/checkasm.S
index 65b3521..bc5ed9e 100644
--- a/tests/checkasm/aarch64/checkasm.S
+++ b/tests/checkasm/aarch64/checkasm.S
@@ -55,13 +55,13 @@ endconst
 #define CLOBBER_STACK ((8*MAX_ARGS + 15) & ~15)
 
 function checkasm_stack_clobber, export=1
-mov x29, sp
+mov x3,  sp
 mov x2,  #CLOBBER_STACK
 1:
 stp x0,  x1,  [sp, #-16]!
 subsx2,  x2,  #16
 b.gt1b
-mov sp,  x29
+mov sp,  x3
 ret
 endfunc
 
-- 
2.7.4

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