[libav-devel] [PATCH 2/2] aarch64: implement videodsp.prefetch

2014-04-05 Thread Janne Grunau
From: Janne Grunau j...@jannau.net

8% faster h264 decoding on Apple A7.
---
 libavcodec/aarch64/Makefile|  2 ++
 libavcodec/aarch64/videodsp.S  | 28 
 libavcodec/aarch64/videodsp_init.c | 32 
 libavcodec/videodsp.c  |  2 ++
 libavcodec/videodsp.h  |  1 +
 5 files changed, 65 insertions(+)
 create mode 100644 libavcodec/aarch64/videodsp.S
 create mode 100644 libavcodec/aarch64/videodsp_init.c

diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile
index 59d1762..a3f0afc 100644
--- a/libavcodec/aarch64/Makefile
+++ b/libavcodec/aarch64/Makefile
@@ -3,6 +3,8 @@ OBJS-$(CONFIG_H264DSP)  += 
aarch64/h264dsp_init_aarch64.o
 OBJS-$(CONFIG_H264QPEL) += aarch64/h264qpel_init_aarch64.o
 OBJS-$(CONFIG_HPELDSP)  += aarch64/hpeldsp_init_aarch64.o
 OBJS-$(CONFIG_NEON_CLOBBER_TEST)+= aarch64/neontest.o
+OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp_init.o 
\
+   aarch64/videodsp.o
 
 OBJS-$(CONFIG_RV40_DECODER) += aarch64/rv40dsp_init_aarch64.o
 OBJS-$(CONFIG_VC1_DECODER)  += aarch64/vc1dsp_init_aarch64.o
diff --git a/libavcodec/aarch64/videodsp.S b/libavcodec/aarch64/videodsp.S
new file mode 100644
index 000..c97e0c0
--- /dev/null
+++ b/libavcodec/aarch64/videodsp.S
@@ -0,0 +1,28 @@
+//
+// 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 config.h
+#include libavutil/aarch64/asm.S
+
+function ff_prefetch_aarch64, export=1
+subsw2,  w2,  #2
+prfmpldl1strm, [x0]
+prfmpldl1strm, [x0,  x1]
+add x0,  x0,  x1,  lsl #1
+b.gtX(ff_prefetch_aarch64)
+ret
+endfunc
diff --git a/libavcodec/aarch64/videodsp_init.c 
b/libavcodec/aarch64/videodsp_init.c
new file mode 100644
index 000..8e52b15
--- /dev/null
+++ b/libavcodec/aarch64/videodsp_init.c
@@ -0,0 +1,32 @@
+/*
+ * 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/aarch64/cpu.h
+#include libavutil/attributes.h
+#include libavutil/cpu.h
+#include libavcodec/videodsp.h
+
+void ff_prefetch_aarch64(uint8_t *mem, ptrdiff_t stride, int h);
+
+av_cold void ff_videodsp_init_aarch64(VideoDSPContext *ctx, int bpc)
+{
+int cpu_flags = av_get_cpu_flags();
+
+if (have_armv8(cpu_flags))
+ctx-prefetch = ff_prefetch_aarch64;
+}
diff --git a/libavcodec/videodsp.c b/libavcodec/videodsp.c
index a6a1d37..e6d9303 100644
--- a/libavcodec/videodsp.c
+++ b/libavcodec/videodsp.c
@@ -43,6 +43,8 @@ av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
 ctx-emulated_edge_mc = ff_emulated_edge_mc_16;
 }
 
+if (ARCH_AARCH64)
+ff_videodsp_init_aarch64(ctx, bpc);
 if (ARCH_ARM)
 ff_videodsp_init_arm(ctx, bpc);
 if (ARCH_PPC)
diff --git a/libavcodec/videodsp.h b/libavcodec/videodsp.h
index 2211c5d..04c012a 100644
--- a/libavcodec/videodsp.h
+++ b/libavcodec/videodsp.h
@@ -68,6 +68,7 @@ typedef struct VideoDSPContext {
 void ff_videodsp_init(VideoDSPContext *ctx, int bpc);
 
 /* for internal use only (i.e. called by ff_videodsp_init() */
+void ff_videodsp_init_aarch64(VideoDSPContext *ctx, int bpc);
 void ff_videodsp_init_arm(VideoDSPContext *ctx, int bpc);
 void ff_videodsp_init_ppc(VideoDSPContext *ctx, int bpc);
 void ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc);
-- 
1.9.1

___
libav-devel 

[libav-devel] [PATCH 1/2] aarch64: add armv8 CPU flag

2014-04-05 Thread Janne Grunau
From: Janne Grunau j...@jannau.net

---
 libavutil/aarch64/cpu.c | 3 ++-
 libavutil/aarch64/cpu.h | 1 +
 libavutil/cpu.c | 2 ++
 libavutil/cpu.h | 1 +
 4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c
index 2cc2ccd..4ad19b4 100644
--- a/libavutil/aarch64/cpu.c
+++ b/libavutil/aarch64/cpu.c
@@ -22,6 +22,7 @@
 
 int ff_get_cpu_flags_aarch64(void)
 {
-return AV_CPU_FLAG_NEON * HAVE_NEON |
+return AV_CPU_FLAG_ARMV8|
+   AV_CPU_FLAG_NEON * HAVE_NEON |
AV_CPU_FLAG_VFP  * HAVE_VFP;
 }
diff --git a/libavutil/aarch64/cpu.h b/libavutil/aarch64/cpu.h
index 704df48..1821fc8 100644
--- a/libavutil/aarch64/cpu.h
+++ b/libavutil/aarch64/cpu.h
@@ -23,6 +23,7 @@
 #include libavutil/cpu.h
 #include libavutil/cpu_internal.h
 
+#define have_armv8(flags) ((flags)  AV_CPU_FLAG_ARMV8)
 #define have_neon(flags) CPUEXT(flags, NEON)
 #define have_vfp(flags)  CPUEXT(flags, VFP)
 
diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index d651eb2..e755d15 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -126,6 +126,7 @@ int av_parse_cpu_flags(const char *s)
 { vfpv3,NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFPV3   
 },.unit = flags },
 { neon, NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON
 },.unit = flags },
 #elif ARCH_AARCH64
+{ armv8,NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV8   
 },.unit = flags },
 { neon, NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON
 },.unit = flags },
 { vfp,  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP 
 },.unit = flags },
 #endif
