Re: [FFmpeg-devel] [PATCH] avformat: Fix bug in parse_rps for HEVC.

2015-06-11 Thread deliang Fu
2015-06-11 8:42 GMT+08:00 Michael Niedermayer michae...@gmx.at:

 On Wed, Jun 10, 2015 at 12:30:46PM +0800, Deliang Fu wrote:
  Make the logic in libavformat/hevc.c parse_rps align with
 libavcodec/hevc_ps.c ff_hevc_decode_short_term_rps
 
  ---
   libavformat/hevc.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

 applied

 iam still interrested in a testcase if you have one

 thanks

 [...]
 --
 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

 There will always be a question for which you do not know the correct
 answer.

 ___
 ffmpeg-devel mailing list
 ffmpeg-devel@ffmpeg.org
 http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

 Hi Michael,

Sorry but I don't have a testcase.
The previous code will cause infinite loop when rps syntax are used in the
input HEVC video while executing code like:
ffmpeg -i input.265 -vcodec copy out.mp4
Transcoding to other encoding were all good because the code in
libavcodec/hevc_ps.c is correct.

BRs,
Deliang
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/mips: Add 'const' to static arrays in HEVC MSA code

2015-06-11 Thread shivraj.patil
From: Shivraj Patil shivraj.pa...@imgtec.com

Signed-off-by: Shivraj Patil shivraj.pa...@imgtec.com
---
 libavcodec/mips/hevc_idct_msa.c   | 12 ++--
 libavcodec/mips/hevc_mc_uni_msa.c |  2 +-
 libavcodec/mips/hevcpred_msa.c|  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavcodec/mips/hevc_idct_msa.c b/libavcodec/mips/hevc_idct_msa.c
index b5a4c5a..975d91f 100644
--- a/libavcodec/mips/hevc_idct_msa.c
+++ b/libavcodec/mips/hevc_idct_msa.c
@@ -21,18 +21,18 @@
 #include libavutil/mips/generic_macros_msa.h
 #include libavcodec/mips/hevcdsp_mips.h
 