@@ -185,6 +186,7 @@ static const struct {
 const char *name;
 } cpu_flag_tab[] = {
 #if   ARCH_AARCH64
+{ AV_CPU_FLAG_ARMV8, armv8  },
 { AV_CPU_FLAG_NEON,  neon   },
 { AV_CPU_FLAG_VFP,   vfp},
 #elif ARCH_ARM
diff --git a/libavutil/cpu.h b/libavutil/cpu.h
index 517c520..7ce 100644
--- a/libavutil/cpu.h
+++ b/libavutil/cpu.h
@@ -61,6 +61,7 @@
 #define AV_CPU_FLAG_VFP  (1  3)
 #define AV_CPU_FLAG_VFPV3(1  4)
 #define AV_CPU_FLAG_NEON (1  5)
+#define AV_CPU_FLAG_ARMV8(1  6)
 
 /**
  * Return the flags which specify extensions supported by the CPU.
-- 
1.9.1

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


Re: [libav-devel] [PATCH 1/2] aarch64: add armv8 CPU flag

2014-04-05 Thread Luca Barbato
On 05/04/14 14:16, Janne Grunau wrote:
 From: Janne Grunau j...@jannau.net
 
 ---
  libavutil/aarch64/cpu.c | 3 ++-
  libavutil/aarch64/cpu.h | 1 +
  libavutil/cpu.c | 2 ++
  libavutil/cpu.h | 1 +
  4 files changed, 6 insertions(+), 1 deletion(-)
 

Looks fine.

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


Re: [libav-devel] [PATCH 2/2] aarch64: implement videodsp.prefetch

2014-04-05 Thread Diego Biurrun
On Sat, Apr 05, 2014 at 02:16:48PM +0200, Janne Grunau wrote:
 --- /dev/null
 +++ b/libavcodec/aarch64/videodsp.S
 @@ -0,0 +1,28 @@
 +//
 +// 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 config.h
 +#include libavutil/aarch64/asm.S

This looks strange w/o multiline comments, like we use everywhere else.

 --- /dev/null
 +++ b/libavcodec/aarch64/videodsp_init.c
 @@ -0,0 +1,32 @@
 +
 +#include libavutil/aarch64/cpu.h
 +#include libavutil/attributes.h
 +#include libavutil/cpu.h

nit: Move aarch64 #include below the others.

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


Re: [libav-devel] [PATCH 1/2] aarch64: add armv8 CPU flag

2014-04-05 Thread Diego Biurrun
On Sat, Apr 05, 2014 at 02:16:47PM +0200, Janne Grunau wrote:
 From: Janne Grunau j...@jannau.net
 
 ---
  libavutil/aarch64/cpu.c | 3 ++-
  libavutil/aarch64/cpu.h | 1 +
  libavutil/cpu.c | 2 ++
  libavutil/cpu.h | 1 +
  4 files changed, 6 insertions(+), 1 deletion(-)

Why don't you add a HAVE_ARMV8 variable?

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


Re: [libav-devel] [PATCH 092/132] dsputil: Split off HuffYUV decoding bits into their own context

2014-04-05 Thread Luca Barbato
On 26/03/14 12:41, Diego Biurrun wrote:
 ---

Seems correct.

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


Re: [libav-devel] [PATCH 093/132] dsputil: Split off HuffYUV encoding bits into their own context

2014-04-05 Thread Luca Barbato
On 26/03/14 12:41, Diego Biurrun wrote:
 ---
  configure  |   7 ++-
  libavcodec/Makefile|   1 +
  libavcodec/dsputil.c   |  56 --
  libavcodec/dsputil.h   |  13 -
  libavcodec/huffyuv.h   |   2 +
  libavcodec/huffyuvenc.c|  34 +--
  libavcodec/huffyuvencdsp.c |  84 +++
  libavcodec/huffyuvencdsp.h |  41 ++
  libavcodec/pngenc.c|  16 +++---
  libavcodec/utvideo.h   |   4 +-
  libavcodec/utvideoenc.c|   4 +-
  libavcodec/x86/Makefile|   1 +
  libavcodec/x86/dsputilenc_mmx.c|  68 --
  libavcodec/x86/huffyuvencdsp_mmx.c | 113 
 +
  14 files changed, 278 insertions(+), 166 deletions(-)
  create mode 100644 libavcodec/huffyuvencdsp.c
  create mode 100644 libavcodec/huffyuvencdsp.h
  create mode 100644 libavcodec/x86/huffyuvencdsp_mmx.c
 

Seems fine.

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


Re: [libav-devel] [PATCH v6 6/7] af_volume: implement replaygain clipping prevention

2014-04-05 Thread Justin Ruggles
On 04/04/2014 12:44 PM, Alessandro Ghedini wrote:
 This adds a new replaygain_noclip option to the filter, and, if enabled,
 limits the gain applied for tracks where clipping would occur.
 ---
 Renamed option to replaygain_noclip.
 
  doc/filters.texi|  5 +
  libavfilter/af_volume.c | 32 ++--
  libavfilter/af_volume.h |  1 +
  3 files changed, 28 insertions(+), 10 deletions(-)
 
 diff --git a/doc/filters.texi b/doc/filters.texi
 index f986623..1ed57dd 100644
 --- a/doc/filters.texi
 +++ b/doc/filters.texi
 @@ -639,6 +639,11 @@ Pre-amplification gain in dB to apply to the selected 
 replaygain gain.
  
  Default value for @var{replaygain_preamp} is 0.0.
  
 +@item replaygain_noclip
 +Prevent clipping by limiting the gain applied.
 +
 +Default value for @var{replaygain_noclip} is 1.
 +
  @end table
  
  @subsection Examples
 diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c
 index 823fa15..c036c9d 100644
 --- a/libavfilter/af_volume.c
 +++ b/libavfilter/af_volume.c
 @@ -61,6 +61,8 @@ static const AVOption options[] = {
  { album,  album gain is preferred, 0, AV_OPT_TYPE_CONST, 
 { .i64 = REPLAYGAIN_ALBUM  }, 0, 0, A, replaygain },
  { replaygain_preamp, Apply replaygain pre-amplification,
  OFFSET(replaygain_preamp), AV_OPT_TYPE_DOUBLE, { .dbl = 0.0 }, 
 -15.0, 15.0, A },
 +{ replaygain_noclip, Apply replaygain clipping prevention,
 +OFFSET(replaygain_noclip), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, 
 A },
  { NULL },
  };
  
 @@ -246,25 +248,35 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
 *buf)
  if (sd  vol-replaygain != REPLAYGAIN_IGNORE) {
  if (vol-replaygain != REPLAYGAIN_DROP) {
  AVReplayGain *replaygain = (AVReplayGain*)sd-data;
 -int32_t gain;
 -float g;
 -
 -if (vol-replaygain == REPLAYGAIN_TRACK 
 -replaygain-track_gain != INT32_MIN)
 -gain = replaygain-track_gain;
 -else if (replaygain-album_gain != INT32_MIN)
 -gain = replaygain-album_gain;
 -else {
 +int32_t gain  = 10;
 +uint32_t peak = 10;
 +float g, p;
 +
 +if (vol-replaygain == REPLAYGAIN_TRACK) {
 +if (replaygain-track_gain != INT32_MIN)
 +gain = replaygain-track_gain;
 +
 +if (replaygain-track_peak != 0)
 +peak = replaygain-track_peak;
 +} else if (vol-replaygain == REPLAYGAIN_ALBUM) {
 +if (replaygain-album_gain != INT32_MIN)
 +gain = replaygain-album_gain;
 +
 +if (replaygain-album_peak != 0)
 +peak = replaygain-album_peak;

This changes existing behavior. Currently if the user option says that
track gain is preferred but the track gain is undefined, it will fall
back to album gain. After your patch that is no longer the case.

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


Re: [libav-devel] [PATCH 1/2] aarch64: add armv8 CPU flag

2014-04-05 Thread Janne Grunau
On 2014-04-05 14:35:00 +0200, Diego Biurrun wrote:
 On Sat, Apr 05, 2014 at 02:16:47PM +0200, Janne Grunau wrote:
  From: Janne Grunau j...@jannau.net
  
  ---
   libavutil/aarch64/cpu.c | 3 ++-
   libavutil/aarch64/cpu.h | 1 +
   libavutil/cpu.c | 2 ++
   libavutil/cpu.h | 1 +
   4 files changed, 6 insertions(+), 1 deletion(-)
 
 Why don't you add a HAVE_ARMV8 variable?

because it's always true when targeting ARCH_AARCH64. The whole ARMV8
flag is questionable and only useful for ensuring that '-cpuflags none'
runs the same compiled code on each architecture.

But I fear I need it anyway for building without external assembler.

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


Re: [libav-devel] [PATCH 1/2] mov: read hydrogenaudio replaygain information

2014-04-05 Thread Justin Ruggles
On 04/04/2014 11:49 AM, Anton Khirnov wrote:
 ---
  libavformat/Makefile |2 +-
  libavformat/mov.c|   99 
 +-
  2 files changed, 99 insertions(+), 2 deletions(-)
[...]
 +static int mov_read_replaygain(MOVContext *c, AVIOContext *pb, int size)
 +{
 +int64_t end = avio_tell(pb) + size;
 +uint8_t *key = NULL, *val = NULL;
 +int i;
 +
 +for (i = 0; i  2; i++) {
 +uint8_t **p;
 +uint32_t len, tag;
 +
 +if (end - avio_tell(pb) = 16)
 +break;

This is the only part I don't get. Why 16? Is the key required to have a
length of at least 4?

The rest looks ok.

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


Re: [libav-devel] [PATCH 1/2] aarch64: add armv8 CPU flag

2014-04-05 Thread Diego Biurrun
On Sat, Apr 05, 2014 at 04:59:21PM +0200, Janne Grunau wrote:
 On 2014-04-05 14:35:00 +0200, Diego Biurrun wrote:
  On Sat, Apr 05, 2014 at 02:16:47PM +0200, Janne Grunau wrote:
   From: Janne Grunau j...@jannau.net
   
   ---
libavutil/aarch64/cpu.c | 3 ++-
libavutil/aarch64/cpu.h | 1 +
libavutil/cpu.c | 2 ++
libavutil/cpu.h | 1 +
4 files changed, 6 insertions(+), 1 deletion(-)
  
  Why don't you add a HAVE_ARMV8 variable?
 
 because it's always true when targeting ARCH_AARCH64. The whole ARMV8
 flag is questionable and only useful for ensuring that '-cpuflags none'
 runs the same compiled code on each architecture.
 
 But I fear I need it anyway for building without external assembler.

So go ahead and add it.  Some of the code you wrote here would get
simplified as a bonus.

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


[libav-devel] [PATCH v2 2/2] aarch64: implement videodsp.prefetch

2014-04-05 Thread Janne Grunau
From: Janne Grunau j...@jannau.net

8% faster h264 decoding on Apple A7.
---
 libavcodec/aarch64/Makefile|  3 +++
 libavcodec/aarch64/videodsp.S  | 29 +
 libavcodec/aarch64/videodsp_init.c | 32 
 libavcodec/videodsp.c  |  2 ++
 libavcodec/videodsp.h  |  1 +
 5 files changed, 67 insertions(+)
 create mode 100644 libavcodec/aarch64/videodsp.S
 create mode 100644 libavcodec/aarch64/videodsp_init.c

diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile
index 59d1762..757b499 100644
--- a/libavcodec/aarch64/Makefile
+++ b/libavcodec/aarch64/Makefile
@@ -3,10 +3,13 @@ OBJS-$(CONFIG_H264DSP)  += 
aarch64/h264dsp_init_aarch64.o
 OBJS-$(CONFIG_H264QPEL) += aarch64/h264qpel_init_aarch64.o
 OBJS-$(CONFIG_HPELDSP)  += aarch64/hpeldsp_init_aarch64.o
 OBJS-$(CONFIG_NEON_CLOBBER_TEST)+= aarch64/neontest.o
+OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp_init.o
 
 OBJS-$(CONFIG_RV40_DECODER) += aarch64/rv40dsp_init_aarch64.o
 OBJS-$(CONFIG_VC1_DECODER)  += aarch64/vc1dsp_init_aarch64.o
 
+ARMV8-OBJS-$(CONFIG_VIDEODSP)   += aarch64/videodsp.o
+
 NEON-OBJS-$(CONFIG_H264CHROMA)  += aarch64/h264cmc_neon.o
 NEON-OBJS-$(CONFIG_H264DSP) += aarch64/h264dsp_neon.o  
\
aarch64/h264idct_neon.o
diff --git a/libavcodec/aarch64/videodsp.S b/libavcodec/aarch64/videodsp.S
new file mode 100644
index 000..17f83dc
--- /dev/null
+++ b/libavcodec/aarch64/videodsp.S
@@ -0,0 +1,29 @@
+/*
+ * 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 config.h
+#include libavutil/aarch64/asm.S
+
+function ff_prefetch_aarch64, export=1
+subsw2,  w2,  #2
+prfmpldl1strm, [x0]
+prfmpldl1strm, [x0,  x1]
+add x0,  x0,  x1,  lsl #1
+b.gtX(ff_prefetch_aarch64)
+ret
+endfunc
diff --git a/libavcodec/aarch64/videodsp_init.c 
b/libavcodec/aarch64/videodsp_init.c
new file mode 100644
index 000..59b697d
--- /dev/null
+++ b/libavcodec/aarch64/videodsp_init.c
@@ -0,0 +1,32 @@
+/*
+ * 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/attributes.h
+#include libavutil/cpu.h
+#include libavutil/aarch64/cpu.h
+#include libavcodec/videodsp.h
+
+void ff_prefetch_aarch64(uint8_t *mem, ptrdiff_t stride, int h);
+
+av_cold void ff_videodsp_init_aarch64(VideoDSPContext *ctx, int bpc)
+{
+int cpu_flags = av_get_cpu_flags();
+
+if (have_armv8(cpu_flags))
+ctx-prefetch = ff_prefetch_aarch64;
+}
diff --git a/libavcodec/videodsp.c b/libavcodec/videodsp.c
index a6a1d37..e6d9303 100644
--- a/libavcodec/videodsp.c
+++ b/libavcodec/videodsp.c
@@ -43,6 +43,8 @@ av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
 ctx-emulated_edge_mc = ff_emulated_edge_mc_16;
 }
 
+if (ARCH_AARCH64)
+ff_videodsp_init_aarch64(ctx, bpc);
 if (ARCH_ARM)
 ff_videodsp_init_arm(ctx, bpc);
 if (ARCH_PPC)
diff --git a/libavcodec/videodsp.h b/libavcodec/videodsp.h
index 2211c5d..04c012a 100644
--- a/libavcodec/videodsp.h
+++ b/libavcodec/videodsp.h
@@ -68,6 +68,7 @@ typedef struct VideoDSPContext {
 void ff_videodsp_init(VideoDSPContext *ctx, int bpc);
 
 /* for internal use only (i.e. called by ff_videodsp_init() */
+void ff_videodsp_init_aarch64(VideoDSPContext *ctx, int bpc);
 void 

[libav-devel] [PATCH v2 1/2] aarch64: add armv8 CPU flag

2014-04-05 Thread Janne Grunau
From: Janne Grunau j...@jannau.net

---
 Makefile| 2 +-
 arch.mak| 1 +
 configure   | 3 +++
 libavutil/aarch64/cpu.c | 5 +++--
 libavutil/aarch64/cpu.h | 1 +
 libavutil/cpu.c | 2 ++
 libavutil/cpu.h | 1 +
 7 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 2453dfd..b3680c2 100644
--- a/Makefile
+++ b/Makefile
@@ -114,7 +114,7 @@ config.h: .config
 
 SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS  \
HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS\
-   ARMV5TE-OBJS ARMV6-OBJS VFP-OBJS NEON-OBJS\
+   ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
ALTIVEC-OBJS MMX-OBJS YASM-OBJS   \
OBJS HOSTOBJS TESTOBJS
 
diff --git a/arch.mak b/arch.mak
index b287fce..4bfc883 100644
--- a/arch.mak
+++ b/arch.mak
@@ -1,5 +1,6 @@
 OBJS-$(HAVE_ARMV5TE) += $(ARMV5TE-OBJS) $(ARMV5TE-OBJS-yes)
 OBJS-$(HAVE_ARMV6)   += $(ARMV6-OBJS)   $(ARMV6-OBJS-yes)
+OBJS-$(HAVE_ARMV8)   += $(ARMV8-OBJS)   $(ARMV8-OBJS-yes)
 OBJS-$(HAVE_VFP) += $(VFP-OBJS) $(VFP-OBJS-yes)
 OBJS-$(HAVE_NEON)+= $(NEON-OBJS)$(NEON-OBJS-yes)
 
diff --git a/configure b/configure
index fdd6c2f..4d005f1 100755
--- a/configure
+++ b/configure
@@ -1271,6 +1271,7 @@ ARCH_EXT_LIST_ARM=
 armv5te
 armv6
 armv6t2
+armv8
 neon
 vfp
 vfpv3
@@ -1615,6 +1616,7 @@ CMDLINE_APPEND=
 armv5te_deps=arm
 armv6_deps=arm
 armv6t2_deps=arm
+armv8_deps=aarch64
 neon_deps_any=aarch64 arm
 vfp_deps_any=aarch64 arm
 vfpv3_deps=vfp
@@ -3697,6 +3699,7 @@ od -t x1 $TMPO | grep -q '42 *49 *47 *45'  enable 
bigendian
 check_inline_asm inline_asm_labels '1:\n'
 
 if enabled aarch64; then
+enabled armv8  check_insn armv8 'prfm   pldl1strm, [x0]'
 # internal assembler in clang 3.3 does not support this instruction
 enabled neon  check_insn neon 'ext   v0.8B, v0.8B, v1.8B, #1'
 enabled vfp   check_insn vfp  'fmadd d0,d0,d1,d2'
diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c
index 2cc2ccd..37a7d8d 100644
--- a/libavutil/aarch64/cpu.c
+++ b/libavutil/aarch64/cpu.c
@@ -22,6 +22,7 @@
 
 int ff_get_cpu_flags_aarch64(void)
 {
-return AV_CPU_FLAG_NEON * HAVE_NEON |
-   AV_CPU_FLAG_VFP  * HAVE_VFP;
+return AV_CPU_FLAG_ARMV8 * HAVE_ARMV8 |
+   AV_CPU_FLAG_NEON  * HAVE_NEON  |
+   AV_CPU_FLAG_VFP   * HAVE_VFP;
 }
diff --git a/libavutil/aarch64/cpu.h b/libavutil/aarch64/cpu.h
index 704df48..f5b1d89 100644
--- a/libavutil/aarch64/cpu.h
+++ b/libavutil/aarch64/cpu.h
@@ -23,6 +23,7 @@
 #include libavutil/cpu.h
 #include libavutil/cpu_internal.h
 
+#define have_armv8(flags) CPUEXT(flags, ARMV8)
 #define have_neon(flags) CPUEXT(flags, NEON)
 #define have_vfp(flags)  CPUEXT(flags, VFP)
 
diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index d651eb2..e755d15 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -126,6 +126,7 @@ int av_parse_cpu_flags(const char *s)
 { vfpv3,NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFPV3   
 },.unit = flags },
 { neon, NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON
 },.unit = flags },
 #elif ARCH_AARCH64
+{ armv8,NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV8   
 },.unit = flags },
 { neon, NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON
 },.unit = flags },
 { vfp,  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP 
 },.unit = flags },
 #endif
@@ -185,6 +186,7 @@ static const struct {
 const char *name;
 } cpu_flag_tab[] = {
 #if   ARCH_AARCH64
+{ AV_CPU_FLAG_ARMV8, armv8  },
 { AV_CPU_FLAG_NEON,  neon   },
 { AV_CPU_FLAG_VFP,   vfp},
 #elif ARCH_ARM
diff --git a/libavutil/cpu.h b/libavutil/cpu.h
index 517c520..7ce 100644
--- a/libavutil/cpu.h
+++ b/libavutil/cpu.h
@@ -61,6 +61,7 @@
 #define AV_CPU_FLAG_VFP  (1  3)
 #define AV_CPU_FLAG_VFPV3(1  4)
 #define AV_CPU_FLAG_NEON (1  5)
+#define AV_CPU_FLAG_ARMV8(1  6)
 
 /**
  * Return the flags which specify extensions supported by the CPU.
-- 
1.9.1

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


Re: [libav-devel] [PATCH v2 1/2] aarch64: add armv8 CPU flag

2014-04-05 Thread Diego Biurrun
On Sat, Apr 05, 2014 at 06:17:56PM +0200, Janne Grunau wrote:
 From: Janne Grunau j...@jannau.net
 
 ---
  Makefile| 2 +-
  arch.mak| 1 +
  configure   | 3 +++
  libavutil/aarch64/cpu.c | 5 +++--
  libavutil/aarch64/cpu.h | 1 +
  libavutil/cpu.c | 2 ++
  libavutil/cpu.h | 1 +
  7 files changed, 12 insertions(+), 3 deletions(-)

LGTM

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


[libav-devel] [PATCH] x86/synth_filter: remove the fma3 version ifdefs

2014-04-05 Thread James Almer
This fixes compilation failures with --disable-fma3

Signed-off-by: James Almer jamr...@gmail.com
---
See https://fate.libav.org/x86_32-linux-suncc-nosse/20140405142549

 libavcodec/x86/dcadsp.asm| 2 --
 libavcodec/x86/dcadsp_init.c | 2 --
 2 files changed, 4 deletions(-)

diff --git a/libavcodec/x86/dcadsp.asm b/libavcodec/x86/dcadsp.asm
index 59d96bf..c42ee23 100644
--- a/libavcodec/x86/dcadsp.asm
+++ b/libavcodec/x86/dcadsp.asm
@@ -418,7 +418,5 @@ INIT_XMM sse2
 SYNTH_FILTER
 INIT_YMM avx
 SYNTH_FILTER
-%if HAVE_FMA3_EXTERNAL
 INIT_YMM fma3
 SYNTH_FILTER
-%endif
diff --git a/libavcodec/x86/dcadsp_init.c b/libavcodec/x86/dcadsp_init.c
index beef288..9acb818 100644
--- a/libavcodec/x86/dcadsp_init.c
+++ b/libavcodec/x86/dcadsp_init.c
@@ -82,9 +82,7 @@ SYNTH_FILTER_FUNC(sse)
 #endif
 SYNTH_FILTER_FUNC(sse2)
 SYNTH_FILTER_FUNC(avx)
-#if HAVE_FMA3_EXTERNAL
 SYNTH_FILTER_FUNC(fma3)
-#endif
 #endif /* HAVE_YASM */
 
 av_cold void ff_synth_filter_init_x86(SynthFilterContext *s)
-- 
1.8.3.2

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


[libav-devel] [PATCH v2] nutdec: Check malloc calls()

2014-04-05 Thread Nidhi Makhijani
---
 libavformat/nutdec.c | 25 +
 1 file changed, 21 insertions(+), 4 deletions(-)

used av_freep() to avoid memory leakage

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 6328549..33a1fc3 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -230,7 +230,8 @@ static int decode_main_header(NUTContext *nut)
 
 GET_V(nut-time_base_count, tmp  0  tmp  INT_MAX / sizeof(AVRational));
 nut-time_base = av_malloc(nut-time_base_count * sizeof(AVRational));
-
+if (!nut-time_base)
+return AVERROR(ENOMEM);
 for (i = 0; i  nut-time_base_count; i++) {
 GET_V(nut-time_base[i].num, tmp  0  tmp  (1ULL  31));
 GET_V(nut-time_base[i].den, tmp  0  tmp  (1ULL  31));
@@ -312,8 +313,10 @@ static int decode_main_header(NUTContext *nut)
 return AVERROR_INVALIDDATA;
 }
 hdr = av_malloc(nut-header_len[i]);
-if (!hdr)
+if (!hdr) {
+av_freep(nut-time_base);
 return AVERROR(ENOMEM);
+}
 avio_read(bc, hdr, nut-header_len[i]);
 nut-header[i] = hdr;
 }