-static int16_t gt8x8_cnst[16] = {
+static const int16_t gt8x8_cnst[16] = {
 64, 64, 83, 36, 89, 50, 18, 75, 64, -64, 36, -83, 75, -89, -50, -18
 };
 
-static int16_t gt16x16_cnst[64] = {
+static const int16_t gt16x16_cnst[64] = {
 64, 83, 64, 36, 89, 75, 50, 18, 90, 80, 57, 25, 70, 87, 9, 43,
 64, 36, -64, -83, 75, -18, -89, -50, 87, 9, -80, -70, -43, 57, -25, -90,
 64, -36, -64, 83, 50, -89, 18, 75, 80, -70, -25, 90, -87, 9, 43, 57,
 64, -83, 64, -36, 18, -50, 75, -89, 70, -87, 90, -80, 9, -43, -57, 25
 };
 
-static int16_t gt32x32_cnst0[256] = {
+static const int16_t gt32x32_cnst0[256] = {
 90, 90, 88, 85, 82, 78, 73, 67, 61, 54, 46, 38, 31, 22, 13, 4,
 90, 82, 67, 46, 22, -4, -31, -54, -73, -85, -90, -88, -78, -61, -38, -13,
 88, 67, 31, -13, -54, -82, -90, -78, -46, -4, 38, 73, 90, 85, 61, 22,
@@ -51,18 +51,18 @@ static int16_t gt32x32_cnst0[256] = {
 4, -13, 22, -31, 38, -46, 54, -61, 67, -73, 78, -82, 85, -88, 90, -90
 };
 
-static int16_t gt32x32_cnst1[64] = {
+static const int16_t gt32x32_cnst1[64] = {
 90, 87, 80, 70, 57, 43, 25, 9, 87, 57, 9, -43, -80, -90, -70, -25,
 80, 9, -70, -87, -25, 57, 90, 43, 70, -43, -87, 9, 90, 25, -80, -57,
 57, -80, -25, 90, -9, -87, 43, 70, 43, -90, 57, 25, -87, 70, 9, -80,
 25, -70, 90, -80, 43, 9, -57, 87, 9, -25, 43, -57, 70, -80, 87, -90
 };
 
-static int16_t gt32x32_cnst2[16] = {
+static const int16_t gt32x32_cnst2[16] = {
 89, 75, 50, 18, 75, -18, -89, -50, 50, -89, 18, 75, 18, -50, 75, -89
 };
 
-static int16_t gt32x32_cnst3[16] = {
+static const int16_t gt32x32_cnst3[16] = {
 64, 64, 64, 64, 83, 36, -36, -83, 64, -64, -64, 64, 36, -83, 83, -36
 };
 
diff --git a/libavcodec/mips/hevc_mc_uni_msa.c 
b/libavcodec/mips/hevc_mc_uni_msa.c
index 7d02ce8..61a67c9 100644
--- a/libavcodec/mips/hevc_mc_uni_msa.c
+++ b/libavcodec/mips/hevc_mc_uni_msa.c
@@ -249,7 +249,7 @@ static void copy_width64_msa(uint8_t *src, int32_t 
src_stride,
 copy_16multx8mult_msa(src, src_stride, dst, dst_stride, height, 64);
 }
 
-uint8_t mc_filt_mask_arr[16 * 3] = {
+static const uint8_t mc_filt_mask_arr[16 * 3] = {
 /* 8 width cases */
 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8,
 /* 4 width cases */
diff --git a/libavcodec/mips/hevcpred_msa.c b/libavcodec/mips/hevcpred_msa.c
index 8a8aa96..5d9299f 100644
--- a/libavcodec/mips/hevcpred_msa.c
+++ b/libavcodec/mips/hevcpred_msa.c
@@ -22,11 +22,11 @@
 #include libavutil/mips/generic_macros_msa.h
 #include hevcpred_mips.h
 
-static int8_t intra_pred_angle_up[17] = {
+static const int8_t intra_pred_angle_up[17] = {
 -32, -26, -21, -17, -13, -9, -5, -2, 0, 2, 5, 9, 13, 17, 21, 26, 32
 };
 
-static int8_t intra_pred_angle_low[16] = {
+static const int8_t intra_pred_angle_low[16] = {
 32, 26, 21, 17, 13, 9, 5, 2, 0, -2, -5, -9, -13, -17, -21, -26
 };
 
-- 
2.3.7

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/mips: Add 'const' to static arrays in HEVC MSA code

2015-06-11 Thread Michael Niedermayer
On Thu, Jun 11, 2015 at 02:07:50PM +0530, shivraj.pa...@imgtec.com wrote:
 From: Shivraj Patil shivraj.pa...@imgtec.com
 
 Signed-off-by: Shivraj Patil shivraj.pa...@imgtec.com
 ---
  libavcodec/mips/hevc_idct_msa.c   | 12 ++--
  libavcodec/mips/hevc_mc_uni_msa.c |  2 +-
  libavcodec/mips/hevcpred_msa.c|  4 ++--
  3 files changed, 9 insertions(+), 9 deletions(-)

applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/aiffdec: avoid double and ldexp()

2015-06-11 Thread Michael Niedermayer
On Sun, Jun 07, 2015 at 09:29:20PM -0700, Mark Harris wrote:
  -sample_rate = ldexp(val, exp - 16383 - 63);
  +if (exp = 0)
  +sample_rate = val  exp;
  +else
  +sample_rate = (val + (1(-exp/2)))  -exp;
 
 To round the value it should probably be something like:
 sample_rate = (val + ((uint64_t)1(-exp-1)))  -exp;
 
 To avoid possible undefined behavior it would also need to check that
 exp is within range.

changed

applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] Encoding of styles - Bold, Italic, Underlined for timed-text subttiles

2015-06-11 Thread Carl Eugen Hoyos
Niklesh Lalwani niklesh.lalwani at iitb.ac.in writes:

 Tested on QuickTime 10.3 on OSX

Did you also test on an iPhone or iPad?

Carl Eugen

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/4] avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for AVC chroma mc functions

2015-06-11 Thread Michael Niedermayer
On Thu, Jun 11, 2015 at 11:27:01AM +0530, shivraj.pa...@imgtec.com wrote:
 From: Shivraj Patil shivraj.pa...@imgtec.com
 
 Added const.
 Will do same for MIPS MSA hevc code in next patch.
 
 Signed-off-by: Shivraj Patil shivraj.pa...@imgtec.com
 ---
  libavcodec/mips/Makefile   |1 +
  libavcodec/mips/h264chroma_init_mips.c |   21 +
  libavcodec/mips/h264chroma_mips.h  |   12 +
  libavcodec/mips/h264chroma_msa.c   | 2003 
 
  libavutil/mips/generic_macros_msa.h|   56 +
  5 files changed, 2093 insertions(+)
  create mode 100644 libavcodec/mips/h264chroma_msa.c

applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 06/12] libavcodec: Implementation of AAC_fixed_decoder (SBR-module) [2/3]

2015-06-11 Thread Nedeljko Babic
From: Jovan Zelincevic jovan.zelince...@imgtec.com

Create tables for fixed point code.

Signed-off-by: Nedeljko Babic nedeljko.ba...@imgtec.com
---
 libavcodec/Makefile |   5 +-
 libavcodec/aacsbr_fixed_tablegen.c  |  40 +++
 libavcodec/aacsbr_fixed_tablegen.h  |  32 +++
 libavcodec/aacsbr_tablegen.c|   1 +
 libavcodec/aacsbr_tablegen.h| 101 +--
 libavcodec/aacsbr_tablegen_common.h | 129 +
 libavcodec/aacsbrdata.h | 522 ++--
 7 files changed, 469 insertions(+), 361 deletions(-)
 create mode 100644 libavcodec/aacsbr_fixed_tablegen.c
 create mode 100644 libavcodec/aacsbr_fixed_tablegen.h
 create mode 100644 libavcodec/aacsbr_tablegen_common.h

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 36d93ee..70e16e5 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -916,6 +916,7 @@ TOOLS = fourcc2pixfmt
 HOSTPROGS = aac_tablegen\
 aacps_tablegen  \
 aacsbr_tablegen \
+aacsbr_fixed_tablegen   \
 cabac_tablegen  \
 cbrt_tablegen   \
 cbrt_fixed_tablegen \
@@ -946,7 +947,8 @@ else
 $(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=0
 endif
 
-GEN_HEADERS = cabac_tables.h cbrt_tables.h cbrt_fixed_tables.h aacps_tables.h 
aacsbr_tables.h aac_tables.h dsd_tables.h dv_tables.h \
+GEN_HEADERS = cabac_tables.h cbrt_tables.h cbrt_fixed_tables.h aacps_tables.h 
aacsbr_tables.h \
+  aacsbr_fixed_tables.h aac_tables.h dsd_tables.h dv_tables.h \
   sinewin_tables.h sinewin_fixed_tables.h mpegaudio_tables.h 
motionpixels_tables.h \
   pcm_tables.h qdm2_tables.h
 GEN_HEADERS := $(addprefix $(SUBDIR), $(GEN_HEADERS))
@@ -959,6 +961,7 @@ $(SUBDIR)aacdec.o: $(SUBDIR)cbrt_tables.h
 $(SUBDIR)aacdec_fixed.o: $(SUBDIR)cbrt_fixed_tables.h
 $(SUBDIR)aacps.o: $(SUBDIR)aacps_tables.h
 $(SUBDIR)aacsbr.o: $(SUBDIR)aacsbr_tables.h
+$(SUBDIR)aacsbr_fixed.o: $(SUBDIR)aacsbr_fixed_tables.h
 $(SUBDIR)aactab.o: $(SUBDIR)aac_tables.h
 $(SUBDIR)aactab_fixed.o: $(SUBDIR)aac_fixed_tables.h
 $(SUBDIR)cabac.o: $(SUBDIR)cabac_tables.h
diff --git a/libavcodec/aacsbr_fixed_tablegen.c 
b/libavcodec/aacsbr_fixed_tablegen.c
new file mode 100644
index 000..7117dbd
--- /dev/null
+++ b/libavcodec/aacsbr_fixed_tablegen.c
@@ -0,0 +1,40 @@
+/*
+ * Header file for hardcoded AAC SBR windows
+ *
+ * Copyright (c) 2014 Reimar Döffinger reimar.doeffin...@gmx.de
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg 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.
+ *
+ * FFmpeg 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 FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include stdlib.h
+#define CONFIG_HARDCODED_TABLES 0
+#define USE_FIXED 1
+#include libavutil/common.h
+#include aacsbr_fixed_tablegen.h
+#include tableprint.h
+
+int main(void)
+{
+aacsbr_tableinit();
+
+write_fileheader();
+
+WRITE_ARRAY_ALIGNED(static const, 32, int32_t, sbr_qmf_window_ds);
+WRITE_ARRAY_ALIGNED(static const, 32, int32_t, sbr_qmf_window_us);
+
+return 0;
+}
diff --git a/libavcodec/aacsbr_fixed_tablegen.h 
b/libavcodec/aacsbr_fixed_tablegen.h
new file mode 100644
index 000..1439ebe
--- /dev/null
+++ b/libavcodec/aacsbr_fixed_tablegen.h
@@ -0,0 +1,32 @@
+/*
+ * Header file for hardcoded AAC SBR windows
+ *
+ * Copyright (c) 2014 Reimar Döffinger reimar.doeffin...@gmx.de
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg 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.
+ *
+ * FFmpeg 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 FFmpeg; if not, write to the Free Software
+ * Foundation, 

[FFmpeg-devel] [PATCH 10/12] libavcodec: Minor macro polishing

2015-06-11 Thread Nedeljko Babic
Use macros from aac_defines.h for adding suffixes
 instead of local macros.

Signed-off-by: Nedeljko Babic nedeljko.ba...@imgtec.com
---
 libavcodec/cbrt_tablegen.h |  5 ++---
 libavcodec/cbrt_tablegen_template.c|  2 +-
 libavcodec/sinewin.h   | 17 +
 libavcodec/sinewin_tablegen.h  | 21 +
 libavcodec/sinewin_tablegen_template.c | 14 --
 5 files changed, 21 insertions(+), 38 deletions(-)

diff --git a/libavcodec/cbrt_tablegen.h b/libavcodec/cbrt_tablegen.h
index 07ef392..27a3e3a 100644
--- a/libavcodec/cbrt_tablegen.h
+++ b/libavcodec/cbrt_tablegen.h
@@ -26,12 +26,11 @@
 #include stdint.h
 #include math.h
 #include libavutil/attributes.h
+#include libavcodec/aac_defines.h
 
 #if USE_FIXED
-#define CBRT_RENAME(a) a ## _fixed
 #define CBRT(x) (int)floor((x).f * 8192 + 0.5)
 #else
-#define CBRT_RENAME(a) a
 #define CBRT(x) x.i
 #endif
 
@@ -46,7 +45,7 @@
 #else
 static uint32_t cbrt_tab[1  13];
 
-static av_cold void CBRT_RENAME(cbrt_tableinit)(void)
+static av_cold void AAC_RENAME(cbrt_tableinit)(void)
 {
 if (!cbrt_tab[(113) - 1]) {
 int i;
diff --git a/libavcodec/cbrt_tablegen_template.c 
b/libavcodec/cbrt_tablegen_template.c
index a8c0495..9dd2cf5 100644
--- a/libavcodec/cbrt_tablegen_template.c
+++ b/libavcodec/cbrt_tablegen_template.c
@@ -27,7 +27,7 @@
 
 int main(void)
 {
-CBRT_RENAME(cbrt_tableinit)();
+AAC_RENAME(cbrt_tableinit)();
 
 write_fileheader();
 
diff --git a/libavcodec/sinewin.h b/libavcodec/sinewin.h
index 5f0a74a..27c107c 100644
--- a/libavcodec/sinewin.h
+++ b/libavcodec/sinewin.h
@@ -23,6 +23,7 @@
 
 #include config.h
 #include libavutil/mem.h
+#include libavcodec/aac_defines.h
 
 #if CONFIG_HARDCODED_TABLES
 #   define SINETABLE_CONST const
@@ -34,28 +35,20 @@
 #define USE_FIXED 0
 #endif
 
-#if USE_FIXED
-#define SINEWIN_SUFFIX(a) a ## _fixed
-#define INTFLOAT int
-#else
-#define SINEWIN_SUFFIX(a) a
-#define INTFLOAT float
-#endif
-
 #define SINETABLE(size) \
-SINETABLE_CONST DECLARE_ALIGNED(32, INTFLOAT, 
SINEWIN_SUFFIX(ff_sine_##size))[size]
+SINETABLE_CONST DECLARE_ALIGNED(32, INTFLOAT, 
AAC_RENAME(ff_sine_##size))[size]
 
 /**
  * Generate a sine window.
  * @param   window  pointer to half window
  * @param   n   size of half window
  */
-void SINEWIN_SUFFIX(ff_sine_window_init)(INTFLOAT *window, int n);
+void AAC_RENAME(ff_sine_window_init)(INTFLOAT *window, int n);
 
 /**
  * initialize the specified entry of ff_sine_windows
  */
-void SINEWIN_SUFFIX(ff_init_ff_sine_windows)(int index);
+void AAC_RENAME(ff_init_ff_sine_windows)(int index);
 
 extern SINETABLE(  32);
 extern SINETABLE(  64);
@@ -67,6 +60,6 @@ extern SINETABLE(2048);
 extern SINETABLE(4096);
 extern SINETABLE(8192);
 
-extern SINETABLE_CONST INTFLOAT * const SINEWIN_SUFFIX(ff_sine_windows)[14];
+extern SINETABLE_CONST INTFLOAT * const AAC_RENAME(ff_sine_windows)[14];
 
 #endif /* AVCODEC_SINEWIN_H */
diff --git a/libavcodec/sinewin_tablegen.h b/libavcodec/sinewin_tablegen.h
index e1623b4..4432135 100644
--- a/libavcodec/sinewin_tablegen.h
+++ b/libavcodec/sinewin_tablegen.h
@@ -27,6 +27,7 @@
 // do not use libavutil/libm.h since this is compiled both
 // for the host and the target and config.h is only valid for the target
 #include math.h
+#include libavcodec/aac_defines.h
 #include libavutil/attributes.h
 #include libavutil/common.h
 
@@ -49,33 +50,29 @@ SINETABLE(8192);
 #endif
 
 #if USE_FIXED
-#define SINEWIN_SUFFIX(a) a ## _fixed
-#define INTFLOAT int
 #define SIN_FIX(a) (int)floor((a) * 0x8000 + 0.5)
 #else
-#define SINEWIN_SUFFIX(a) a
-#define INTFLOAT float
 #define SIN_FIX(a) a
 #endif
 
-SINETABLE_CONST INTFLOAT * const SINEWIN_SUFFIX(ff_sine_windows)[] = {
+SINETABLE_CONST INTFLOAT * const AAC_RENAME(ff_sine_windows)[] = {
 NULL, NULL, NULL, NULL, NULL, // unused
-SINEWIN_SUFFIX(ff_sine_32) , SINEWIN_SUFFIX(ff_sine_64), 
SINEWIN_SUFFIX(ff_sine_128),
-SINEWIN_SUFFIX(ff_sine_256), SINEWIN_SUFFIX(ff_sine_512), 
SINEWIN_SUFFIX(ff_sine_1024),
-SINEWIN_SUFFIX(ff_sine_2048), SINEWIN_SUFFIX(ff_sine_4096), 
SINEWIN_SUFFIX(ff_sine_8192)
+AAC_RENAME(ff_sine_32) , AAC_RENAME(ff_sine_64), AAC_RENAME(ff_sine_128),
+AAC_RENAME(ff_sine_256), AAC_RENAME(ff_sine_512), AAC_RENAME(ff_sine_1024),
+AAC_RENAME(ff_sine_2048), AAC_RENAME(ff_sine_4096), 
AAC_RENAME(ff_sine_8192)
 };
 
 // Generate a sine window.
-av_cold void SINEWIN_SUFFIX(ff_sine_window_init)(INTFLOAT *window, int n) {
+av_cold void AAC_RENAME(ff_sine_window_init)(INTFLOAT *window, int n) {
 int i;
 for(i = 0; i  n; i++)
 window[i] = SIN_FIX(sinf((i + 0.5) * (M_PI / (2.0 * n;
 }
 
-av_cold void SINEWIN_SUFFIX(ff_init_ff_sine_windows)(int index) {
-assert(index = 0  index  
FF_ARRAY_ELEMS(SINEWIN_SUFFIX(ff_sine_windows)));
+av_cold void AAC_RENAME(ff_init_ff_sine_windows)(int index) {
+assert(index = 0  index  FF_ARRAY_ELEMS(AAC_RENAME(ff_sine_windows)));
 #if 

[FFmpeg-devel] [PATCH 02/12] libavcodec: Implementation of AAC_fixed_decoder (LC-module) [2/4]

2015-06-11 Thread Nedeljko Babic
From: Jovan Zelincevic jovan.zelince...@imgtec.com

Add fixed point implementation of functions for generating tables

Signed-off-by: Nedeljko Babic nedeljko.ba...@imgtec.com
---
 libavcodec/aac.h   |  23 ++
 libavcodec/aacdectab.h |  34 +--
 libavcodec/aactab.c| 486 +
 libavcodec/aactab.h|   4 +
 libavcodec/cbrt_fixed_tablegen.c   |  24 ++
 libavcodec/cbrt_tablegen.c |   3 +
 libavcodec/cbrt_tablegen.h |  17 +-
 libavcodec/cbrt_tablegen_template.c|   2 +-
 libavcodec/sinewin.c   |   1 +
 libavcodec/sinewin.h   |  20 +-
 libavcodec/sinewin_fixed.c |  21 ++
 libavcodec/sinewin_fixed_tablegen.c|  24 ++
 libavcodec/sinewin_tablegen.c  |   3 +
 libavcodec/sinewin_tablegen.h  |  31 ++-
 libavcodec/sinewin_tablegen_template.c |  20 +-
 libavcodec/tableprint.h|   2 +
 16 files changed, 680 insertions(+), 35 deletions(-)
 create mode 100644 libavcodec/cbrt_fixed_tablegen.c
 create mode 100644 libavcodec/sinewin_fixed.c
 create mode 100644 libavcodec/sinewin_fixed_tablegen.c

diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index 23ec085..5763970 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -30,6 +30,29 @@
 #ifndef AVCODEC_AAC_H
 #define AVCODEC_AAC_H
 
+#ifndef USE_FIXED
+#define USE_FIXED 0
+#endif
+
+#if USE_FIXED
+
+#include libavutil/softfloat.h
+
+#define FFT_FLOAT0
+#define FFT_FIXED_32 1
+
+#define Q30(x)  (int)((x)*1073741824.0 + 0.5)
+#define Q31(x)  (int)((x)*2147483648.0 + 0.5)
+
+#else
+
+#define FFT_FLOAT1
+#define FFT_FIXED_32 0
+
+#define Q30(x)  x
+#define Q31(x)  x
+#endif /* USE_FIXED */
+
 #include libavutil/float_dsp.h
 #include avcodec.h
 #include imdct15.h
diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h
index 3e70e06..62c7f87 100644
--- a/libavcodec/aacdectab.h
+++ b/libavcodec/aacdectab.h
@@ -38,9 +38,9 @@
 /* @name ltp_coef
  * Table of the LTP coefficients
  */
-static const float ltp_coef[8] = {
-0.570829, 0.696616, 0.813004, 0.911304,
-0.984900, 1.067894, 1.194601, 1.369533,
+static const INTFLOAT ltp_coef[8] = {
+Q30(0.570829f), Q30(0.696616f), Q30(0.813004f), Q30(0.911304f),
+Q30(0.984900f), Q30(1.067894f), Q30(1.194601f), Q30(1.369533f),
 };
 
 /* @name tns_tmp2_map
@@ -49,28 +49,28 @@ static const float ltp_coef[8] = {
  * respectively.
  * @{
  */
-static const float tns_tmp2_map_1_3[4] = {
- 0., -0.43388373,  0.64278758,  0.34202015,
+static const INTFLOAT tns_tmp2_map_1_3[4] = {
+ Q31(0.f), Q31(-0.43388373f),  Q31(0.64278758f),  Q31(0.34202015f),
 };
 
-static const float tns_tmp2_map_0_3[8] = {
- 0., -0.43388373, -0.78183150, -0.97492790,
- 0.98480773,  0.86602539,  0.64278758,  0.34202015,
+static const INTFLOAT tns_tmp2_map_0_3[8] = {
+ Q31(0.f), Q31(-0.43388373f), Q31(-0.78183150f), Q31(-0.97492790f),
+ Q31(0.98480773f), Q31( 0.86602539f), Q31( 0.64278758f), Q31( 0.34202015f),
 };
 
-static const float tns_tmp2_map_1_4[8] = {
- 0., -0.20791170, -0.40673664, -0.58778524,
- 0.67369562,  0.52643216,  0.36124167,  0.18374951,
+static const INTFLOAT tns_tmp2_map_1_4[8] = {
+ Q31(0.f), Q31(-0.20791170f), Q31(-0.40673664f), Q31(-0.58778524f),
+ Q31(0.67369562f), Q31( 0.52643216f), Q31( 0.36124167f), Q31( 0.18374951f),
 };
 
-static const float tns_tmp2_map_0_4[16] = {
- 0., -0.20791170, -0.40673664, -0.58778524,
--0.74314481, -0.86602539, -0.95105654, -0.99452192,
- 0.99573416,  0.96182561,  0.89516330,  0.79801720,
- 0.67369562,  0.52643216,  0.36124167,  0.18374951,
+static const INTFLOAT tns_tmp2_map_0_4[16] = {
+Q31( 0.f), Q31(-0.20791170f), Q31(-0.40673664f), Q31(-0.58778524f),
+Q31(-0.74314481f), Q31(-0.86602539f), Q31(-0.95105654f), Q31(-0.99452192f),
+Q31( 0.99573416f), Q31( 0.96182561f), Q31( 0.89516330f), Q31( 0.79801720f),
+Q31( 0.67369562f), Q31( 0.52643216f), Q31( 0.36124167f), Q31( 0.18374951f),
 };
 
-static const float * const tns_tmp2_map[4] = {
+static const INTFLOAT * const tns_tmp2_map[4] = {
 tns_tmp2_map_0_3,
 tns_tmp2_map_0_4,
 tns_tmp2_map_1_3,
diff --git a/libavcodec/aactab.c b/libavcodec/aactab.c
index 25f6de2..deb9d91 100644
--- a/libavcodec/aactab.c
+++ b/libavcodec/aactab.c
@@ -35,6 +35,8 @@
 
 DECLARE_ALIGNED(32, float,  ff_aac_kbd_long_1024)[1024];
 DECLARE_ALIGNED(32, float,  ff_aac_kbd_short_128)[128];
+DECLARE_ALIGNED(32, int,ff_aac_kbd_long_1024_fixed)[1024];
+DECLARE_ALIGNED(32, int,ff_aac_kbd_short_128_fixed)[128];
 
 const uint8_t ff_aac_num_swb_1024[] = {
 41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40, 40
@@ -1767,6 +1769,490 @@ const DECLARE_ALIGNED(32, float, 
ff_aac_eld_window_512)[1920] = {
 -0.0044, -0.00109764, -0.00108377, -0.00106989,
 };
 
+/* Q30 

[FFmpeg-devel] Rebased implementation of fixed point AAC decoder

2015-06-11 Thread Nedeljko Babic
The patch set is rebased to the newest version.

Please have a look.

Thanks,
-Nedeljko
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 03/12] libavcodec: Implementation of AAC_fixed_decoder (LC-module) [3/4]

2015-06-11 Thread Nedeljko Babic
From: Djordje Pesut djordje.pe...@imgtec.com

Add fixed point implementation

Signed-off-by: Nedeljko Babic nedeljko.ba...@imgtec.com
---
 libavcodec/aac.h |  80 ++--
 libavcodec/aacdec.c  |   5 +
 libavcodec/aacdec_fixed.c| 444 +++
 libavcodec/aacdec_template.c | 419 
 libavcodec/mdct_template.c   |   5 +
 5 files changed, 807 insertions(+), 146 deletions(-)
 create mode 100644 libavcodec/aacdec_fixed.c

diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index 5763970..b3b637c 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -41,21 +41,53 @@
 #define FFT_FLOAT0
 #define FFT_FIXED_32 1
 
+#define AAC_RENAME(x)   x ## _fixed
+#define AAC_RENAME_32(x)x ## _fixed_32
+#define AAC_FLOAT SoftFloat
+#define INTFLOAT int
+#define SHORTFLOAT int16_t
+#define AAC_SIGNE   int
+#define FIXR(a) ((int)((a) * 1 + 0.5))
+#define FIXR10(a)   ((int)((a) * 1024.0 + 0.5))
+#define Q23(a)  (int)((a) * 8388608.0 + 0.5)
 #define Q30(x)  (int)((x)*1073741824.0 + 0.5)
 #define Q31(x)  (int)((x)*2147483648.0 + 0.5)
+#define RANGE15(x)  x
+#define GET_GAIN(x, y)  (-(y)  (x)) + 1024
+#define AAC_MUL26(x, y) (int)(((int64_t)(x) * (y) + 0x200)  26)
+#define AAC_MUL30(x, y) (int)(((int64_t)(x) * (y) + 0x2000)  30)
+#define AAC_MUL31(x, y) (int)(((int64_t)(x) * (y) + 0x4000)  31)
 
 #else
 
 #define FFT_FLOAT1
 #define FFT_FIXED_32 0
 
+#define AAC_RENAME(x)   x
+#define AAC_RENAME_32(x)x
+#define AAC_FLOAT float
+#define INTFLOAT float
+#define SHORTFLOAT float
+#define AAC_SIGNE   unsigned
+#define FIXR(x) ((float)(x))
+#define FIXR10(x)   ((float)(x))
+#define Q23(x)  x
 #define Q30(x)  x
 #define Q31(x)  x
+#define RANGE15(x)  (32768.0 * (x))
+#define GET_GAIN(x, y)  powf((x), -(y))
+#define AAC_MUL26(x, y) ((x) * (y))
+#define AAC_MUL30(x, y) ((x) * (y))
+#define AAC_MUL31(x, y) ((x) * (y))
+
 #endif /* USE_FIXED */
 
 #include libavutil/float_dsp.h
+#include libavutil/fixed_dsp.h
 #include avcodec.h
+#if !USE_FIXED
 #include imdct15.h
+#endif
 #include fft.h
 #include mpeg4audio.h
 #include sbr.h
@@ -148,12 +180,12 @@ typedef struct OutputConfiguration {
  * Predictor State
  */
 typedef struct PredictorState {
-float cor0;
-float cor1;
-float var0;
-float var1;
-float r0;
-float r1;
+AAC_FLOAT cor0;
+AAC_FLOAT cor1;
+AAC_FLOAT var0;
+AAC_FLOAT var1;
+AAC_FLOAT r0;
+AAC_FLOAT r1;
 } PredictorState;
 
 #define MAX_PREDICTORS 672
@@ -174,7 +206,7 @@ typedef struct PredictorState {
 typedef struct LongTermPrediction {
 int8_t present;
 int16_t lag;
-float coef;
+INTFLOAT coef;
 int8_t used[MAX_LTP_LONG_SFB];
 } LongTermPrediction;
 
@@ -208,7 +240,7 @@ typedef struct TemporalNoiseShaping {
 int length[8][4];
 int direction[8][4];
 int order[8][4];
-float coef[8][4][TNS_MAX_ORDER];
+INTFLOAT coef[8][4][TNS_MAX_ORDER];
 } TemporalNoiseShaping;
 
 /**
@@ -245,7 +277,7 @@ typedef struct ChannelCoupling {
 int ch_select[8];  /** [0] shared list of gains; [1] list of gains 
for right channel;
 *   [2] list of gains for left channel; [3] lists 
of gains for both channels
 */
-float gain[16][120];
+INTFLOAT gain[16][120];
 } ChannelCoupling;
 
 /**
@@ -257,16 +289,16 @@ typedef struct SingleChannelElement {
 Pulse pulse;
 enum BandType band_type[128];   /// band types
 int band_type_run_end[120]; /// band type run end 
points
-float sf[120];  /// scalefactors
+INTFLOAT sf[120];   /// scalefactors
 int sf_idx[128];/// scalefactor indices 
(used by encoder)
 uint8_t zeroes[128];/// band is not coded 
(used by encoder)
-DECLARE_ALIGNED(32, float,   pcoeffs)[1024];/// coefficients for 
IMDCT, pristine
-DECLARE_ALIGNED(32, float,   coeffs)[1024]; /// coefficients for 
IMDCT, maybe processed
-DECLARE_ALIGNED(32, float,   saved)[1536];  /// overlap
-DECLARE_ALIGNED(32, float,   ret_buf)[2048];/// PCM output buffer
-DECLARE_ALIGNED(16, float,   ltp_state)[3072];  /// time signal for LTP
+DECLARE_ALIGNED(32, INTFLOAT,   pcoeffs)[1024]; /// coefficients for 
IMDCT, pristine
+DECLARE_ALIGNED(32, INTFLOAT,   coeffs)[1024];  /// coefficients for 
IMDCT, maybe processed
+DECLARE_ALIGNED(32, INTFLOAT,   saved)[1536];   /// overlap
+DECLARE_ALIGNED(32, INTFLOAT,   ret_buf)[2048]; /// PCM output buffer
+DECLARE_ALIGNED(16, INTFLOAT,   ltp_state)[3072];/// time signal for LTP
 PredictorState predictor_state[MAX_PREDICTORS];
-float *ret; 

[FFmpeg-devel] [PATCH 12/12] Edit documentation and versioning

2015-06-11 Thread Nedeljko Babic
From: Jovan Zelincevic jovan.zelince...@imgtec.com

Signed-off-by: Nedeljko Babic nedeljko.ba...@imgtec.com
---
 Changelog| 1 +
 doc/general.texi | 2 +-
 doc/mips.txt | 4 
 libavcodec/version.h | 2 +-
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index aa5753e..33a0525 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest 
within each release,
 releases are sorted from youngest to oldest.
 
 version next:
+- AAC fixed-point decoding
 
 
 version 2.7:
diff --git a/doc/general.texi b/doc/general.texi
index ba79503..65cf396 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -836,7 +836,7 @@ following image formats are supported:
 @item Name @tab Encoding @tab Decoding @tab Comments
 @item 8SVX exponential   @tab @tab  X
 @item 8SVX fibonacci @tab @tab  X
-@item AAC+   @tab  E  @tab  X
+@item AAC+   @tab  E  @tab  IX
 @tab encoding supported through external library libaacplus
 @item AAC@tab  E  @tab  X
 @tab encoding supported through external library libfaac and libvo-aacenc
diff --git a/doc/mips.txt b/doc/mips.txt
index 8c6779f..a84e89a 100644
--- a/doc/mips.txt
+++ b/doc/mips.txt
@@ -47,12 +47,16 @@ Files that have MIPS copyright notice in them:
 * libavutil/mips/
   float_dsp_mips.c
   libm_mips.h
+  softfloat_tables.h
 * libavcodec/
   fft_fixed_32.c
   fft_init_table.c
   fft_table.h
   mdct_fixed_32.c
 * libavcodec/mips/
+  aacdec_fixed.c
+  aacsbr_fixed.c
+  aacsbr_template.c
   aaccoder_mips.c
   aacpsy_mips.h
   ac3dsp_mips.c
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 74a1b30..7490dd9 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 #include libavutil/version.h
 
 #define LIBAVCODEC_VERSION_MAJOR 56
-#define LIBAVCODEC_VERSION_MINOR  41
+#define LIBAVCODEC_VERSION_MINOR  42
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-- 
1.8.2.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 01/12] libavcodec: Implementation of AAC_fixed_decoder (LC-module) [1/4]

2015-06-11 Thread Hendrik Leppkes
On Thu, Jun 11, 2015 at 4:08 PM, Nedeljko Babic
nedeljko.ba...@imgtec.com wrote:
 From: Jovan Zelincevic jovan.zelince...@imgtec.com

 Move existing code to the new template files


Please setup your Git to track renames (add -M parameter), this is
really hard to review in this form.

- Hendrik
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] Encoding of styles - Bold, Italic, Underlined for timed-text subttiles

2015-06-11 Thread Niklesh Lalwani
Tested on iPhone too. You might need to enable the subtitles first.

Thanks,
Niklesh
On 11-Jun-2015 2:22 PM, Carl Eugen Hoyos ceho...@ag.or.at wrote:

 Niklesh Lalwani niklesh.lalwani at iitb.ac.in writes:

  Tested on QuickTime 10.3 on OSX

 Did you also test on an iPhone or iPad?

 Carl Eugen

 ___
 ffmpeg-devel mailing list
 ffmpeg-devel@ffmpeg.org
 http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 11/12] tests: Add aac_fixed decoder test

2015-06-11 Thread Nedeljko Babic
Signed-off-by: Nedeljko Babic nedeljko.ba...@imgtec.com
---
 tests/fate/aac.mak | 58 +-
 1 file changed, 57 insertions(+), 1 deletion(-)

diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak
index 34823be..7ebec45 100644
--- a/tests/fate/aac.mak
+++ b/tests/fate/aac.mak
@@ -70,6 +70,61 @@ FATE_AAC += fate-aac-er_eld2100np_48_ep0
 fate-aac-er_eld2100np_48_ep0: CMD = pcm -i 
$(TARGET_SAMPLES)/aac/er_eld2100np_48_ep0.mp4
 fate-aac-er_eld2100np_48_ep0: REF = $(SAMPLES)/aac/er_eld2100np_48.s16
 
+FATE_AAC_FIXED += fate-aac-fixed-al04_44
+fate-aac-fixed-al04_44: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al04_44.mp4
+fate-aac-fixed-al04_44: REF = $(SAMPLES)/aac/al04_44.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-al05_44
+fate-aac-fixed-al05_44: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al05_44.mp4
+fate-aac-fixed-al05_44: REF = $(SAMPLES)/aac/al05_44.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-al06_44
+fate-aac-fixed-al06_44: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al06_44.mp4
+fate-aac-fixed-al06_44: REF = $(SAMPLES)/aac/al06_44_reorder.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-al15_44
+fate-aac-fixed-al15_44: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al15_44.mp4
+fate-aac-fixed-al15_44: REF = $(SAMPLES)/aac/al15_44_reorder.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-al17_44
+fate-aac-fixed-al17_44: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al17_44.mp4
+fate-aac-fixed-al17_44: REF = $(SAMPLES)/aac/al17_44.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-al18_44
+fate-aac-fixed-al18_44: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al18_44.mp4
+fate-aac-fixed-al18_44: REF = $(SAMPLES)/aac/al18_44.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-al_sbr_hq_cm_48_2
+fate-aac-fixed-al_sbr_hq_cm_48_2: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al_sbr_cm_48_2.mp4
+fate-aac-fixed-al_sbr_hq_cm_48_2: REF = $(SAMPLES)/aac/al_sbr_hq_cm_48_2.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-al_sbr_hq_cm_48_5.1
+fate-aac-fixed-al_sbr_hq_cm_48_5.1: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al_sbr_cm_48_5.1.mp4
+fate-aac-fixed-al_sbr_hq_cm_48_5.1: REF = 
$(SAMPLES)/aac/al_sbr_hq_cm_48_5.1_reorder.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-al_sbr_hq_sr_48_2_fsaac48
+fate-aac-fixed-al_sbr_hq_sr_48_2_fsaac48: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/al_sbr_sr_48_2_fsaac48.mp4
+fate-aac-fixed-al_sbr_hq_sr_48_2_fsaac48: REF = 
$(SAMPLES)/aac/al_sbr_hq_sr_48_2_fsaac48.s16
+
+#FATE_AAC_FIXED += fate-aac-fixed-al_sbr_ps_06_ur
+#fate-aac-fixed-al_sbr_ps_06_ur: CMD = pcm -c aac_fixed-i 
$(TARGET_SAMPLES)/aac/al_sbr_ps_06_new.mp4
+#fate-aac-fixed-al_sbr_ps_06_ur: REF = $(SAMPLES)/aac/al_sbr_ps_06_ur.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-ap05_48
+fate-aac-fixed-ap05_48: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/ap05_48.mp4
+fate-aac-fixed-ap05_48: REF = $(SAMPLES)/aac/ap05_48.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-er_ad6000np_44_ep0
+fate-aac-fixed-er_ad6000np_44_ep0: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/er_ad6000np_44_ep0.mp4
+fate-aac-fixed-er_ad6000np_44_ep0: REF = $(SAMPLES)/aac/er_ad6000np_44.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-er_eld1001np_44_ep0
+fate-aac-fixed-er_eld1001np_44_ep0: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/er_eld1001np_44_ep0.mp4
+fate-aac-fixed-er_eld1001np_44_ep0: REF = $(SAMPLES)/aac/er_eld1001np_44.s16
+
+FATE_AAC_FIXED += fate-aac-fixed-er_eld2000np_48_ep0
+fate-aac-fixed-er_eld2000np_48_ep0: CMD = pcm -c aac_fixed -i 
$(TARGET_SAMPLES)/aac/er_eld2000np_48_ep0.mp4
+fate-aac-fixed-er_eld2000np_48_ep0: REF = 
$(SAMPLES)/aac/er_eld2000np_48_ep0.s16
 
 fate-aac-ct%: CMD = pcm -i 
$(TARGET_SAMPLES)/aac/CT_DecoderCheck/$(@:fate-aac-ct-%=%)
 fate-aac-ct%: REF = $(SAMPLES)/aac/CT_DecoderCheck/aacPlusv2.wav
@@ -114,8 +169,9 @@ fate-aac-latm_stereo_to_51: REF = 
$(SAMPLES)/aac/latm_stereo_to_51_ref.s16
 FATE_AAC-$(call  DEMDEC, AAC,AAC)  += $(FATE_AAC_CT_RAW)
 FATE_AAC-$(call  DEMDEC, MOV,AAC)  += $(FATE_AAC)
 FATE_AAC_LATM-$(call DEMDEC, MPEGTS, AAC_LATM) += $(FATE_AAC_LATM)
+FATE_AAC-$(call  DEMDEC, AAC,AAC_FIXED)+= $(FATE_AAC_FIXED)
 
-FATE_AAC_ALL = $(FATE_AAC-yes) $(FATE_AAC_LATM-yes)
+FATE_AAC_ALL = $(FATE_AAC-yes) $(FATE_AAC_LATM-yes) $(FATE_AAC_FIXED-yes)
 
 $(FATE_AAC_ALL): CMP  = oneoff
 $(FATE_AAC_ALL): FUZZ = 2
-- 
1.8.2.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 08/12] libavcodec: Implementation of AAC_fixed_decoder (PS-module) [1/2]

2015-06-11 Thread Nedeljko Babic
From: Jovan Zelincevic jovan.zelince...@imgtec.com

Add fixed point implementation of functions for generating tables.

Signed-off-by: Nedeljko Babic nedeljko.ba...@imgtec.com
---
 libavcodec/aacps_fixed_tablegen.c|  24 +++
 libavcodec/aacps_fixed_tablegen.h| 402 +++
 libavcodec/aacps_tablegen.c  |  73 +--
 libavcodec/aacps_tablegen_template.c | 107 ++
 4 files changed, 535 insertions(+), 71 deletions(-)
 create mode 100644 libavcodec/aacps_fixed_tablegen.c
 create mode 100644 libavcodec/aacps_fixed_tablegen.h
 create mode 100644 libavcodec/aacps_tablegen_template.c

diff --git a/libavcodec/aacps_fixed_tablegen.c 
b/libavcodec/aacps_fixed_tablegen.c
new file mode 100644
index 000..9e30699
--- /dev/null
+++ b/libavcodec/aacps_fixed_tablegen.c
@@ -0,0 +1,24 @@
+/*
+ * Generate a header file for hardcoded Parametric Stereo tables
+ *
+ * Copyright (c) 2010 Alex Converse alex.conve...@gmail.com
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg 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.
+ *
+ * FFmpeg 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 FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define USE_FIXED 1
+#include aacps_tablegen_template.c
diff --git a/libavcodec/aacps_fixed_tablegen.h 
b/libavcodec/aacps_fixed_tablegen.h
new file mode 100644
index 000..9474206
--- /dev/null
+++ b/libavcodec/aacps_fixed_tablegen.h
@@ -0,0 +1,402 @@
+/*
+ * Header file for hardcoded Parametric Stereo tables
+ *
+ * Copyright (c) 2010 Alex Converse alex.conve...@gmail.com
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg 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.
+ *
+ * FFmpeg 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 FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Note: Rounding-to-nearest used unless otherwise stated
+ *
+ */
+
+#ifndef AACPS_FIXED_TABLEGEN_H
+#define AACPS_FIXED_TABLEGEN_H
+
+#include math.h
+#include stdint.h
+
+#if CONFIG_HARDCODED_TABLES
+#define ps_tableinit()
+#define TABLE_CONST const
+#include libavcodec/aacps_fixed_tables.h
+#else
+#include libavutil/common.h
+#include libavutil/mathematics.h
+#include libavutil/mem.h
+
+#include aac_defines.h
+#include libavutil/softfloat.h
+#define NR_ALLPASS_BANDS20 30
+#define NR_ALLPASS_BANDS34 50
+#define PS_AP_LINKS 3
+#define TABLE_CONST
+static int pd_re_smooth[8*8*8];
+static int pd_im_smooth[8*8*8];
+static int HA[46][8][4];
+static int HB[46][8][4];
+static DECLARE_ALIGNED(16, int, f20_0_8) [ 8][8][2];
+static DECLARE_ALIGNED(16, int, f34_0_12)[12][8][2];
+static DECLARE_ALIGNED(16, int, f34_1_8) [ 8][8][2];
+static DECLARE_ALIGNED(16, int, f34_2_4) [ 4][8][2];
+static TABLE_CONST DECLARE_ALIGNED(16, int, Q_fract_allpass)[2][50][3][2];
+static DECLARE_ALIGNED(16, int, phi_fract)[2][50][2];
+
+static const int g0_Q8[] = {
+Q31(0.00746082949812f), Q31(0.02270420949825f), Q31(0.04546865930473f), 
Q31(0.07266113929591f),
+Q31(0.09885108575264f), Q31(0.11793710567217f), Q31(0.125f)
+};
+
+static const int g0_Q12[] = {
+Q31(0.04081179924692f), Q31(0.03812810994926f), Q31(0.05144908135699f), 
Q31(0.06399831151592f),
+Q31(0.07428313801106f), Q31(0.08100347892914f), Q31(0.08f)
+};
+
+static const int g1_Q8[] = {
+Q31(0.01565675600122f), Q31(0.03752716391991f), Q31(0.05417891378782f), 
Q31(0.08417044116767f),
+Q31(0.10307344158036f), Q31(0.1452249753f), Q31(0.125f)
+};
+
+static const int g2_Q4[] = {
+Q31(-0.05908211155639f), Q31(-0.04871498374946f), Q31(0.0f),   
Q31(0.07778723915851f),
+Q31( 0.16486303567403f), Q31( 0.23279856662996f), Q31(0.25f)
+};
+
+static const int sintbl_4[4]   = {   0,  1073741824,   0, 
-1073741824 };
+static const int costbl_4[4]   = {  1073741824,   0, -1073741824,  
 0 };
+static const int sintbl_8[8]   = {   0,   759250125,  

Re: [FFmpeg-devel] [PATCH 1/3] avformat/avio: move short seek threshold to the context

2015-06-11 Thread Michael Niedermayer
On Tue, Jun 02, 2015 at 06:40:53PM +0200, Michael Niedermayer wrote:
 This allows us to adjust it internally.
 
 Signed-off-by: Michael Niedermayer michae...@gmx.at
 ---
  libavformat/avio.h|6 ++
  libavformat/aviobuf.c |3 ++-
  2 files changed, 8 insertions(+), 1 deletion(-)

applied

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

You can kill me, but you cannot change the truth.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 05/12] libavcodec: Implementation of AAC_fixed_decoder (SBR-module) [1/3]

2015-06-11 Thread Nedeljko Babic
From: Djordje Pesut djordje.pe...@imgtec.com

Move the existing code to a new template file.

Signed-off-by: Nedeljko Babic nedeljko.ba...@imgtec.com
---
 libavcodec/aacsbr.c  | 1419 +-
 libavcodec/aacsbr.h  |   45 ++
 libavcodec/aacsbr_template.c | 1401 +
 libavcodec/sbrdsp.c  |   75 +--
 libavcodec/sbrdsp_template.c |   95 +++
 5 files changed, 1543 insertions(+), 1492 deletions(-)
 create mode 100644 libavcodec/aacsbr_template.c
 create mode 100644 libavcodec/sbrdsp_template.c

diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index 7e98834..766c47b 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -42,252 +42,13 @@
 #include float.h
 #include math.h
 
-#define ENVELOPE_ADJUSTMENT_OFFSET 2
-#define NOISE_FLOOR_OFFSET 6.0f
-
 #if ARCH_MIPS
 #include mips/aacsbr_mips.h
 #endif /* ARCH_MIPS */
 
-/**
- * SBR VLC tables
- */
-enum {
-T_HUFFMAN_ENV_1_5DB,
-F_HUFFMAN_ENV_1_5DB,
-T_HUFFMAN_ENV_BAL_1_5DB,
-F_HUFFMAN_ENV_BAL_1_5DB,
-T_HUFFMAN_ENV_3_0DB,
-F_HUFFMAN_ENV_3_0DB,
-T_HUFFMAN_ENV_BAL_3_0DB,
-F_HUFFMAN_ENV_BAL_3_0DB,
-T_HUFFMAN_NOISE_3_0DB,
-T_HUFFMAN_NOISE_BAL_3_0DB,
-};
-
-/**
- * bs_frame_class - frame class of current SBR frame (14496-3 sp04 p98)
- */
-enum {
-FIXFIX,
-FIXVAR,
-VARFIX,
-VARVAR,
-};
-
-enum {
-EXTENSION_ID_PS = 2,
-};
-
 static VLC vlc_sbr[10];
-static const int8_t vlc_sbr_lav[10] =
-{ 60, 60, 24, 24, 31, 31, 12, 12, 31, 12 };
-
-#define SBR_INIT_VLC_STATIC(num, size) \
-INIT_VLC_STATIC(vlc_sbr[num], 9, sbr_tmp[num].table_size / 
sbr_tmp[num].elem_size, \
-sbr_tmp[num].sbr_bits ,  1,
  1, \
-sbr_tmp[num].sbr_codes, sbr_tmp[num].elem_size, 
sbr_tmp[num].elem_size, \
-size)
-
-#define SBR_VLC_ROW(name) \
-{ name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## 
_codes[0]) }
-
 static void aacsbr_func_ptr_init(AACSBRContext *c);
 
-av_cold void ff_aac_sbr_init(void)
-{
-static const struct {
-const void *sbr_codes, *sbr_bits;
-const unsigned int table_size, elem_size;
-} sbr_tmp[] = {
-SBR_VLC_ROW(t_huffman_env_1_5dB),
-SBR_VLC_ROW(f_huffman_env_1_5dB),
-SBR_VLC_ROW(t_huffman_env_bal_1_5dB),
-SBR_VLC_ROW(f_huffman_env_bal_1_5dB),
-SBR_VLC_ROW(t_huffman_env_3_0dB),
-SBR_VLC_ROW(f_huffman_env_3_0dB),
-SBR_VLC_ROW(t_huffman_env_bal_3_0dB),
-SBR_VLC_ROW(f_huffman_env_bal_3_0dB),
-SBR_VLC_ROW(t_huffman_noise_3_0dB),
-SBR_VLC_ROW(t_huffman_noise_bal_3_0dB),
-};
-
-// SBR VLC table initialization
-SBR_INIT_VLC_STATIC(0, 1098);
-SBR_INIT_VLC_STATIC(1, 1092);
-SBR_INIT_VLC_STATIC(2, 768);
-SBR_INIT_VLC_STATIC(3, 1026);
-SBR_INIT_VLC_STATIC(4, 1058);
-SBR_INIT_VLC_STATIC(5, 1052);
-SBR_INIT_VLC_STATIC(6, 544);
-SBR_INIT_VLC_STATIC(7, 544);
-SBR_INIT_VLC_STATIC(8, 592);
-SBR_INIT_VLC_STATIC(9, 512);
-
-aacsbr_tableinit();
-
-ff_ps_init();
-}
-
-/** Places SBR in pure upsampling mode. */
-static void sbr_turnoff(SpectralBandReplication *sbr) {
-sbr-start = 0;
-// Init defults used in pure upsampling mode
-sbr-kx[1] = 32; //Typo in spec, kx' inits to 32
-sbr-m[1] = 0;
-// Reset values for first SBR header
-sbr-data[0].e_a[1] = sbr-data[1].e_a[1] = -1;
-memset(sbr-spectrum_params, -1, sizeof(SpectrumParameters));
-}
-
-av_cold void ff_aac_sbr_ctx_init(AACContext *ac, SpectralBandReplication *sbr)
-{
-if(sbr-mdct.mdct_bits)
-return;
-sbr-kx[0] = sbr-kx[1];
-sbr_turnoff(sbr);
-sbr-data[0].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE 
- (1280 - 128);
-sbr-data[1].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE 
- (1280 - 128);
-/* SBR requires samples to be scaled to +/-32768.0 to work correctly.
- * mdct scale factors are adjusted to scale up from +/-1.0 at analysis
- * and scale back down at synthesis. */
-ff_mdct_init(sbr-mdct, 7, 1, 1.0 / (64 * 32768.0));
-ff_mdct_init(sbr-mdct_ana, 7, 1, -2.0 * 32768.0);
-ff_ps_ctx_init(sbr-ps);
-ff_sbrdsp_init(sbr-dsp);
-aacsbr_func_ptr_init(sbr-c);
-}
-
-av_cold void ff_aac_sbr_ctx_close(SpectralBandReplication *sbr)
-{
-ff_mdct_end(sbr-mdct);
-ff_mdct_end(sbr-mdct_ana);
-}
-
-static int qsort_comparison_function_int16(const void *a, const void *b)
-{
-return *(const int16_t *)a - *(const int16_t *)b;
-}
-
-static inline int in_table_int16(const int16_t *table, int last_el, int16_t 
needle)
-{
-int i;
-for (i = 0; i = last_el; i++)
-if (table[i] == needle)
-return 1;
-return 0;
-}
-
-/// Limiter Frequency Band Table (14496-3 sp04 p198)
-static void sbr_make_f_tablelim(SpectralBandReplication *sbr)
-{
-int k;
-if 

[FFmpeg-devel] [PATCH 09/12] libavcodec: Implementation of AAC_fixed_decoder (PS-module) [2/2]

2015-06-11 Thread Nedeljko Babic
From: Djordje Pesut djordje.pe...@imgtec.com

Add fixed point implementation.

Signed-off-by: Nedeljko Babic nedeljko.ba...@imgtec.com
---
 libavcodec/Makefile   |  14 ++-
 libavcodec/aac_defines.h  |  36 ++
 libavcodec/aacps.c| 255 --
 libavcodec/aacps.h|  32 ++---
 libavcodec/aacps_fixed.c  |  24 
 libavcodec/aacps_fixed_tablegen.h |   2 +-
 libavcodec/aacps_float.c  |  24 
 libavcodec/aacpsdata.c|   6 +-
 libavcodec/aacpsdsp.c | 216 
 libavcodec/aacpsdsp.h |  30 ++---
 libavcodec/aacpsdsp_fixed.c   |  23 
 libavcodec/aacpsdsp_float.c   |  23 
 libavcodec/aacpsdsp_template.c| 228 ++
 libavcodec/aacsbr_template.c  |   8 +-
 14 files changed, 571 insertions(+), 350 deletions(-)
 create mode 100644 libavcodec/aacps_fixed.c
 create mode 100644 libavcodec/aacps_float.c
 delete mode 100644 libavcodec/aacpsdsp.c
 create mode 100644 libavcodec/aacpsdsp_fixed.c
 create mode 100644 libavcodec/aacpsdsp_float.c
 create mode 100644 libavcodec/aacpsdsp_template.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 118e1d6..148b032 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -113,12 +113,12 @@ OBJS-$(CONFIG_WMA_FREQS)   += wma_freqs.o
 OBJS-$(CONFIG_ZERO12V_DECODER) += 012v.o
 OBJS-$(CONFIG_A64MULTI_ENCODER)+= a64multienc.o elbg.o
 OBJS-$(CONFIG_A64MULTI5_ENCODER)   += a64multienc.o elbg.o
-OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps.o \
+OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o 
aacps_float.o \
   aacadtsdec.o mpeg4audio.o kbdwin.o \
-  sbrdsp.o aacpsdsp.o
-OBJS-$(CONFIG_AAC_FIXED_DECODER)   += aacdec_fixed.o aactab.o 
aacsbr_fixed.o \
+  sbrdsp.o aacpsdsp_float.o
+OBJS-$(CONFIG_AAC_FIXED_DECODER)   += aacdec_fixed.o aactab.o 
aacsbr_fixed.o aacps_fixed.o \
   aacadtsdec.o mpeg4audio.o kbdwin.o \
-  sbrdsp_fixed.o
+  sbrdsp_fixed.o aacpsdsp_fixed.o
 OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o\
   aacpsy.o aactab.o  \
   psymodel.o mpeg4audio.o kbdwin.o
@@ -916,6 +916,7 @@ TOOLS = fourcc2pixfmt
 
 HOSTPROGS = aac_tablegen\
 aacps_tablegen  \
+aacps_fixed_tablegen\
 aacsbr_tablegen \
 aacsbr_fixed_tablegen   \
 cabac_tablegen  \
@@ -948,7 +949,7 @@ else
 $(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=0
 endif
 
-GEN_HEADERS = cabac_tables.h cbrt_tables.h cbrt_fixed_tables.h aacps_tables.h 
aacsbr_tables.h \
+GEN_HEADERS = cabac_tables.h cbrt_tables.h cbrt_fixed_tables.h aacps_tables.h 
aacps_fixed_tables.h aacsbr_tables.h \
   aacsbr_fixed_tables.h aac_tables.h dsd_tables.h dv_tables.h \
   sinewin_tables.h sinewin_fixed_tables.h mpegaudio_tables.h 
motionpixels_tables.h \
   pcm_tables.h qdm2_tables.h
@@ -960,7 +961,8 @@ $(GEN_HEADERS): $(SUBDIR)%_tables.h: 
$(SUBDIR)%_tablegen$(HOSTEXESUF)
 ifdef CONFIG_HARDCODED_TABLES
 $(SUBDIR)aacdec.o: $(SUBDIR)cbrt_tables.h
 $(SUBDIR)aacdec_fixed.o: $(SUBDIR)cbrt_fixed_tables.h
-$(SUBDIR)aacps.o: $(SUBDIR)aacps_tables.h
+$(SUBDIR)aacps_float.o: $(SUBDIR)aacps_tables.h
+$(SUBDIR)aacps_fixed.o: $(SUBDIR)aacps_fixed_tables.h
 $(SUBDIR)aacsbr.o: $(SUBDIR)aacsbr_tables.h
 $(SUBDIR)aacsbr_fixed.o: $(SUBDIR)aacsbr_fixed_tables.h
 $(SUBDIR)aactab.o: $(SUBDIR)aac_tables.h
diff --git a/libavcodec/aac_defines.h b/libavcodec/aac_defines.h
index 0f3905f..3c45742 100644
--- a/libavcodec/aac_defines.h
+++ b/libavcodec/aac_defines.h
@@ -35,6 +35,7 @@
 #define AAC_RENAME(x)   x ## _fixed
 #define AAC_RENAME_32(x)x ## _fixed_32
 #define INTFLOAT int
+#define INT64FLOAT  int64_t
 #define SHORTFLOAT int16_t
 #define AAC_FLOAT SoftFloat
 #define AAC_SIGNE   int
@@ -45,9 +46,33 @@
 #define Q31(x)  (int)((x)*2147483648.0 + 0.5)
 #define RANGE15(x)  x
 #define GET_GAIN(x, y)  (-(y)  (x)) + 1024
+#define AAC_MUL16(x, y) (int)(((int64_t)(x) * (y) + 0x8000)  16)
 #define AAC_MUL26(x, y) (int)(((int64_t)(x) * (y) + 0x200)  26)
 #define AAC_MUL30(x, y) (int)(((int64_t)(x) * (y) + 0x2000)  30)
 #define AAC_MUL31(x, y) (int)(((int64_t)(x) * (y) + 0x4000)  31)
+#define 

Re: [FFmpeg-devel] [PATCH] avutil/softfloat: Move av_sincos_sf() from test c file to a new file

2015-06-11 Thread Michael Niedermayer
On Thu, Jun 11, 2015 at 03:58:46PM +0200, Nedeljko Babic wrote:
 The function cannot be used from the test file, so the new file is created for
 it and appropriate changes to Makefile are made
 
 Signed-off-by: Nedeljko Babic nedeljko.ba...@imgtec.com
 ---
  libavutil/Makefile |  1 +
  libavutil/softfloat.c  | 49 
  libavutil/softfloat_trig.c | 70 
 ++
  3 files changed, 71 insertions(+), 49 deletions(-)
  create mode 100644 libavutil/softfloat_trig.c

fixed differently (that is more similar to how the other selftests are
seperated)


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avutil/softfloat: Move av_sincos_sf() from test c file to a new file

2015-06-11 Thread Nedeljko Babic
The function cannot be used from the test file, so the new file is created for
it and appropriate changes to Makefile are made

Signed-off-by: Nedeljko Babic nedeljko.ba...@imgtec.com
---
 libavutil/Makefile |  1 +
 libavutil/softfloat.c  | 49 
 libavutil/softfloat_trig.c | 70 ++
 3 files changed, 71 insertions(+), 49 deletions(-)
 create mode 100644 libavutil/softfloat_trig.c

diff --git a/libavutil/Makefile b/libavutil/Makefile
index df85cd1..bef4687 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -126,6 +126,7 @@ OBJS = adler32.o
\
samplefmt.o  \
sha.o\
sha512.o \
+   softfloat_trig.o \
stereo3d.o   \
threadmessage.o  \
time.o   \
diff --git a/libavutil/softfloat.c b/libavutil/softfloat.c
index 4fc6860..37dd758 100644
--- a/libavutil/softfloat.c
+++ b/libavutil/softfloat.c
@@ -37,55 +37,6 @@ static av_const double av_sf2double(SoftFloat v) {
 else  return (double)v.mant / (double)(1  (-v.exp));
 }
 
-void av_sincos_sf(int a, int *s, int *c)
-{
-int idx, sign;
-int sv, cv;
-int st, ct;
-
-idx = a  26;
-sign = (idx  27)  31;
-cv = av_costbl_1_sf[idx  0xf];
-cv = (cv ^ sign) - sign;
-
-idx -= 8;
-sign = (idx  27)  31;
-sv = av_costbl_1_sf[idx  0xf];
-sv = (sv ^ sign) - sign;
-
-idx = a  21;
-ct = av_costbl_2_sf[idx  0x1f];
-st = av_sintbl_2_sf[idx  0x1f];
-
-idx = (int)(((int64_t)cv * ct - (int64_t)sv * st + 0x2000)  30);
-
-sv = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x2000)  30);
-
-cv = idx;
-
-idx = a  16;
-ct = av_costbl_3_sf[idx  0x1f];
-st = av_sintbl_3_sf[idx  0x1f];
-
-idx = (int)(((int64_t)cv * ct - (int64_t)sv * st + 0x2000)  30);
-
-sv = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x2000)  30);
-cv = idx;
-
-idx = a  11;
-
-ct = (int)(((int64_t)av_costbl_4_sf[idx  0x1f] * (0x800 - (a  0x7ff)) +
-(int64_t)av_costbl_4_sf[(idx  0x1f)+1]*(a  0x7ff) +
-0x400)  11);
-st = (int)(((int64_t)av_sintbl_4_sf[idx  0x1f] * (0x800 - (a  0x7ff)) +
-(int64_t)av_sintbl_4_sf[(idx  0x1f) + 1] * (a  0x7ff) +
-0x400)  11);
-
-*c = (int)(((int64_t)cv * ct + (int64_t)sv * st + 0x2000)  30);
-
-*s = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x2000)  30);
-}
-
 int main(void){
 SoftFloat one= av_int2sf(1, 0);
 SoftFloat sf1, sf2, sf3;
diff --git a/libavutil/softfloat_trig.c b/libavutil/softfloat_trig.c
new file mode 100644
index 000..077154b
--- /dev/null
+++ b/libavutil/softfloat_trig.c
@@ -0,0 +1,70 @@
+/*
+ * copyright (c) 2013 Stanislav Ocovaj stanislav.oco...@imgtec.com
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg 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.
+ *
+ * FFmpeg 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 FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include softfloat.h
+
+void av_sincos_sf(int a, int *s, int *c)
+{
+int idx, sign;
+int sv, cv;
+int st, ct;
+
+idx = a  26;
+sign = (idx  27)  31;
+cv = av_costbl_1_sf[idx  0xf];
+cv = (cv ^ sign) - sign;
+
+idx -= 8;
+sign = (idx  27)  31;
+sv = av_costbl_1_sf[idx  0xf];
+sv = (sv ^ sign) - sign;
+
+idx = a  21;
+ct = av_costbl_2_sf[idx  0x1f];
+st = av_sintbl_2_sf[idx  0x1f];
+
+idx = (int)(((int64_t)cv * ct - (int64_t)sv * st + 0x2000)  30);
+
+sv = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x2000)  30);
+
+cv = idx;
+
+idx = a  16;
+ct = av_costbl_3_sf[idx  0x1f];
+st = av_sintbl_3_sf[idx  0x1f];
+
+idx = (int)(((int64_t)cv * ct - (int64_t)sv * st + 0x2000)  30);
+
+sv = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x2000)  30);
+cv = idx;
+
+idx = a  11;
+
+ct = (int)(((int64_t)av_costbl_4_sf[idx  0x1f] * (0x800 - (a  0x7ff)) +
+

Re: [FFmpeg-devel] [PATCH] avformat/mpegts: recognizes and export private streams

2015-06-11 Thread Michael Niedermayer
On Thu, Jun 11, 2015 at 10:59:23PM +0200, Wolfgang Lorenz wrote:
 Hi Micheal,
 
 Am Wed, 10 Jun 2015 23:40:10 +0200
 schrieb Michael Niedermayer michae...@gmx.at:
 
  Based on patch by Wolfgang Lorenz wl-c...@gmx.de
  Signed-off-by: Michael Niedermayer michae...@gmx.at
  ---
   libavformat/mpegts.c |7 +++
   1 file changed, 7 insertions(+)
  
  diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
  index eff6819..7b35d7f 100644
  --- a/libavformat/mpegts.c
  +++ b/libavformat/mpegts.c
  @@ -835,6 +835,13 @@ static int mpegts_set_stream_info(AVStream *st, 
  PESContext *pes,
   st-codec-codec_id  = old_codec_id;
   st-codec-codec_type = old_codec_type;
   }
  +if ((st-codec-codec_id == AV_CODEC_ID_NONE || st-request_probe == 
  1) 
  +!avcodec_is_open(st-codec) 
  +stream_type ==  6) {
  +st-codec-codec_type = AVMEDIA_TYPE_DATA;
  +st-codec-codec_id   = AV_CODEC_ID_BIN_DATA;
  +st-request_probe = 1;
  +}
   
   return 0;
   }
 
 First things first: It's breaking fate-acodec-s302m for me.

make sure you use latest git master of ffmpeg, there was a commit
rather recently that is needed

if that doesnt work with your file then please provide that file


[...]
 If in your patch the request_probe value is set to a higher value, like
 e.g. 10, avformat_find_stream_info() behaves nicely and I do not need
 to reset the value manually. fate-acodec-s302m is still broken, though.

yes, the value will need finetuning, whats the more or less lowest
that results in 100% reliable detection ?

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/mpegts: recognizes and export private streams

2015-06-11 Thread Wolfgang Lorenz
Hi Micheal,

Am Wed, 10 Jun 2015 23:40:10 +0200
schrieb Michael Niedermayer michae...@gmx.at:

 Based on patch by Wolfgang Lorenz wl-c...@gmx.de
 Signed-off-by: Michael Niedermayer michae...@gmx.at
 ---
  libavformat/mpegts.c |7 +++
  1 file changed, 7 insertions(+)
 
 diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
 index eff6819..7b35d7f 100644
 --- a/libavformat/mpegts.c
 +++ b/libavformat/mpegts.c
 @@ -835,6 +835,13 @@ static int mpegts_set_stream_info(AVStream *st, 
 PESContext *pes,
  st-codec-codec_id  = old_codec_id;
  st-codec-codec_type = old_codec_type;
  }
 +if ((st-codec-codec_id == AV_CODEC_ID_NONE || st-request_probe == 1) 
 
 +!avcodec_is_open(st-codec) 
 +stream_type ==  6) {
 +st-codec-codec_type = AVMEDIA_TYPE_DATA;
 +st-codec-codec_id   = AV_CODEC_ID_BIN_DATA;
 +st-request_probe = 1;
 +}
  
  return 0;
  }

First things first: It's breaking fate-acodec-s302m for me.

===Excerpt from tests/data/fate/acodec-s302m.err===
Input #0, mpegts, from 
'/home/wolfgang/noBackup/sources/ffmpeg-git/tests/data/fate/acodec-s302m.mpegts':
  Duration: 00:00:05.99, start: 1.40, bitrate: 2122 kb/s
  Program 1 
Metadata:
  service_name: Service01
  service_provider: FFmpeg
Stream #0:0[0x100]: Audio: aac (SSR) (BSSD / 0x44535342), stereo, fltp, 2 
kb/s
===End of excerpt===

Now to my test case: Yes, this is working – kind of... For me... If I
test for the data streams, after opening the input file and before
finding the stream info, and set request_probe to 0,
avformat_find_stream_info() wont overwrite the codec type and id:

avformat_open_input(formatContext,
fileName,
NULL,
dict);

for(s = 0; s  formatContext-nb_streams; ++s)
{
if(formatContext-streams[s]-codec-codec_type == AVMEDIA_TYPE_DATA 
   formatContext-streams[s]-codec-codec_id == AV_CODEC_ID_BIN_DATA)
{
formatContext-streams[s]-request_probe = 0;
}
}

avformat_find_stream_info(formatContext,
  NULL);

If I don't do this, everything behaves like before: During the
avformat_find_stream_info() call some audio codec is chosen, a lot of
warning messages are written out and the packages are not given back,
as they were put in. I'm not sure, that this is what you intended.

If in your patch the request_probe value is set to a higher value, like
e.g. 10, avformat_find_stream_info() behaves nicely and I do not need
to reset the value manually. fate-acodec-s302m is still broken, though.


Greetings,
  Wolfgang



signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3] * mpegts demuxer recognizes private streams on demand

2015-06-11 Thread Wolfgang Lorenz
Am Wed, 10 Jun 2015 23:28:19 +0200
schrieb Michael Niedermayer michae...@gmx.at:

 On Wed, Jun 10, 2015 at 10:41:10PM +0200, Wolfgang Lorenz wrote:
  No answers?
  
  Well, I do have a question.
  
  Am Thu, 4 Jun 2015 23:46:21 +0200
  schrieb Wolfgang Lorenz wl-c...@gmx.de:
  
   The option went into the MpegTSContext struct and can be addressed via
   dictionary:
   
   AVFormatContext * formatContext = NULL;
   
   /* enable mpeg-ts private stream recognition */
   AVDictionary * dict = NULL;
   av_dict_set_int(dict, mpegts_recognize_private_streams, 1, 0);
   
   /* open file */
   avformat_open_input(formatContext, fileName, NULL, dict);
   
   [...]
  
  While I have used some kind of name scoping for the dictionary access,
  to avoid name clashes, I've seen, that this is not done for the rest of
  the formats. I think in most cases, this won't matter anyway. There are
  many doubling names between different input formats, but these won't
  make a problem, as one format context can only contain one input
  format. I've seen one name clash between AVFormatContext and an input
  format (auto, mov.c), and strict seems to be declared twice for
 
 constants have a scope limited to their type and field to which they
 apply
 
 
  AVFormatContext. So, here's my question: Is there any kind of
  convention for naming options? And should I rename my option to
  recognize_private_streams, or something different, to get the patch
  accepted? Recommendations are welcome.
 
 i have no oppinon on the name, either is fine
 what kept me from applying this is that i dont see why it has to
 break detection of streams for which reliable detection exists,
 it breaks at least fate-acodec-s302m and fate-dca-core

Yes, I see your point here, and I agree with you. The last patch was
meant to not touch the default behaviour, though, as a user would have
to explicitly, deliberately and proactively (the last one was somewhat
exaggerated) tell the mpegts demuxer to assign type and id for data
streams. I wouldn't have considered this a breaking change.

 This should be a fallback for private streams which are not
 identified by a strong probing method

I guess, that would be the best solution.

 ill post a patch which will do this in a moment, please comment/test

Thank you. I'll have a look.

 thanks
 
 
 [...]
 


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/mpegts: recognizes and export private streams

2015-06-11 Thread Wolfgang Lorenz
Am Thu, 11 Jun 2015 23:11:37 +0200
schrieb Michael Niedermayer michae...@gmx.at:

 On Thu, Jun 11, 2015 at 10:59:23PM +0200, Wolfgang Lorenz wrote:
  Hi Micheal,
  
  Am Wed, 10 Jun 2015 23:40:10 +0200
  schrieb Michael Niedermayer michae...@gmx.at:
  
   Based on patch by Wolfgang Lorenz wl-c...@gmx.de
   Signed-off-by: Michael Niedermayer michae...@gmx.at
   ---
libavformat/mpegts.c |7 +++
1 file changed, 7 insertions(+)
   
   diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
   index eff6819..7b35d7f 100644
   --- a/libavformat/mpegts.c
   +++ b/libavformat/mpegts.c
   @@ -835,6 +835,13 @@ static int mpegts_set_stream_info(AVStream *st, 
   PESContext *pes,
st-codec-codec_id  = old_codec_id;
st-codec-codec_type = old_codec_type;
}
   +if ((st-codec-codec_id == AV_CODEC_ID_NONE || st-request_probe == 
   1) 
   +!avcodec_is_open(st-codec) 
   +stream_type ==  6) {
   +st-codec-codec_type = AVMEDIA_TYPE_DATA;
   +st-codec-codec_id   = AV_CODEC_ID_BIN_DATA;
   +st-request_probe = 1;
   +}

return 0;
}
  
  First things first: It's breaking fate-acodec-s302m for me.
 
 make sure you use latest git master of ffmpeg, there was a commit
 rather recently that is needed

Sorry, I had missed that. fate-acodec-s302m is passing now. I haven't
waited until all tests finished, but I think it will be all right.

 if that doesnt work with your file then please provide that file
 
 
 [...]
  If in your patch the request_probe value is set to a higher value, like
  e.g. 10, avformat_find_stream_info() behaves nicely and I do not need
  to reset the value manually. fate-acodec-s302m is still broken, though.
 
 yes, the value will need finetuning, whats the more or less lowest
 that results in 100% reliable detection ?

My test case is already happy with a value as low as 2. I can not test
much more right now, though. I don't really feel good, with having such
a low threshold. Maybe the number could be made configurable? (I always
like configurable ;-) ).

 
 [...]
 


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] Set subtitle track dimensions for mov_text to display the subtitles properly

2015-06-11 Thread Philip Langdale
On Fri, 12 Jun 2015 00:11:24 +0530
Niklesh Lalwani niklesh.lalw...@iitb.ac.in wrote:

 Ok so it goes like this.
 
 We first find out the height and width of the video stream from the
 header box. The dimensions of the text track (subtitle track) is then
 set (in pixels). Here, we have used the width equal to the width of
 the video, and height equal to 1/10 of the video height.
 The write matrix specifies the coordinate origin and the translation
 values from the origin, ie, where to place the subtitle track. Here,
 we have set tx = 0; and ty = 9/10 of the video track height.
 There is also a text box inside this subtitle area, inside which the
 text is rendered. For now, this is set equal to the the subtitle track
 dimensions.
 
 Philip, please correct me if I am wrong.

Nicolas was asking about the general mechanism, I think.

So, the subtitle track has dimensions, just like the video track, and
for a given set of dimensions, it can be placed at a position within
the video track's dimensions. In Nikleh's example, it's the same width,
and 1/10 of the height, and placed 9/10'th down, so as to occupy the
bottom 1/10 of the display area.

Within the subtitle area, specific subtitles occupy text boxes that can
be smaller than the full area. In our simple example, all subtitles are
in the same box that occupies the full area.

--phil
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] Encoding of styles - Bold, Italic, Underlined for timed-text subttiles

2015-06-11 Thread Philip Langdale
On Thu, 11 Jun 2015 10:18:53 +0530
Niklesh Lalwani niklesh.lalw...@iitb.ac.in wrote:

 From: Niklesh niklesh.lalw...@iitb.ac.in
 
 Encoding of bold, Italic, underlined styles for 3gpp timed text
 subtitles. All the formatting information is appended into the buffer
 after the text, unlike other encoders like srt, which can write out
 styling information as it goes. Another tricky part is to take care
 of the Endianness properly while writing into the buffer.
 
 Signed-off-by: Niklesh niklesh.lalw...@iitb.ac.in
 ---
  libavcodec/movtextenc.c | 104
 +++- 1 file changed, 76
 insertions(+), 28 deletions(-)
 
 diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c
 index 1b8f454..adbe19d 100644
 --- a/libavcodec/movtextenc.c
 +++ b/libavcodec/movtextenc.c
 @@ -24,14 +24,27 @@
  #include libavutil/avassert.h
  #include libavutil/avstring.h
  #include libavutil/intreadwrite.h
 +#include libavutil/common.h
  #include ass_split.h
  #include ass.h
  
 +#define STYLE_FLAG_BOLD 1
 +#define STYLE_FLAG_ITALIC   2
 +#define STYLE_FLAG_UNDERLINE4
 +
  typedef struct {
  ASSSplitContext *ass_ctx;
 -char buffer[2048];
 -char *ptr;
 -char *end;
 +AVBPrint buffer;
 +uint32_t tsmb_size;
 +uint32_t tsmb_type;
 +uint16_t style_entries;
 +uint16_t style_start;
 +uint16_t style_end;
 +uint16_t style_fontID;
 +uint8_t style_flag;
 +uint8_t style_fontsize;
 +uint32_t style_color;
 +uint16_t text_pos;
  } MovTextContext;
  
  
 @@ -47,10 +60,10 @@ static av_cold int
 mov_text_encode_init(AVCodecContext *avctx)
 0xFF,   // int8_t vertical-justification 0x00, 0x00,
 0x00, 0x00, // uint8_t background-color-rgba[4] // BoxRecord {
 -0x00, 0x00, // int16_t top
 -0x00, 0x00, // int16_t left
 -0x00, 0x00, // int16_t bottom
 -0x00, 0x00, // int16_t right
 +0x00, 0x01, // int16_t top
 +0x00, 0x01, // int16_t left
 +0x00, 0x1E, // int16_t bottom
 +0x00, 0xC8, // int16_t right

Leave this part out of this diff. We'll deal with sizing later.

  // };
  // StyleRecord {
  0x00, 0x00, // uint16_t startChar
 @@ -79,32 +92,54 @@ static av_cold int
 mov_text_encode_init(AVCodecContext *avctx) if (!avctx-extradata)
  return AVERROR(ENOMEM);
  
 +av_bprint_init(s-buffer, 0, AV_BPRINT_SIZE_UNLIMITED);
 +
  memcpy(avctx-extradata, text_sample_entry,
 avctx-extradata_size); 
  s-ass_ctx = ff_ass_split(avctx-subtitle_header);
  return s-ass_ctx ? 0 : AVERROR_INVALIDDATA;
  }
  
 +static void mov_text_style_cb(void *priv, const char style, int
 close) +{
 +MovTextContext *s = priv;
 +s-tsmb_type = MKTAG('s','t','y','l');

You don't need to do this. Use a simple boolean flag to indicate if any
styles were generated.

 +if (!close) {
 +s-style_start = AV_RB16(s-text_pos);
 +switch (style){
 +case 'b':
 +s-style_flag += STYLE_FLAG_BOLD;
 +break;
 +case 'i':
 +s-style_flag += STYLE_FLAG_ITALIC;
 +break;
 +case 'u':
 +s-style_flag += STYLE_FLAG_UNDERLINE;
 +break;
 +}
 +} else {
 +s-style_end = AV_RB16(s-text_pos);
 +}
 +}

You are only storing a single set of style properties. So if multiple
styles are used in the original subtitles, only the last one will take
effect. You need to build up an array of style entries.

  static void mov_text_text_cb(void *priv, const char *text, int len)
  {
  MovTextContext *s = priv;
 -av_assert0(s-end = s-ptr);
 -av_strlcpy(s-ptr, text, FFMIN(s-end - s-ptr, len + 1));
 -s-ptr += FFMIN(s-end - s-ptr, len);
 +av_bprint_append_data(s-buffer, text, len);
 +s-text_pos += len;
  }
  
  static void mov_text_new_line_cb(void *priv, int forced)
  {
  MovTextContext *s = priv;
 -av_assert0(s-end = s-ptr);
 -av_strlcpy(s-ptr, \n, FFMIN(s-end - s-ptr, 2));
 -if (s-end  s-ptr)
 -s-ptr++;
 +av_bprint_append_data(s-buffer, \n, 2);
 +s-text_pos += 2;
  }
  
  static const ASSCodesCallbacks mov_text_callbacks = {
  .text = mov_text_text_cb,
  .new_line = mov_text_new_line_cb,
 +.style= mov_text_style_cb,
  };
  
  static int mov_text_encode_frame(AVCodecContext *avctx, unsigned
 char *buf, @@ -112,10 +147,9 @@ static int
 mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf, {
  MovTextContext *s = avctx-priv_data;
  ASSDialog *dialog;
 -int i, len, num;
 +int i, num;
  
 -s-ptr = s-buffer;
 -s-end = s-ptr + sizeof(s-buffer);
 +av_bprint_clear(s-buffer);
  
  for (i = 0; i  sub-num_rects; i++) {
  
 @@ -123,33 +157,47 @@ static int mov_text_encode_frame(AVCodecContext
 *avctx, unsigned char *buf, av_log(avctx, AV_LOG_ERROR, 

Re: [FFmpeg-devel] [PATCH] libavcodec/pcm-dvd: support a subset of AOB

2015-06-11 Thread Carl Eugen Hoyos
On Thursday 11 June 2015 05:05:48 am Michael Niedermayer wrote:
 Fixes Ticket2758

 +if (avctx-bits_per_coded_sample != 16) {
 +avpriv_request_sample(avctx, Unsupported sample size\n);

24bit sample is available:
http://samples.ffmpeg.org/DVD-Audio/ats.AOB

Attached is a variant of my patch from years ago, 
the lavc part is a revert of an earlier codec removal.

This should be a separate codec imo because 
remuxing to mpeg-ts will fail badly iirc.

Carl Eugen
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 4aeb57a..f261ce7 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -359,6 +359,7 @@ enum AVCodecID {
 AV_CODEC_ID_PCM_S24LE_PLANAR = MKBETAG(24,'P','S','P'),
 AV_CODEC_ID_PCM_S32LE_PLANAR = MKBETAG(32,'P','S','P'),
 AV_CODEC_ID_PCM_S16BE_PLANAR = MKBETAG('P','S','P',16),
+AV_CODEC_ID_PCM_AOB = MKBETAG('P','A','O','B'),
 
 /* various ADPCM codecs */
 AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index 0a4ad0b..3549a66 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -302,6 +302,17 @@ static int pcm_decode_frame(AVCodecContext *avctx, void 
*data,
 /* we process 40-bit blocks per channel for LXF */
 samples_per_block = 2;
 sample_size   = 5;
+} else if (avctx-codec_id == AV_CODEC_ID_PCM_AOB) {
+if (avctx-bits_per_coded_sample != 20 
+avctx-bits_per_coded_sample != 24) {
+av_log(avctx, AV_LOG_ERROR,
+   PCM DVD unsupported sample depth %i\n,
+   avctx-bits_per_coded_sample);
+return AVERROR(EINVAL);
+}
+/* 2 samples are interleaved per block in PCM_DVD */
+samples_per_block = 2;
+sample_size   = avctx-bits_per_coded_sample * 2 / 8;
 }
 
 if (sample_size == 0) {
@@ -459,6 +470,37 @@ static int pcm_decode_frame(AVCodecContext *avctx, void 
*data,
 samples += 2;
 }
 break;
+case AV_CODEC_ID_PCM_AOB:
+{
+const uint8_t *src8;
+dst_int32_t = (int32_t *)frame-data[0];
+n /= avctx-channels;
+switch (avctx-bits_per_coded_sample) {
+case 20:
+while (n--) {
+c= avctx-channels;
+src8 = src + 4 * c;
+while (c--) {
+*dst_int32_t++ = (bytestream_get_be16(src)  16) + 
((*src80xf0)   8);
+*dst_int32_t++ = (bytestream_get_be16(src)  16) + 
((*src8++  0x0f)  12);
+}
+src = src8;
+}
+break;
+case 24:
+while (n--) {
+c= avctx-channels;
+src8 = src + 4 * c;
+while (c--) {
+*dst_int32_t++ = (bytestream_get_be16(src)  16) + 
((*src8++)  8);
+*dst_int32_t++ = (bytestream_get_be16(src)  16) + 
((*src8++)  8);
+}
+src = src8;
+}
+break;
+}
+break;
+}
 case AV_CODEC_ID_PCM_LXF:
 {
 int i;
@@ -541,6 +583,7 @@ AVCodec ff_ ## name_ ## _decoder = {
\
 
 /* Note: Do not forget to add new entries to the Makefile as well. */
 PCM_CODEC  (PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, PCM A-law 
/ G.711 A-law);
+PCM_DECODER(PCM_AOB,  AV_SAMPLE_FMT_S32, pcm_aob,  PCM signed 
20|24-bit big-endian);
 PCM_CODEC  (PCM_F32BE,AV_SAMPLE_FMT_FLT, pcm_f32be,PCM 32-bit 
floating point big-endian);
 PCM_CODEC  (PCM_F32LE,AV_SAMPLE_FMT_FLT, pcm_f32le,PCM 32-bit 
floating point little-endian);
 PCM_CODEC  (PCM_F64BE,AV_SAMPLE_FMT_DBL, pcm_f64be,PCM 64-bit 
floating point big-endian);
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index edb134f..6d6c9a9 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -611,7 +611,52 @@ skip:
 found:
 if (st-discard = AVDISCARD_ALL)
 goto skip;
-if (startcode = 0xa0  startcode = 0xaf) {
+if (av_match_ext(s-filename, aob)  lpcm_header_len  8  startcode 
== 0xa0) {
+// DVD-A LPCM audio
+int sample_rates[] = { 48000, 96000, 192000,
+   0, 0, 0, 0, 0,
+   44100, 88200, 176400,
+   0, 0, 0, 0, 0 };
+avio_skip(s-pb, 2); // Pointer to start of audio frame
+avio_skip(s-pb, 1); // Unknown
+switch (avio_r8(s-pb)  4) {
+case 2:
+st-codec-codec_id = AV_CODEC_ID_PCM_AOB;
+st-codec-bits_per_coded_sample = 24;
+break;
+case 1:
+st-codec-codec_id = AV_CODEC_ID_PCM_AOB;
+st-codec-bits_per_coded_sample = 20;
+break;
+case 0:
+st-codec-codec_id = AV_CODEC_ID_PCM_S16BE;
+st-codec-bits_per_coded_sample = 16;
+break;
+default:
+len -= 

Re: [FFmpeg-devel] [PATCH 1/2] Set subtitle track dimensions for mov_text to display the subtitles properly

2015-06-11 Thread Nicolas George
Le tridi 23 prairial, an CCXXIII, Niklesh Lalwani a écrit :
 From: Niklesh niklesh.lalw...@iitb.ac.in
 
 This patch mostly replicates the concept patch posted by Philip 
 https://ffmpeg.org/pipermail/ffmpeg-devel/2013-March/140299.html. This sets 
 the proper dimensions for the subtitle tracks, by making use of the height 
 and width of the video stream. The patch is exlained in detail in the link.
 
 Signed-off-by: Niklesh niklesh.lalw...@iitb.ac.in
 ---
  libavformat/movenc.c | 38 ++
  libavformat/movenc.h |  4 
  2 files changed, 38 insertions(+), 4 deletions(-)

I said it in the original thread and I say it again now: this is not the
proper place, it should happen in the encoder and the surrounding
applications.

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] examples/decoding_encoding: Use the AVFrame width/height for processing images after decoding

2015-06-11 Thread Stefano Sabatini
On date Wednesday 2015-06-10 22:21:23 +0200, Michael Niedermayer encoded:
 This is what FFmpeg / FFplay do and it is more robust
 
 Signed-off-by: Michael Niedermayer michae...@gmx.at
 ---
  doc/examples/decoding_encoding.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/doc/examples/decoding_encoding.c 
 b/doc/examples/decoding_encoding.c
 index 80da664..f6643f6 100644
 --- a/doc/examples/decoding_encoding.c
 +++ b/doc/examples/decoding_encoding.c
 @@ -521,7 +521,7 @@ static int decode_write_frame(const char *outfilename, 
 AVCodecContext *avctx,
  /* the picture is allocated by the decoder, no need to free it */
  snprintf(buf, sizeof(buf), outfilename, *frame_count);
  pgm_save(frame-data[0], frame-linesize[0],
 - avctx-width, avctx-height, buf);
 + frame-width, frame-height, buf);
  (*frame_count)++;
  }
  if (pkt-data) {
 -- 
 1.7.9.5

LGTM, thanks.
-- 
FFmpeg = Fanciful Freak Meaningless Ponderous Enhancing Ghost
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] doc/muxers: document new break_non_keyframes option

2015-06-11 Thread Stefano Sabatini
On date Tuesday 2015-06-09 06:44:51 -0500, Rodger Combs encoded:
 ---
  doc/muxers.texi | 6 ++
  1 file changed, 6 insertions(+)
 
 diff --git a/doc/muxers.texi b/doc/muxers.texi
 index ddd7c7a..95cdb8f 100644
 --- a/doc/muxers.texi
 +++ b/doc/muxers.texi
 @@ -1030,6 +1030,12 @@ segments to write. If this is selected, the output 
 segment name must
  contain a @code{strftime} function template. Default value is
  @code{0}.
  

 +@item break_non_keyframes @var{1|0}
 +If enabled, allow segments to start on frames other than keyframes. This
 +improves behavior on some players when the time between keyframes is
 +inconsistent, but may make things worse on others, and can cause some 
 oddities
 +during seeking. Defaults to @code{0}.

Can you provide a specific example? AFAIK segments starting with a
non-keyframe are not useful.
-- 
FFmpeg = Freak  Faithful Mastering Perennial Exploitable Glue
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/4] avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for AVC intra prediction functions

2015-06-11 Thread Michael Niedermayer
On Wed, Jun 10, 2015 at 07:48:39PM +0530, shivraj.pa...@imgtec.com wrote:
 From: Shivraj Patil shivraj.pa...@imgtec.com
 
 This patch adds MSA (MIPS-SIMD-Arch) optimizations for AVC intra prediction 
 functions in new file h264pred_msa.c
 Adds new generic macros (needed for this patch) in 
 libavutil/mips/generic_macros_msa.h
 
 Signed-off-by: Shivraj Patil shivraj.pa...@imgtec.com
 ---
  libavcodec/h264pred.c|   1 +
  libavcodec/h264pred.h|   2 +
  libavcodec/mips/Makefile |   2 +
  libavcodec/mips/h264dsp_mips.h   |  27 ++
  libavcodec/mips/h264pred_init_mips.c | 104 +
  libavcodec/mips/h264pred_msa.c   | 723 
 +++
  libavutil/mips/generic_macros_msa.h  |  11 +
  7 files changed, 870 insertions(+)
  create mode 100644 libavcodec/mips/h264pred_init_mips.c
  create mode 100644 libavcodec/mips/h264pred_msa.c

applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/4] avcodec/mips: MSA (MIPS-SIMD-Arch) optimizations for AVC idct functions

2015-06-11 Thread Michael Niedermayer
On Wed, Jun 10, 2015 at 07:48:40PM +0530, shivraj.pa...@imgtec.com wrote:
 From: Shivraj Patil shivraj.pa...@imgtec.com
 
 This patch adds MSA (MIPS-SIMD-Arch) optimizations for AVC idct functions in 
 new file h264idct_msa.c
 Adds new generic macros (needed for this patch) in 
 libavutil/mips/generic_macros_msa.h
 
 Signed-off-by: Shivraj Patil shivraj.pa...@imgtec.com
 ---
  libavcodec/mips/Makefile|   3 +-
  libavcodec/mips/h264dsp_init_mips.c |  15 ++
  libavcodec/mips/h264dsp_mips.h  |  24 ++
  libavcodec/mips/h264idct_msa.c  | 469 
 
  libavutil/mips/generic_macros_msa.h |  96 
  5 files changed, 606 insertions(+), 1 deletion(-)
  create mode 100644 libavcodec/mips/h264idct_msa.c

applied

thanks
[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [RFC] DXVA2 decoding and FFmpeg

2015-06-11 Thread Stefano Sabatini
On date Friday 2015-05-29 09:47:58 -0700, Timothy Gu encoded:
 On Fri, May 29, 2015 at 03:49:22PM +0200, Stefano Sabatini wrote:
[...]
   OBJS-$(CONFIG_PIXELUTILS) += x86/pixelutils_init.o  \
  diff --git a/libavutil/x86/imgutils.c b/libavutil/x86/imgutils.c
  new file mode 100644
  index 000..8b3ed0f
  --- /dev/null
  +++ b/libavutil/x86/imgutils.c
  @@ -0,0 +1,95 @@
  +/*
  + * This file is part of FFmpeg.
  + *
  + * FFmpeg 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.
  + *
  + * FFmpeg 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 FFmpeg; if not, write to the Free Software
  + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
  02110-1301 USA
  + */
  +
  +#include inttypes.h
  +#include config.h
  +#include libavutil/avassert.h
  +#include libavutil/imgutils.h
  +#include libavutil/imgutils_internal.h
  +
  +#if HAVE_SSE2
  +/* Copy 16/64 bytes from srcp to dstp loading data with the SSE=2 
  instruction
  + * load and storing data with the SSE=2 instruction store.
  + */
  +#define COPY16(dstp, srcp, load, store) \
  +__asm__ volatile (  \
  +load   0(%[src]), %%xmm1\n\
  +store  %%xmm1,0(%[dst])\n \
  +: : [dst]r(dstp), [src]r(srcp) : memory, xmm1)
  +
  +#define COPY64(dstp, srcp, load, store) \
  +__asm__ volatile (  \
  +load   0(%[src]), %%xmm1\n\
  +load  16(%[src]), %%xmm2\n\
  +load  32(%[src]), %%xmm3\n\
  +load  48(%[src]), %%xmm4\n\
  +store  %%xmm1,0(%[dst])\n \
  +store  %%xmm2,   16(%[dst])\n \
  +store  %%xmm3,   32(%[dst])\n \
  +store  %%xmm4,   48(%[dst])\n \
  +: : [dst]r(dstp), [src]r(srcp) : memory, xmm1, xmm2, 
  xmm3, xmm4)
  +#endif
  +
  +void ff_image_copy_plane_from_uswc_x86(uint8_t *dst, size_t dst_linesize,
  +  const uint8_t *src, size_t src_linesize,
  +  unsigned bytewidth, unsigned height,
  +  int cpu_flags)
  +{
  +#if !HAVE_SSSE3
 

 Are any SSSE3 instructions used?

No. I re-checked, MOVDQA/MOVDQU were introduced in SSE2, MOVNTDQA in SSE4. 

  +return av_image_copy_plane(dst, dst_linesize, src, src_linesize, 
  bytewidth, height);
  +#endif
  +
  +av_assert0(((intptr_t)dst  0x0f) == 0  (dst_linesize  0x0f) == 0);
  +
  +__asm__ volatile (mfence);
  +
  +for (unsigned y = 0; y  height; y++) {
  +const unsigned unaligned = (-(uintptr_t)src)  0x0f;
  +unsigned x = unaligned;
  +
 
  +#if HAVE_SSE42
  +if (cpu_flags  AV_CPU_FLAG_SSE4) {
 
 movntdqa is an SSE4.1 instruction, so this should work better:
 
 if (INLINE_SSE4(cpu_flags))
 
 That checks both HAVE_SSE4_INLINE and cpu_flags for AV_CPU_FLAG_SSE4.
 
 (But then like others have said new inline asm code shouldn't be added in the
 first place)

Next step would be the use of YASM, but I only want to test if the
general approach is fine (and if the API is not too specific). Also if
someone wants to step up and port it to YASM I'm all for it, since
ASM/YASM is far from being my area of expertise.
-- 
FFmpeg = Fiendish Fabulous Most Pure Evangelical God
From ec96aee1930247248a5e438171c120ea3f5dbbea Mon Sep 17 00:00:00 2001
From: Stefano Sabatini stefa...@gmail.com
Date: Fri, 15 May 2015 18:58:17 +0200
Subject: [PATCH] lavu/imgutils: add av_image_copy_plane_from_uswc() function.

This function allows support to optimized GPU to CPU.

Based on code from vlc dxva2.c, commit 62107e56 by Laurent Aimar
fen...@videolan.org.

TODO: fix integration with the build system, update APIchanges and bump
minor once ready
---
 libavutil/imgutils.c  |  13 +
 libavutil/imgutils.h  |  18 ++
 libavutil/imgutils_internal.h |  29 ++
 libavutil/x86/Makefile|   1 +
 libavutil/x86/imgutils.c  | 126 ++
 5 files changed, 187 insertions(+)
 create mode 100644 libavutil/imgutils_internal.h
 create mode 100644 libavutil/x86/imgutils.c

diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index ef0e671..59a0054 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -30,6 +30,7 @@
 #include mathematics.h
 #include pixdesc.h
 #include rational.h
+#include imgutils_internal.h
 
 void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
 const AVPixFmtDescriptor 

Re: [FFmpeg-devel] [PATCH 2/2] Encoding of styles - Bold, Italic, Underlined for timed-text subttiles

2015-06-11 Thread Carl Eugen Hoyos
Niklesh Lalwani lalwani1994 at gmail.com writes:

 Tested on iPhone too.

Great!
(Assuming successfully)

 You might need to enable the subtitles first.

Of course.

Carl Eugen

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] encoders.texi: update libvpx documentation

2015-06-11 Thread Michael Niedermayer
On Wed, Jun 10, 2015 at 08:58:33PM -0700, James Zern wrote:
 modeled after the libx264 section.
 ---
  doc/encoders.texi | 163 
 ++
  1 file changed, 92 insertions(+), 71 deletions(-)

iam not really a docs guy but LGTM

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Contributing to the project?

2015-06-11 Thread Ronald S. Bultje
Hi George,

On Wed, Jun 10, 2015 at 11:26 AM, George Boyle geo...@thebuds.net wrote:

 Hello,

 I was wondering what is the best way to begin getting involved in
 contributing to ffmpeg/libav*? I've been a big fan of the project for
 years. I've been an observer on the mailing list, and have closely read
 the guidelines on the website, so I have a fair idea of how the
 development/review process works.

 I am a software developer with 5 years experience, mostly in Java
 (specifically web services, REST APIs among other things), but I do have
 a reasonable knowledge of C as well. I have an interest in audio/video
 codecs and formats, but little expertise and no experience in that area.
 However, I am eager to work hard and learn quickly, with minimal
 disruption, on any task that might be suitable.

 I don't want to be a burden on people's time, as I know everyone is busy
 and that you already engage in training and mentoring programs, but if
 there were some low priority tasks or tests to be written that would
 help me get my feet wet, I'd be very grateful to be pointed in that
 direction. Alternatively, if there are other channels I should engage
 with first, or upskilling I should do prior to contributing (e.g. a
 particular area of the code to study), advice to that effect would be
 very much appreciated too.


It would also be helpful if you could identify what you would like to be
doing, i.e. do you have any particular aspect that you find particularly
exciting or intriguing and would like to learn more about? E.g. you might
like one of video codecs or audio codecs or muxing formats more; you might
prefer decoding algorithms, encoding algorithms or optimizations more; you
might be more interested in the fundamentals of any one of those (either by
fixing algorithm bugs/extending algorithms to handle wider aspects of
existing formats, or by writing new codecs/(de)muxers from scratch), or
initially learning more through testing techniques (code coverage, fuzzing).

(That sounds like a lot, but it helps point you in a particular direction
if we know where you'd like to go.)

Ronald
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] avfilter/vf_colorkey: Add colorkey video filter

2015-06-11 Thread Timo Rothenpieler
---
 Changelog |   1 +
 MAINTAINERS   |   1 +
 doc/filters.texi  |  39 +++
 libavfilter/Makefile  |   1 +
 libavfilter/allfilters.c  |   1 +
 libavfilter/vf_colorkey.c | 264 ++
 6 files changed, 307 insertions(+)
 create mode 100644 libavfilter/vf_colorkey.c

diff --git a/Changelog b/Changelog
index aa5753e..9a53286 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest 
within each release,
 releases are sorted from youngest to oldest.
 
 version next:
+- colorkey video filter
 
 
 version 2.7:
diff --git a/MAINTAINERS b/MAINTAINERS
index 795e904..7b239a1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -352,6 +352,7 @@ Filters:
   avf_showcqt.c Muhammad Faiz
   vf_blend.cPaul B Mahol
   vf_colorbalance.c Paul B Mahol
+  vf_colorkey.c Timo Rothenpieler
   vf_dejudder.c Nicholas Robbins
   vf_delogo.c   Jean Delvare (CC kh...@linux-fr.org)
   vf_drawbox.c/drawgrid Andrey Utkin
diff --git a/doc/filters.texi b/doc/filters.texi
index 4b5c3c1..5696362 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3029,6 +3029,45 @@ colorbalance=rs=.3
 @end example
 @end itemize
 
+@section colorkey
+RGB colorspace color keying.
+
+The filter accepts the following options:
+
+@table @option
+@item color
+The color which will be replaced with transparency.
+
+@item similarity
+Similarity percentage with the key color.
+
+0.01 matches only the exact key color, while 1.0 matches everything.
+
+@item blend
+Blend percentage.
+
+0.0 makes pixels either fully transparent, or not transparent at all.
+
+Higher values result in semi-transparent pixels, with a higher transparency
+the more similar the pixels color is to the key color.
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+Make every green pixel in the input image transparent:
+@example
+ffmpeg -i input.png -vf colorkey=green out.png
+@end example
+
+@item
+Overlay a greenscreen-video on top of a static background image.
+@example
+ffmpeg -i background.png -i video.mp4 -filter_complex 
[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out] -map [out] 
output.flv
+@end example
+@end itemize
+
 @section colorlevels
 
 Adjust video input frames using levels.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index bf5a549..fc9f455 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -102,6 +102,7 @@ OBJS-$(CONFIG_BOXBLUR_FILTER)+= vf_boxblur.o
 OBJS-$(CONFIG_CODECVIEW_FILTER)  += vf_codecview.o
 OBJS-$(CONFIG_COLORBALANCE_FILTER)   += vf_colorbalance.o
 OBJS-$(CONFIG_COLORCHANNELMIXER_FILTER)  += vf_colorchannelmixer.o
+OBJS-$(CONFIG_COLORKEY_FILTER)   += vf_colorkey.o
 OBJS-$(CONFIG_COLORLEVELS_FILTER)+= vf_colorlevels.o
 OBJS-$(CONFIG_COLORMATRIX_FILTER)+= vf_colormatrix.o
 OBJS-$(CONFIG_COPY_FILTER)   += vf_copy.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 0244585..415ed1b 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -118,6 +118,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(CODECVIEW,  codecview,  vf);
 REGISTER_FILTER(COLORBALANCE,   colorbalance,   vf);
 REGISTER_FILTER(COLORCHANNELMIXER, colorchannelmixer, vf);
+REGISTER_FILTER(COLORKEY,   colorkey,   vf);
 REGISTER_FILTER(COLORLEVELS,colorlevels,vf);
 REGISTER_FILTER(COLORMATRIX,colormatrix,vf);
 REGISTER_FILTER(COPY,   copy,   vf);
diff --git a/libavfilter/vf_colorkey.c b/libavfilter/vf_colorkey.c
new file mode 100644
index 000..9c968e8
--- /dev/null
+++ b/libavfilter/vf_colorkey.c
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2015 Timo Rothenpieler t...@rothenpieler.org
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg 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.
+ *
+ * FFmpeg 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 FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include libavutil/opt.h
+#include avfilter.h
+#include formats.h
+#include internal.h
+#include video.h
+
+typedef struct ColorkeyContext {
+const AVClass *class;
+
+/* color offsets rgba */
+int co[4];
+
+   

[FFmpeg-devel] [PATCH 0/2] Add colorkey video filter

2015-06-11 Thread Timo Rothenpieler
Since nobody commented or objected the last time i sent this as RFC, i think
the best way to maybe get it better optimized would be merging it.

People occasionaly ask for this feature(Or rather, for greenscreens).
While this isn't yet the optimal implementation for that usecase, yuv based
chromakey would be better for that, it's a good start and a chromakey filter
would be the next thing to implement.
Using this for a greenscreen already works reasonably well, but uses a lot of
CPU power because of the conversion to rgb and back to yuv. Propably also less
than ideal for the picture quality.

There is still the open question of how to handle the format conversion this
filter does.
It seems to work as expected, as the filter chain appears to be updated when
the first frame with a diffrent format is generated, but so far i haven't
found out if it's possible to announce the mappings in advance.

I still left the float-int math conversion as seperate commit, this way, if
my conversion of the algorithm turns out to be flawed, the original algorithm
is still available as reference.
If this is not desireable, i can squash it into one commit.

Timo Rothenpieler (2):
  avfilter/vf_colorkey: Add colorkey video filter
  avfilter/vf_colorkey: Transform calculations to integer math

 Changelog |   1 +
 MAINTAINERS   |   1 +
 doc/filters.texi  |  39 +++
 libavfilter/Makefile  |   1 +
 libavfilter/allfilters.c  |   1 +
 libavfilter/vf_colorkey.c | 282 ++
 6 files changed, 325 insertions(+)
 create mode 100644 libavfilter/vf_colorkey.c

-- 
2.4.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] avfilter/vf_colorkey: Transform calculations to integer math

2015-06-11 Thread Timo Rothenpieler
---
 libavfilter/vf_colorkey.c | 36 +++-
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/libavfilter/vf_colorkey.c b/libavfilter/vf_colorkey.c
index 9c968e8..0368d7c 100644
--- a/libavfilter/vf_colorkey.c
+++ b/libavfilter/vf_colorkey.c
@@ -29,6 +29,8 @@ typedef struct ColorkeyContext {
 
 /* color offsets rgba */
 int co[4];
+int i_similarity;
+int i_blend;
 
 uint8_t colorkey_rgba[4];
 float similarity;
@@ -107,18 +109,20 @@ static int offset_a(int fmt)
 }
 }
 
+#define SHIFT 8
+
 static uint8_t do_colorkey_pixel(ColorkeyContext *ctx, uint8_t r, uint8_t g, 
uint8_t b)
 {
-int dr = (int)r - ctx-colorkey_rgba[0];
-int dg = (int)g - ctx-colorkey_rgba[1];
-int db = (int)b - ctx-colorkey_rgba[2];
+int dr = ((int)r - ctx-colorkey_rgba[0])  SHIFT;
+int dg = ((int)g - ctx-colorkey_rgba[1])  SHIFT;
+int db = ((int)b - ctx-colorkey_rgba[2])  SHIFT;
 
-double diff = sqrt((dr * dr + dg * dg + db * db) / (255.0 * 255.0));
+int diff = (int)sqrt(dr * dr + dg * dg + db * db) - ctx-i_similarity;
 
-if (ctx-blend  0.0001) {
-return av_clipd(FFMAX(diff - ctx-similarity, 0.0) / ctx-blend, 0.0, 
1.0) * 255.0;
+if (ctx-i_blend) {
+return av_clip(FFMAX(diff, 0) * ctx-i_blend, 0, 255  (SHIFT + 
SHIFT))  (SHIFT + SHIFT);
 } else {
-return ((diff - ctx-similarity)  0.0) ? 255 : 0;
+return (diff  0) ? 255 : 0;
 }
 }
 
@@ -164,7 +168,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
 return ff_filter_frame(avctx-outputs[0], frame);
 }
 
-static int config_output(AVFilterLink *outlink)
+static av_cold int config_output(AVFilterLink *outlink)
 {
 AVFilterContext *avctx = outlink-src;
 ColorkeyContext *ctx = avctx-priv;
@@ -183,7 +187,7 @@ static int config_output(AVFilterLink *outlink)
 return 0;
 }
 
-static int query_formats(AVFilterContext *avctx)
+static av_cold int query_formats(AVFilterContext *avctx)
 {
 static const enum AVPixelFormat pixel_fmts_in[] = {
 AV_PIX_FMT_0RGB,
@@ -222,6 +226,19 @@ static int query_formats(AVFilterContext *avctx)
 return 0;
 }
 
+static av_cold int init(AVFilterContext *avctx)
+{
+ColorkeyContext *ctx = avctx-priv;
+
+ctx-i_similarity = ctx-similarity * 255.0 * 1000.0;
+ctx-i_blend = (1.0 / ctx-blend) * 1000.0;
+
+ctx-i_similarity = (ctx-i_similarity  SHIFT) / 1000;
+ctx-i_blend = (ctx-i_blend  SHIFT) / 1000;
+
+return 0;
+}
+
 static const AVFilterPad colorkey_inputs[] = {
 {
 .name = default,
@@ -255,6 +272,7 @@ AVFILTER_DEFINE_CLASS(colorkey);
 AVFilter ff_vf_colorkey = {
 .name  = colorkey,
 .description   = NULL_IF_CONFIG_SMALL(colorkey filter),
+.init  = init,
 .priv_size = sizeof(ColorkeyContext),
 .priv_class= colorkey_class,
 .query_formats = query_formats,
-- 
2.4.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] Set subtitle track dimensions for mov_text to display the subtitles properly

2015-06-11 Thread Philip Langdale

On 2015-06-11 00:42, Nicolas George wrote:

Le tridi 23 prairial, an CCXXIII, Niklesh Lalwani a écrit :

From: Niklesh niklesh.lalw...@iitb.ac.in

This patch mostly replicates the concept patch posted by Philip 
https://ffmpeg.org/pipermail/ffmpeg-devel/2013-March/140299.html. This 
sets the proper dimensions for the subtitle tracks, by making use of 
the height and width of the video stream. The patch is exlained in 
detail in the link.


Signed-off-by: Niklesh niklesh.lalw...@iitb.ac.in
---
 libavformat/movenc.c | 38 ++
 libavformat/movenc.h |  4 
 2 files changed, 38 insertions(+), 4 deletions(-)


I said it in the original thread and I say it again now: this is not 
the

proper place, it should happen in the encoder and the surrounding
applications.


Yeah. I sent this to Niklesh to unblock his other work, but we need a 
proper

approach to setting the dimensions and this isn't it.

--phil
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] avfilter/vf_colorkey: Add colorkey video filter

2015-06-11 Thread Nicolas George
Le tridi 23 prairial, an CCXXIII, Timo Rothenpieler a écrit :
 +static int offset_r(int fmt)

You can use the info in AVPixFmtDescriptor for these.

 +default:
 +return 0;

av_assert0(!reached); for the default case.

 +frame-format = convert_format(frame-format);

I am not sure this is legal. It would probably be wiser to allocate a new
frame.

 +outlink-format = convert_format(avctx-inputs[0]-format);

This is really not legal. You need to return EAGAIN from query_formats()
until the input format is known.

Or you can solve both problems at once by requiring alpha on the input
format and not doing any format change at all. I find that solution is the
best.

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] Set subtitle track dimensions for mov_text to display the subtitles properly

2015-06-11 Thread Nicolas George
Le tridi 23 prairial, an CCXXIII, Philip Langdale a écrit :
 Yeah. I sent this to Niklesh to unblock his other work, but we need a proper
 approach to setting the dimensions and this isn't it.

Can you (or Niklesh) describe exactly the factors that guide the geometry of
the text on screen? IIRC, in the original thread, there was mention of a
matrix on top of the video resolution.

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] avfilter/vf_colorkey: Add colorkey video filter

2015-06-11 Thread Timo Rothenpieler
 +static int offset_r(int fmt)
 
 You can use the info in AVPixFmtDescriptor for these.

Didn't know about that, will look into it.

 +default:
 +return 0;
 
 av_assert0(!reached); for the default case.

Yep

 +frame-format = convert_format(frame-format);
 
 I am not sure this is legal. It would probably be wiser to allocate a new
 frame.

It should be fine, since the frame is made writeable and has noone else
using it. The memory layout of those pixel formats is 100% the same.

 +outlink-format = convert_format(avctx-inputs[0]-format);
 
 This is really not legal. You need to return EAGAIN from query_formats()
 until the input format is known.

Ah, so that's how it's supposed to be done!
So basicaly, i check if convert_format(avctx-inputs[0]-format) ==
avctx-outputs[0]-in_formats, and if not, return EAGAIN?

 Or you can solve both problems at once by requiring alpha on the input
 format and not doing any format change at all. I find that solution is the
 best.

Yeah, but that would insert another swscaler, and i'm not sure how well
it handles the conversion, but it propably adds another memcpy.
If it handles it without any overhead, that would propably be better.



Thanks,
Timo



signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Contributing to the project?

2015-06-11 Thread George Boyle
Hi Ronald,

On 11/06/15 17:01, Ronald S. Bultje wrote:
 
 It would also be helpful if you could identify what you would like to be
 doing, i.e. do you have any particular aspect that you find particularly
 exciting or intriguing and would like to learn more about? E.g. you might
 like one of video codecs or audio codecs or muxing formats more; you might
 prefer decoding algorithms, encoding algorithms or optimizations more; you
 might be more interested in the fundamentals of any one of those (either by
 fixing algorithm bugs/extending algorithms to handle wider aspects of
 existing formats, or by writing new codecs/(de)muxers from scratch), or
 initially learning more through testing techniques (code coverage, fuzzing).
 
 (That sounds like a lot, but it helps point you in a particular direction
 if we know where you'd like to go.)
 

Thanks for your reply. Yes, a more specific goal would be useful! In
thinking about it, there are 2 areas in particular that I find most
interesting, both originally stemming from being an avid user of the
ffmpeg command-line tool.

The first is the program itself, and the workings of the project around
it - its pace, scale and robustness. In that regard, I thought learning
about the testing system would be a good place to start. This is also
the closest thing to a match with my existing experience. Plus, I do
enjoy testing. I think the suggestion of doing some documentation would
also be a good way to get familiar with the codebase.

Second would be container formats and muxing/demuxing. The matroska and
ogg formats spring to mind, but I'd like to learn about any of them. The
idea of coding one up from scratch sounds very interesting, though I'd
need to study up a lot first.

Those would be the standouts, but I'd enjoy getting involved in any of
the things you mentioned. I'd like to do some bug-fixing too, and I keep
an eye on the tracker, but I heven't got enough knowledge to take one on
yet. Hopefully I will soon.


== tl;dr ==
I was thinking of the following ramp:
1. Start with testing and docs
2. Learn about and work on container formats and (de)muxing


Does that sound like a reasonable way to proceed?

Best wishes,
George
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] Set subtitle track dimensions for mov_text to display the subtitles properly

2015-06-11 Thread Niklesh Lalwani
Ok so it goes like this.

We first find out the height and width of the video stream from the header
box. The dimensions of the text track (subtitle track) is then set (in
pixels). Here, we have used the width equal to the width of the video, and
height equal to 1/10 of the video height.
The write matrix specifies the coordinate origin and the translation values
from the origin, ie, where to place the subtitle track. Here, we have set
tx = 0; and ty = 9/10 of the video track height.
There is also a text box inside this subtitle area, inside which the text
is rendered. For now, this is set equal to the the subtitle track
dimensions.

Philip, please correct me if I am wrong.

Thanks,

Niklesh

On Thu, Jun 11, 2015 at 11:09 PM, Nicolas George geo...@nsup.org wrote:

 Le tridi 23 prairial, an CCXXIII, Philip Langdale a écrit :
  Yeah. I sent this to Niklesh to unblock his other work, but we need a
 proper
  approach to setting the dimensions and this isn't it.

 Can you (or Niklesh) describe exactly the factors that guide the geometry
 of
 the text on screen? IIRC, in the original thread, there was mention of a
 matrix on top of the video resolution.

 Regards,

 --
   Nicolas George

 ___
 ffmpeg-devel mailing list
 ffmpeg-devel@ffmpeg.org
 http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [RFC] DXVA2 decoding and FFmpeg

2015-06-11 Thread wm4
On Thu, 11 Jun 2015 17:24:45 +0200
Stefano Sabatini stefa...@gmail.com wrote:

 Next step would be the use of YASM, but I only want to test if the
 general approach is fine (and if the API is not too specific). Also if
 someone wants to step up and port it to YASM I'm all for it, since
 ASM/YASM is far from being my area of expertise.

Personally, I'd probably just
1. export the GPU memcpy function, and
2. export a function to copy AVFrames using this function
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] avfilter/vf_colorkey: Transform calculations to integer math

2015-06-11 Thread Timo Rothenpieler
---
 libavfilter/vf_colorkey.c | 32 +---
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/libavfilter/vf_colorkey.c b/libavfilter/vf_colorkey.c
index 5db30e8..d5908de 100644
--- a/libavfilter/vf_colorkey.c
+++ b/libavfilter/vf_colorkey.c
@@ -30,6 +30,8 @@ typedef struct ColorkeyContext {
 
 /* color offsets rgba */
 int co[4];
+int i_similarity;
+int i_blend;
 
 uint8_t colorkey_rgba[4];
 float similarity;
@@ -52,18 +54,20 @@ static int convert_format(int fmt)
 }
 }
 
+#define SHIFT 8
+
 static uint8_t do_colorkey_pixel(ColorkeyContext *ctx, uint8_t r, uint8_t g, 
uint8_t b)
 {
-int dr = (int)r - ctx-colorkey_rgba[0];
-int dg = (int)g - ctx-colorkey_rgba[1];
-int db = (int)b - ctx-colorkey_rgba[2];
+int dr = ((int)r - ctx-colorkey_rgba[0])  SHIFT;
+int dg = ((int)g - ctx-colorkey_rgba[1])  SHIFT;
+int db = ((int)b - ctx-colorkey_rgba[2])  SHIFT;
 
-double diff = sqrt((dr * dr + dg * dg + db * db) / (255.0 * 255.0));
+int diff = (int)sqrt(dr * dr + dg * dg + db * db) - ctx-i_similarity;
 
-if (ctx-blend  0.0001) {
-return av_clipd(FFMAX(diff - ctx-similarity, 0.0) / ctx-blend, 0.0, 
1.0) * 255.0;
+if (ctx-i_blend) {
+return av_clip(FFMAX(diff, 0) * ctx-i_blend, 0, 255  (SHIFT + 
SHIFT))  (SHIFT + SHIFT);
 } else {
-return ((diff - ctx-similarity)  0.0) ? 255 : 0;
+return (diff  0) ? 255 : 0;
 }
 }
 
@@ -179,6 +183,19 @@ static av_cold int query_formats(AVFilterContext *avctx)
 return 0;
 }
 
+static av_cold int init(AVFilterContext *avctx)
+{
+ColorkeyContext *ctx = avctx-priv;
+
+ctx-i_similarity = ctx-similarity * 255.0 * 1000.0;
+ctx-i_blend = (1.0 / ctx-blend) * 1000.0;
+
+ctx-i_similarity = (ctx-i_similarity  SHIFT) / 1000;
+ctx-i_blend = (ctx-i_blend  SHIFT) / 1000;
+
+return 0;
+}
+
 static const AVFilterPad colorkey_inputs[] = {
 {
 .name = default,
@@ -212,6 +229,7 @@ AVFILTER_DEFINE_CLASS(colorkey);
 AVFilter ff_vf_colorkey = {
 .name  = colorkey,
 .description   = NULL_IF_CONFIG_SMALL(colorkey filter),
+.init  = init,
 .priv_size = sizeof(ColorkeyContext),
 .priv_class= colorkey_class,
 .query_formats = query_formats,
-- 
2.4.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 0/2] Add colorkey video filter

2015-06-11 Thread Timo Rothenpieler
Updated patch, following the suggested changes.

Timo Rothenpieler (2):
  avfilter/vf_colorkey: Add colorkey video filter
  avfilter/vf_colorkey: Transform calculations to integer math

 Changelog |   1 +
 MAINTAINERS   |   1 +
 doc/filters.texi  |  39 
 libavfilter/Makefile  |   1 +
 libavfilter/allfilters.c  |   1 +
 libavfilter/vf_colorkey.c | 239 ++
 6 files changed, 282 insertions(+)
 create mode 100644 libavfilter/vf_colorkey.c

-- 
2.4.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] avfilter/vf_colorkey: Add colorkey video filter

2015-06-11 Thread Timo Rothenpieler
---
 Changelog |   1 +
 MAINTAINERS   |   1 +
 doc/filters.texi  |  39 
 libavfilter/Makefile  |   1 +
 libavfilter/allfilters.c  |   1 +
 libavfilter/vf_colorkey.c | 221 ++
 6 files changed, 264 insertions(+)
 create mode 100644 libavfilter/vf_colorkey.c

diff --git a/Changelog b/Changelog
index aa5753e..9a53286 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest 
within each release,
 releases are sorted from youngest to oldest.
 
 version next:
+- colorkey video filter
 
 
 version 2.7:
diff --git a/MAINTAINERS b/MAINTAINERS
index 795e904..7b239a1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -352,6 +352,7 @@ Filters:
   avf_showcqt.c Muhammad Faiz
   vf_blend.cPaul B Mahol
   vf_colorbalance.c Paul B Mahol
+  vf_colorkey.c Timo Rothenpieler
   vf_dejudder.c Nicholas Robbins
   vf_delogo.c   Jean Delvare (CC kh...@linux-fr.org)
   vf_drawbox.c/drawgrid Andrey Utkin
diff --git a/doc/filters.texi b/doc/filters.texi
index 4b5c3c1..5696362 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3029,6 +3029,45 @@ colorbalance=rs=.3
 @end example
 @end itemize
 
+@section colorkey
+RGB colorspace color keying.
+
+The filter accepts the following options:
+
+@table @option
+@item color
+The color which will be replaced with transparency.
+
+@item similarity
+Similarity percentage with the key color.
+
+0.01 matches only the exact key color, while 1.0 matches everything.
+
+@item blend
+Blend percentage.
+
+0.0 makes pixels either fully transparent, or not transparent at all.
+
+Higher values result in semi-transparent pixels, with a higher transparency
+the more similar the pixels color is to the key color.
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+Make every green pixel in the input image transparent:
+@example
+ffmpeg -i input.png -vf colorkey=green out.png
+@end example
+
+@item
+Overlay a greenscreen-video on top of a static background image.
+@example
+ffmpeg -i background.png -i video.mp4 -filter_complex 
[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out] -map [out] 
output.flv
+@end example
+@end itemize
+
 @section colorlevels
 
 Adjust video input frames using levels.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index bf5a549..fc9f455 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -102,6 +102,7 @@ OBJS-$(CONFIG_BOXBLUR_FILTER)+= vf_boxblur.o
 OBJS-$(CONFIG_CODECVIEW_FILTER)  += vf_codecview.o
 OBJS-$(CONFIG_COLORBALANCE_FILTER)   += vf_colorbalance.o
 OBJS-$(CONFIG_COLORCHANNELMIXER_FILTER)  += vf_colorchannelmixer.o
+OBJS-$(CONFIG_COLORKEY_FILTER)   += vf_colorkey.o
 OBJS-$(CONFIG_COLORLEVELS_FILTER)+= vf_colorlevels.o
 OBJS-$(CONFIG_COLORMATRIX_FILTER)+= vf_colormatrix.o
 OBJS-$(CONFIG_COPY_FILTER)   += vf_copy.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 0244585..415ed1b 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -118,6 +118,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(CODECVIEW,  codecview,  vf);
 REGISTER_FILTER(COLORBALANCE,   colorbalance,   vf);
 REGISTER_FILTER(COLORCHANNELMIXER, colorchannelmixer, vf);
+REGISTER_FILTER(COLORKEY,   colorkey,   vf);
 REGISTER_FILTER(COLORLEVELS,colorlevels,vf);
 REGISTER_FILTER(COLORMATRIX,colormatrix,vf);
 REGISTER_FILTER(COPY,   copy,   vf);
diff --git a/libavfilter/vf_colorkey.c b/libavfilter/vf_colorkey.c
new file mode 100644
index 000..5db30e8
--- /dev/null
+++ b/libavfilter/vf_colorkey.c
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2015 Timo Rothenpieler t...@rothenpieler.org
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg 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.
+ *
+ * FFmpeg 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 FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include libavutil/opt.h
+#include libavutil/imgutils.h
+#include avfilter.h
+#include formats.h
+#include internal.h
+#include video.h
+
+typedef struct ColorkeyContext {
+const AVClass *class;
+
+/* color