@@ -326,6 +329,10 @@ static int decode_main_header(NUTContext *nut)
 }
 
 nut-stream = av_mallocz(sizeof(StreamContext) * stream_count);
+if (!nut-stream) {
+av_freep(nut-time_base);
+return AVERROR(ENOMEM);
+}
 for (i = 0; i  stream_count; i++)
 avformat_new_stream(s, NULL);
 
@@ -400,6 +407,10 @@ static int decode_stream_header(NUTContext *nut)
 if (st-codec-extradata_size) {
 st-codec-extradata = av_mallocz(st-codec-extradata_size +
   FF_INPUT_BUFFER_PADDING_SIZE);
+if (!st-codec-extradata) {
+av_freep(st);
+return AVERROR(ENOMEM);
+}
 avio_read(bc, st-codec-extradata, st-codec-extradata_size);
 }
 
@@ -585,7 +596,13 @@ static int find_and_decode_index(NUTContext *nut)
 ffio_read_varlen(bc); // max_pts
 GET_V(syncpoint_count, tmp  INT_MAX / 8  tmp  0);
 syncpoints   = av_malloc(sizeof(int64_t) *  syncpoint_count);
+if (!syncpoints)
+return AVERROR(ENOMEM);
 has_keyframe = av_malloc(sizeof(int8_t)  * (syncpoint_count + 1));
+if (!has_keyframe) {
+av_freep(syncpoints);
+return AVERROR(ENOMEM);
+}
 for (i = 0; i  syncpoint_count; i++) {
 syncpoints[i] = ffio_read_varlen(bc);
 if (syncpoints[i] = 0)
@@ -650,8 +667,8 @@ static int find_and_decode_index(NUTContext *nut)
 ret = 0;
 
 fail:
-av_free(syncpoints);
-av_free(has_keyframe);
+av_freep(syncpoints);
+av_freep(has_keyframe);
 return ret;
 }
 
-- 
1.8.3.2

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


Re: [libav-devel] [PATCH v2] nutdec: Check malloc calls()

2014-04-05 Thread Justin Ruggles
On 04/05/2014 01:11 PM, Nidhi Makhijani wrote:
 @@ -400,6 +407,10 @@ static int decode_stream_header(NUTContext *nut)
  if (st-codec-extradata_size) {
  st-codec-extradata = av_mallocz(st-codec-extradata_size +
FF_INPUT_BUFFER_PADDING_SIZE);
 +if (!st-codec-extradata) {
 +av_freep(st);
 +return AVERROR(ENOMEM);
 +}

'st' shouldn't be freed here. It is not allocated in this function.

As for the rest of the patch, av_freep() takes a pointer to a pointer.

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


[libav-devel] [PATCH 7/9] tiff: use a better name and enum values for PhotometricInterpretation

2014-04-05 Thread Justin Ruggles
Also add additional known values and log as missing features.
---
 libavcodec/tiff.c|   45 -
 libavcodec/tiff.h|   20 +++-
 libavcodec/tiffenc.c |   20 ++--
 3 files changed, 57 insertions(+), 28 deletions(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index e7f1866..67fb633 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -51,7 +51,7 @@ typedef struct TiffContext {
 int palette_is_set;
 int le;
 enum TiffCompr compr;
-int invert;
+enum TiffPhotometric photometric;
 int fax_opts;
 int predictor;
 int fill_order;
@@ -447,20 +447,31 @@ static int tiff_decode_tag(TiffContext *s)
 case TIFF_PREDICTOR:
 s-predictor = value;
 break;
-case TIFF_INVERT:
+case TIFF_PHOTOMETRIC:
 switch (value) {
-case 0:
-s-invert = 1;
-break;
-case 1:
-s-invert = 0;
-break;
-case 2:
-case 3:
+case TIFF_PHOTOMETRIC_WHITE_IS_ZERO:
+case TIFF_PHOTOMETRIC_BLACK_IS_ZERO:
+case TIFF_PHOTOMETRIC_RGB:
+case TIFF_PHOTOMETRIC_PALETTE:
+s-photometric = value;
 break;
+case TIFF_PHOTOMETRIC_ALPHA_MASK:
+case TIFF_PHOTOMETRIC_SEPARATED:
+case TIFF_PHOTOMETRIC_YCBCR:
+case TIFF_PHOTOMETRIC_CIE_LAB:
+case TIFF_PHOTOMETRIC_ICC_LAB:
+case TIFF_PHOTOMETRIC_ITU_LAB:
+case TIFF_PHOTOMETRIC_CFA:
+case TIFF_PHOTOMETRIC_LOG_L:
+case TIFF_PHOTOMETRIC_LOG_LUV:
+case TIFF_PHOTOMETRIC_LINEAR_RAW:
+avpriv_report_missing_feature(s-avctx,
+  PhotometricInterpretation 0x%04X,
+  value);
+return AVERROR_PATCHWELCOME;
 default:
-av_log(s-avctx, AV_LOG_ERROR, Color mode %d is not supported\n,
-   value);
+av_log(s-avctx, AV_LOG_ERROR, PhotometricInterpretation %d is 
+   unknown\n, value);
 return AVERROR_INVALIDDATA;
 }
 break;
@@ -546,10 +557,10 @@ static int decode_frame(AVCodecContext *avctx,
 av_log(avctx, AV_LOG_ERROR, TIFF header not found\n);
 return AVERROR_INVALIDDATA;
 }
-s-le = le;
-s-invert = 0;
-s-compr  = TIFF_RAW;
-s-fill_order = 0;
+s-le  = le;
+s-photometric = TIFF_PHOTOMETRIC_NONE;
+s-compr   = TIFF_RAW;
+s-fill_order  = 0;
 // As TIFF 6.0 specification puts it An arbitrary but carefully chosen 
number
 // that further identifies the file as a TIFF file
 if (tget_short(s-gb, le) != 42) {
@@ -633,7 +644,7 @@ static int decode_frame(AVCodecContext *avctx,
 }
 }
 
-if (s-invert) {
+if (s-photometric == TIFF_PHOTOMETRIC_WHITE_IS_ZERO) {
 dst = p-data[0];
 for (i = 0; i  s-height; i++) {
 for (j = 0; j  p-linesize[0]; j++)
diff --git a/libavcodec/tiff.h b/libavcodec/tiff.h
index 9052d2f..8a3f7f7 100644
--- a/libavcodec/tiff.h
+++ b/libavcodec/tiff.h
@@ -37,7 +37,7 @@ enum TiffTags {
 TIFF_HEIGHT,
 TIFF_BPP,
 TIFF_COMPR,
-TIFF_INVERT = 0x106,
+TIFF_PHOTOMETRIC= 0x106,
 TIFF_FILL_ORDER = 0x10A,
 TIFF_STRIP_OFFS = 0x111,
 TIFF_SAMPLES_PER_PIXEL  = 0x115,
@@ -82,6 +82,24 @@ enum TiffTypes {
 TIFF_RATIONAL,
 };
 
+enum TiffPhotometric {
+TIFF_PHOTOMETRIC_NONE   = -1,
+TIFF_PHOTOMETRIC_WHITE_IS_ZERO,  /* mono or grayscale, 0 is white */
+TIFF_PHOTOMETRIC_BLACK_IS_ZERO,  /* mono or grayscale, 0 is black */
+TIFF_PHOTOMETRIC_RGB,/* RGB or RGBA*/
+TIFF_PHOTOMETRIC_PALETTE,/* Uses a palette */
+TIFF_PHOTOMETRIC_ALPHA_MASK, /* Transparency mask */
+TIFF_PHOTOMETRIC_SEPARATED,  /* CMYK or some other ink set */
+TIFF_PHOTOMETRIC_YCBCR,  /* YCbCr */
+TIFF_PHOTOMETRIC_CIE_LAB= 8, /* 1976 CIE L*a*b* */
+TIFF_PHOTOMETRIC_ICC_LAB,/* ICC L*a*b* */
+TIFF_PHOTOMETRIC_ITU_LAB,/* ITU L*a*b* */
+TIFF_PHOTOMETRIC_CFA= 32803, /* Color Filter Array (DNG) */
+TIFF_PHOTOMETRIC_LOG_L  = 32844, /* CIE Log2(L) */
+TIFF_PHOTOMETRIC_LOG_LUV,/* CIE Log L*u*v* */
+TIFF_PHOTOMETRIC_LINEAR_RAW = 34892, /* Linear Raw (DNG) */
+};
+
 /** sizes of various TIFF field types (string size = 100)*/
 static const uint8_t type_sizes[6] = {
 0, 1, 100, 2, 4, 8
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index f12e0f4..ccfb07c 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -56,7 +56,7 @@ typedef struct TiffEncoderContext {
 unsigned int bpp;   /// bits per pixel
 int compr;  /// compression level
 int bpp_tab_size;   /// bpp_tab 

[libav-devel] [PATCH 1/2] swscale: fix some implementation-defined signed-to-unsigned conversions

2014-04-05 Thread Justin Ruggles
Partially based on a patch by Michael Niedermayer michae...@gmx.at
---
 libswscale/swscale_unscaled.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 3a956f4..9e50d48 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -1187,9 +1187,9 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
 
 if (usePal(c-srcFormat)) {
 for (i = 0; i  256; i++) {
-int p, r, g, b, y, u, v;
+int r, g, b, y, u, v;
 if (c-srcFormat == AV_PIX_FMT_PAL8) {
-p = ((const uint32_t *)(srcSlice[1]))[i];
+uint32_t p = ((const uint32_t *)(srcSlice[1]))[i];
 r = (p  16)  0xFF;
 g = (p   8)  0xFF;
 b =  p 0xFF;
@@ -1230,13 +1230,13 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
 #if HAVE_BIGENDIAN
 case AV_PIX_FMT_BGR24:
 #endif
-c-pal_rgb[i] = (r + (g  8) + (b  16))  8;
+c-pal_rgb[i] = (r  8) + (g  16) + ((unsigned)b  24);
 break;
 case AV_PIX_FMT_RGB32_1:
 #if HAVE_BIGENDIAN
 case AV_PIX_FMT_RGB24:
 #endif
-c-pal_rgb[i] = (b + (g  8) + (r  16))  8;
+c-pal_rgb[i] = (b  8) + (g  16) + ((unsigned)r  24);
 break;
 case AV_PIX_FMT_RGB32:
 #if !HAVE_BIGENDIAN
-- 
1.7.1

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


[libav-devel] [PATCH 2/2] swscale: Set alpha to opaque for internal palettes.

2014-04-05 Thread Justin Ruggles
Fixes conversion of pal8 to rgb formats with alpha.

Based on a patch by Baptiste Coudurier baptiste.coudur...@gmail.com
---
 libswscale/swscale_unscaled.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 9e50d48..da1bde1 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -1217,33 +1217,33 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
 y = av_clip_uint8((RY * r + GY * g + BY * b + ( 33  
(RGB2YUV_SHIFT - 1)))  RGB2YUV_SHIFT);
 u = av_clip_uint8((RU * r + GU * g + BU * b + (257  
(RGB2YUV_SHIFT - 1)))  RGB2YUV_SHIFT);
 v = av_clip_uint8((RV * r + GV * g + BV * b + (257  
(RGB2YUV_SHIFT - 1)))  RGB2YUV_SHIFT);
-c-pal_yuv[i] = y + (u  8) + (v  16);
+c-pal_yuv[i] = y + (u  8) + (v  16) + (0xFFU  24);
 
 switch (c-dstFormat) {
 case AV_PIX_FMT_BGR32:
 #if !HAVE_BIGENDIAN
 case AV_PIX_FMT_RGB24:
 #endif
-c-pal_rgb[i] =  r + (g  8) + (b  16);
+c-pal_rgb[i] =  r + (g  8) + (b  16) + (0xFFU  24);
 break;
 case AV_PIX_FMT_BGR32_1:
 #if HAVE_BIGENDIAN
 case AV_PIX_FMT_BGR24:
 #endif
-c-pal_rgb[i] = (r  8) + (g  16) + ((unsigned)b  24);
+c-pal_rgb[i] = 0xFF + (r  8) + (g  16) + ((unsigned)b  
24);
 break;
 case AV_PIX_FMT_RGB32_1:
 #if HAVE_BIGENDIAN
 case AV_PIX_FMT_RGB24:
 #endif
-c-pal_rgb[i] = (b  8) + (g  16) + ((unsigned)r  24);
+c-pal_rgb[i] = 0xFF + (b  8) + (g  16) + ((unsigned)r  
24);
 break;
 case AV_PIX_FMT_RGB32:
 #if !HAVE_BIGENDIAN
 case AV_PIX_FMT_BGR24:
 #endif
 default:
-c-pal_rgb[i] =  b + (g  8) + (r  16);
+c-pal_rgb[i] =  b + (g  8) + (r  16) + (0xFFU  24);
 }
 }
 }
-- 
1.7.1

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


Re: [libav-devel] [PATCH 1/2] swscale: fix some implementation-defined signed-to-unsigned conversions

2014-04-05 Thread Justin Ruggles
Sorry, these are actually 2 separate issues that need different
descriptions. I'll revise and send 2 patches with appropriate commit
messages.

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


[libav-devel] [PATCH 3/3] swscale: Set alpha to opaque for internal palettes.

2014-04-05 Thread Justin Ruggles
Fixes conversion of pal8 to rgb formats with alpha.

Based on a patch by Baptiste Coudurier baptiste.coudur...@gmail.com
---
 libswscale/swscale_unscaled.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 9e50d48..da1bde1 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -1217,33 +1217,33 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
 y = av_clip_uint8((RY * r + GY * g + BY * b + ( 33  
(RGB2YUV_SHIFT - 1)))  RGB2YUV_SHIFT);
 u = av_clip_uint8((RU * r + GU * g + BU * b + (257  
(RGB2YUV_SHIFT - 1)))  RGB2YUV_SHIFT);
 v = av_clip_uint8((RV * r + GV * g + BV * b + (257  
(RGB2YUV_SHIFT - 1)))  RGB2YUV_SHIFT);
-c-pal_yuv[i] = y + (u  8) + (v  16);
+c-pal_yuv[i] = y + (u  8) + (v  16) + (0xFFU  24);
 
 switch (c-dstFormat) {
 case AV_PIX_FMT_BGR32:
 #if !HAVE_BIGENDIAN
 case AV_PIX_FMT_RGB24:
 #endif
-c-pal_rgb[i] =  r + (g  8) + (b  16);
+c-pal_rgb[i] =  r + (g  8) + (b  16) + (0xFFU  24);
 break;
 case AV_PIX_FMT_BGR32_1:
 #if HAVE_BIGENDIAN
 case AV_PIX_FMT_BGR24:
 #endif
-c-pal_rgb[i] = (r  8) + (g  16) + ((unsigned)b  24);
+c-pal_rgb[i] = 0xFF + (r  8) + (g  16) + ((unsigned)b  
24);
 break;
 case AV_PIX_FMT_RGB32_1:
 #if HAVE_BIGENDIAN
 case AV_PIX_FMT_RGB24:
 #endif
-c-pal_rgb[i] = (b  8) + (g  16) + ((unsigned)r  24);
+c-pal_rgb[i] = 0xFF + (b  8) + (g  16) + ((unsigned)r  
24);
 break;
 case AV_PIX_FMT_RGB32:
 #if !HAVE_BIGENDIAN
 case AV_PIX_FMT_BGR24:
 #endif
 default:
-c-pal_rgb[i] =  b + (g  8) + (r  16);
+c-pal_rgb[i] =  b + (g  8) + (r  16) + (0xFFU  24);
 }
 }
 }
-- 
1.7.1

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


[libav-devel] [PATCH 1/3] swscale: fix an implementation-defined unsigned-to-signed conversion

2014-04-05 Thread Justin Ruggles
---
 libswscale/swscale_unscaled.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 3a956f4..daa6f5f 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -1187,9 +1187,9 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
 
 if (usePal(c-srcFormat)) {
 for (i = 0; i  256; i++) {
-int p, r, g, b, y, u, v;
+int r, g, b, y, u, v;
 if (c-srcFormat == AV_PIX_FMT_PAL8) {
-p = ((const uint32_t *)(srcSlice[1]))[i];
+uint32_t p = ((const uint32_t *)(srcSlice[1]))[i];
 r = (p  16)  0xFF;
 g = (p   8)  0xFF;
 b =  p 0xFF;
-- 
1.7.1

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


[libav-devel] [PATCH 2/3] swscale: fix some undefined signed left shifts

2014-04-05 Thread Justin Ruggles
Based on a patch by Michael Niedermayer michae...@gmx.at
---
 libswscale/swscale_unscaled.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index daa6f5f..9e50d48 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -1230,13 +1230,13 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
 #if HAVE_BIGENDIAN
 case AV_PIX_FMT_BGR24:
 #endif
-c-pal_rgb[i] = (r + (g  8) + (b  16))  8;
+c-pal_rgb[i] = (r  8) + (g  16) + ((unsigned)b  24);
 break;
 case AV_PIX_FMT_RGB32_1:
 #if HAVE_BIGENDIAN
 case AV_PIX_FMT_RGB24:
 #endif
-c-pal_rgb[i] = (b + (g  8) + (r  16))  8;
+c-pal_rgb[i] = (b  8) + (g  16) + ((unsigned)r  24);
 break;
 case AV_PIX_FMT_RGB32:
 #if !HAVE_BIGENDIAN
-- 
1.7.1

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


Re: [libav-devel] [PATCH 1/3] swscale: fix an implementation-defined unsigned-to-signed conversion

2014-04-05 Thread Luca Barbato
On 05/04/14 20:48, Justin Ruggles wrote:
 ---
  libswscale/swscale_unscaled.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 

The set looks fine.

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


Re: [libav-devel] [PATCH 7/9] tiff: use a better name and enum values for PhotometricInterpretation

2014-04-05 Thread Luca Barbato
On 05/04/14 20:35, Justin Ruggles wrote:
 Also add additional known values and log as missing features.
 ---
  libavcodec/tiff.c|   45 -
  libavcodec/tiff.h|   20 +++-
  libavcodec/tiffenc.c |   20 ++--
  3 files changed, 57 insertions(+), 28 deletions(-)
 

Seems fine.

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


Re: [libav-devel] [PATCH 7/9] tiff: use a better name and enum values for PhotometricInterpretation

2014-04-05 Thread Diego Biurrun
On Sat, Apr 05, 2014 at 02:35:44PM -0400, Justin Ruggles wrote:
 --- a/libavcodec/tiff.c
 +++ b/libavcodec/tiff.c
 @@ -447,20 +447,31 @@ static int tiff_decode_tag(TiffContext *s)
  default:
 -av_log(s-avctx, AV_LOG_ERROR, Color mode %d is not 
 supported\n,
 -   value);
 +av_log(s-avctx, AV_LOG_ERROR, PhotometricInterpretation %d is 
 +   unknown\n, value);

value is unsigned, so change to %u while you're at it.

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


Re: [libav-devel] [PATCH v2] Documentation: Libavfilter English cleanup

2014-04-05 Thread Diego Biurrun
On Fri, Apr 04, 2014 at 05:30:50PM +0200, Katerina Barone-Adesi wrote:
 --- a/doc/filters.texi
 +++ b/doc/filters.texi
 @@ -495,24 +490,25 @@ may be overridden (by @code{0/out-dBn}). Typical values 
 for the transfer
  function are @code{-70/-70|-60/-20}.
  
  @item soft-knee
 -Set the curve radius in dB for all joints. Defaults to 0.01.
 +Set the curve radius in dB for all joints (defaults: 0.01).

default_

 @@ -1655,22 +1652,22 @@ alpha component (if available). The default value in 
 input is 0.
  
  @item pix_fmts
 -A '|'-separated list of pixel format names, for example
 -pix_fmts=yuv420p|monow|rgb24.
 +A '|'-separated list of pixel format names, ch as
 +apix_fmts=yuv420p|monow|rgb24.

Something got mangled here.

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


Re: [libav-devel] [PATCH] x86/synth_filter: remove the fma3 version ifdefs

2014-04-05 Thread Diego Biurrun
On Sat, Apr 05, 2014 at 02:00:53PM -0300, James Almer wrote:
 This fixes compilation failures with --disable-fma3
 
 Signed-off-by: James Almer jamr...@gmail.com
 ---
 See https://fate.libav.org/x86_32-linux-suncc-nosse/20140405142549
 
  libavcodec/x86/dcadsp.asm| 2 --
  libavcodec/x86/dcadsp_init.c | 2 --
  2 files changed, 4 deletions(-)

Hmm, I cannot reproduce this with gcc ...

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


Re: [libav-devel] [PATCH] x86/synth_filter: remove the fma3 version ifdefs

2014-04-05 Thread James Almer
On 05/04/14 5:20 PM, Diego Biurrun wrote:
 On Sat, Apr 05, 2014 at 02:00:53PM -0300, James Almer wrote:
 This fixes compilation failures with --disable-fma3

 Signed-off-by: James Almer jamr...@gmail.com
 ---
 See https://fate.libav.org/x86_32-linux-suncc-nosse/20140405142549

  libavcodec/x86/dcadsp.asm| 2 --
  libavcodec/x86/dcadsp_init.c | 2 --
  2 files changed, 4 deletions(-)
 
 Hmm, I cannot reproduce this with gcc ...
 
 Diego

I can reproduce it with mingw-w64 4.8.2, configuring with --disable-fma3 
then running make libavcodec/x86/dcadsp_init.o.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel