[FFmpeg-devel] [PATCH] configure: check for erf() and copysign()

2015-07-20 Thread James Almer
They are not available in some compilers.

Signed-off-by: James Almer 
---
 configure | 4 
 1 file changed, 4 insertions(+)

diff --git a/configure b/configure
index c2a9564..d4d7ae0 100755
--- a/configure
+++ b/configure
@@ -1730,7 +1730,9 @@ MATH_FUNCS="
 atan2f
 cbrt
 cbrtf
+copysign
 cosf
+erf
 exp2
 exp2f
 expf
@@ -2718,6 +2720,7 @@ cropdetect_filter_deps="gpl"
 delogo_filter_deps="gpl"
 deshake_filter_select="pixelutils"
 drawtext_filter_deps="libfreetype"
+dynaudnorm_filter_deps="copysign erf"
 ebur128_filter_deps="gpl"
 eq_filter_deps="gpl"
 fftfilt_filter_deps="avcodec"
@@ -5130,6 +5133,7 @@ check_lib math.h sin -lm && LIBM="-lm"
 disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h 
DtsCrystalHDVersion -lcrystalhd || disable crystalhd
 
 atan2f_args=2
+copysign_args=2
 ldexpf_args=2
 powf_args=2
 
-- 
2.4.5

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


Re: [FFmpeg-devel] FFmpeg/MPlayer/rtmpdump possibly searching for a new server and hosting

2015-07-20 Thread Rodney Baker
On Fri, 17 Jul 2015 03:57:03 Michael Niedermayer wrote:
> On Wed, Jul 15, 2015 at 02:46:39AM +0200, Michael Niedermayer wrote:
> > On Tue, Jul 14, 2015 at 11:42:30PM +0100, Kieran Kunhya wrote:
> > > OVH has poor quality connectivity by the way - this could lead to
> > > performance issues in some countries.
> > 
> > Has anyone done some hoster connectivity comparissions /tests ?
> > it would be interresting to see what the differences are.
> > 
> > 
> > Also which hosters/providers does the community recommand?
> 

I have had very good experiences with Digital Pacific and their prices are 
reasonable (by Australian standards, anyway). 

Worth a look.

Rodney.

-- 
==
Rodney Baker VK5ZTV
rodney.ba...@iinet.net.au
==
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] FFmpeg/MPlayer/rtmpdump possibly searching for a new server and hosting

2015-07-20 Thread Nicolas George
Le duodi 2 thermidor, an CCXXIII, Rodney Baker a écrit :
> I have had very good experiences with Digital Pacific and their prices are 
> reasonable (by Australian standards, anyway). 

They seem much more expensive than their French counterpart. For example,
comparing their first price with Online's first prices:

CPU mark 3530 vs 6530, RAM 4G vs 16G, HD 2×73 Go vs 2×1 To, and most
importantly, traffic 100 Go/month vs unlimited. All that for 99$ vs 30 EUR
per month.

Also, aren't Australian copyright laws slightly crazier than average (and
French)?

Regards,

-- 
  Nicolas George


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


[FFmpeg-devel] [PATCH] movtextenc.c: Add support for text highlighting

2015-07-20 Thread Niklesh Lalwani
From: Niklesh 

This patch adds support for secondary color changes through highlight and 
hilightcolor box.
The code is also reorganised to make it easier to read and maintain.

Signed-off-by: Niklesh 
---
 libavcodec/movtextenc.c | 164 
 1 file changed, 125 insertions(+), 39 deletions(-)

diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c
index 91b73ed..3219858 100644
--- a/libavcodec/movtextenc.c
+++ b/libavcodec/movtextenc.c
@@ -35,6 +35,10 @@
 #define STYLE_RECORD_SIZE   12
 #define SIZE_ADD10
 
+#define STYL_BOX   (1<<0)
+#define HLIT_BOX   (1<<1)
+#define HCLR_BOX   (1<<2)
+
 #define av_bprint_append_any(buf, data, size)   av_bprint_append_data(buf, 
((const char*)data), size)
 
 typedef struct {
@@ -44,14 +48,23 @@ typedef struct {
 } StyleBox;
 
 typedef struct {
+uint16_t start;
+uint16_t end;
+} HighlightBox;
+
+typedef struct {
+   uint32_t color;
+} HilightcolorBox;
+
+typedef struct {
 ASSSplitContext *ass_ctx;
 AVBPrint buffer;
 StyleBox **style_attributes;
 StyleBox *style_attributes_temp;
+HighlightBox hlit;
+HilightcolorBox hclr;
 int count;
-uint8_t style_box_flag;
-uint32_t tsmb_size;
-uint32_t tsmb_type;
+uint8_t box_flags;
 uint16_t style_entries;
 uint16_t style_fontID;
 uint8_t style_fontsize;
@@ -59,6 +72,82 @@ typedef struct {
 uint16_t text_pos;
 } MovTextContext;
 
+typedef struct {
+uint32_t type;
+void (*encode)(MovTextContext *s, uint32_t tsmb_type);
+} Box;
+
+static void mov_text_cleanup(MovTextContext *s)
+{
+int j;
+if (s->box_flags & STYL_BOX) {
+for (j = 0; j < s->count; j++) {
+av_freep(&s->style_attributes[j]);
+}
+av_freep(&s->style_attributes);
+}
+}
+
+static void encode_styl(MovTextContext *s, uint32_t tsmb_type)
+{
+int j;
+uint32_t tsmb_size;
+if (s->box_flags & STYL_BOX) {
+tsmb_size = s->count * STYLE_RECORD_SIZE + SIZE_ADD;
+tsmb_size = AV_RB32(&tsmb_size);
+s->style_entries = AV_RB16(&s->count);
+s->style_fontID = 0x00 | 0x01<<8;
+s->style_fontsize = 0x12;
+s->style_color = MKTAG(0xFF, 0xFF, 0xFF, 0xFF);
+/*The above three attributes are hard coded for now
+but will come from ASS style in the future*/
+av_bprint_append_any(&s->buffer, &tsmb_size, 4);
+av_bprint_append_any(&s->buffer, &tsmb_type, 4);
+av_bprint_append_any(&s->buffer, &s->style_entries, 2);
+for (j = 0; j < s->count; j++) {
+av_bprint_append_any(&s->buffer, 
&s->style_attributes[j]->style_start, 2);
+av_bprint_append_any(&s->buffer, 
&s->style_attributes[j]->style_end, 2);
+av_bprint_append_any(&s->buffer, &s->style_fontID, 2);
+av_bprint_append_any(&s->buffer, 
&s->style_attributes[j]->style_flag, 1);
+av_bprint_append_any(&s->buffer, &s->style_fontsize, 1);
+av_bprint_append_any(&s->buffer, &s->style_color, 4);
+}
+mov_text_cleanup(s);
+}
+}
+
+static void encode_hlit(MovTextContext *s, uint32_t tsmb_type)
+{
+uint32_t tsmb_size;
+if (s->box_flags & HLIT_BOX) {
+tsmb_size = 12;
+tsmb_size = AV_RB32(&tsmb_size);
+av_bprint_append_any(&s->buffer, &tsmb_size, 4);
+av_bprint_append_any(&s->buffer, &tsmb_type, 4);
+av_bprint_append_any(&s->buffer, &s->hlit.start, 2);
+av_bprint_append_any(&s->buffer, &s->hlit.end, 2);
+}
+}
+
+static void encode_hclr(MovTextContext *s, uint32_t tsmb_type)
+{
+uint32_t tsmb_size;
+if (s->box_flags & HCLR_BOX) {
+tsmb_size = 12;
+tsmb_size = AV_RB32(&tsmb_size);
+av_bprint_append_any(&s->buffer, &tsmb_size, 4);
+av_bprint_append_any(&s->buffer, &tsmb_type, 4);
+av_bprint_append_any(&s->buffer, &s->hclr.color, 4);
+}
+}
+
+static const Box box_types[] = {
+{ MKTAG('s','t','y','l'), encode_styl },
+{ MKTAG('h','l','i','t'), encode_hlit },
+{ MKTAG('h','c','l','r'), encode_hclr },
+};
+
+const static size_t box_count = FF_ARRAY_ELEMS(box_types);
 
 static av_cold int mov_text_encode_init(AVCodecContext *avctx)
 {
@@ -116,13 +205,13 @@ static void mov_text_style_cb(void *priv, const char 
style, int close)
 {
 MovTextContext *s = priv;
 if (!close) {
-if (s->style_box_flag == 0) {   //first style entry
+if (!(s->box_flags & STYL_BOX)) {   //first style entry
 
 s->style_attributes_temp = 
av_malloc(sizeof(*s->style_attributes_temp));
 
 if (!s->style_attributes_temp) {
 av_bprint_clear(&s->buffer);
-s->style_box_flag = 0;
+s->box_flags &= ~STYL_BOX;
 return;
 }
 
@@ -132,12 +221,11 @@ static void mov_text_style_cb(void *priv, const char 
style, int close)
 if (s->style_attributes_temp->style_flag) { //break the style 

Re: [FFmpeg-devel] [PATCH] configure: check for erf() and copysign()

2015-07-20 Thread Michael Niedermayer
On Mon, Jul 20, 2015 at 04:05:44AM -0300, James Almer wrote:
> They are not available in some compilers.
> 
> Signed-off-by: James Almer 
> ---
>  configure | 4 
>  1 file changed, 4 insertions(+)

LGTM

thanks

[...]
-- 
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] [PATCH 1/2] avfilter/x86/vf_ssim: fix some instruction comments

2015-07-20 Thread Michael Niedermayer
On Mon, Jul 20, 2015 at 12:53:36AM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavfilter/x86/vf_ssim.asm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

LGTM

thx

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

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


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


Re: [FFmpeg-devel] [PATCH] movtextenc.c: Add support for text highlighting

2015-07-20 Thread Carl Eugen Hoyos
Niklesh Lalwani  iitb.ac.in> writes:

> This patch adds support for secondary color changes 
> through highlight and hilightcolor box. The code is 
> also reorganised to make it easier to read and maintain.

If above description is correct (I did not check), 
then these should be two separate patches:
One that reorganizes the code to make it easier 
to read and maintain, and a second patch that 
adds support for colour changes etc.

Carl Eugen

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


[FFmpeg-devel] [PATCH 6/8] avcodec: Minor macro polishing

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

Signed-off-by: Nedeljko Babic 
---
 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 
 #include 
 #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[(1<<13) - 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 
+#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 !CONFIG_HARDCODED_TABLES
-
SIN

[FFmpeg-devel] Add support for SBR and PS modules in fixed point AAC decoder

2015-07-20 Thread Nedeljko Babic
All the patches from “Implementation of fixed point AAC decoder” patch set
that are not accepted yet (patches for SBR and PS module as well as some
additional patches) are rebased to the newest version so they can be
applied cleanly.

Please have a look.

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


[FFmpeg-devel] [PATCH 2/8] avcodec: Table creation for AAC_fixed_decoder (SBR-module)

2015-07-20 Thread Nedeljko Babic
From: Jovan Zelincevic 

Create tables for fixed point code.

Signed-off-by: Nedeljko Babic 
---
 libavcodec/Makefile|   5 +-
 .../{aacsbr_tablegen.c => aacsbr_fixed_tablegen.c} |   7 +-
 .../{aacsbr_tablegen.c => aacsbr_fixed_tablegen.h} |  21 +-
 libavcodec/aacsbr_tablegen.c   |   1 +
 libavcodec/aacsbr_tablegen.h   | 101 +---
 libavcodec/aacsbr_tablegen_common.h| 129 +
 libavcodec/aacsbrdata.h| 522 ++---
 7 files changed, 408 insertions(+), 378 deletions(-)
 copy libavcodec/{aacsbr_tablegen.c => aacsbr_fixed_tablegen.c} (84%)
 copy libavcodec/{aacsbr_tablegen.c => aacsbr_fixed_tablegen.h} (71%)
 create mode 100644 libavcodec/aacsbr_tablegen_common.h

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 42d908e..c47d206 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -932,6 +932,7 @@ TOOLS = fourcc2pixfmt
 HOSTPROGS = aac_tablegen\
 aacps_tablegen  \
 aacsbr_tablegen \
+aacsbr_fixed_tablegen   \
 cabac_tablegen  \
 cbrt_tablegen   \
 cbrt_fixed_tablegen \
@@ -962,7 +963,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))
@@ -975,6 +977,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_tablegen.c b/libavcodec/aacsbr_fixed_tablegen.c
similarity index 84%
copy from libavcodec/aacsbr_tablegen.c
copy to libavcodec/aacsbr_fixed_tablegen.c
index c3c0f0c..7117dbd 100644
--- a/libavcodec/aacsbr_tablegen.c
+++ b/libavcodec/aacsbr_fixed_tablegen.c
@@ -22,8 +22,9 @@
 
 #include 
 #define CONFIG_HARDCODED_TABLES 0
+#define USE_FIXED 1
 #include "libavutil/common.h"
-#include "aacsbr_tablegen.h"
+#include "aacsbr_fixed_tablegen.h"
 #include "tableprint.h"
 
 int main(void)
@@ -32,8 +33,8 @@ int main(void)
 
 write_fileheader();
 
-WRITE_ARRAY_ALIGNED("static const", 32, float, sbr_qmf_window_ds);
-WRITE_ARRAY_ALIGNED("static const", 32, float, sbr_qmf_window_us);
+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_tablegen.c b/libavcodec/aacsbr_fixed_tablegen.h
similarity index 71%
copy from libavcodec/aacsbr_tablegen.c
copy to libavcodec/aacsbr_fixed_tablegen.h
index c3c0f0c..1439ebe 100644
--- a/libavcodec/aacsbr_tablegen.c
+++ b/libavcodec/aacsbr_fixed_tablegen.h
@@ -20,20 +20,13 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include 
-#define CONFIG_HARDCODED_TABLES 0
-#include "libavutil/common.h"
-#include "aacsbr_tablegen.h"
-#include "tableprint.h"
+#ifndef AVCODEC_AACSBR_FIXED_TABLEGEN_H
+#define AVCODEC_AACSBR_FIXED_TABLEGEN_H
 
-int main(void)
-{
-aacsbr_tableinit();
+#include "aacsbr_tablegen_common.h"
 
-write_fileheader();
+#if CONFIG_HARDCODED_TABLES
+#include "libavcodec/aacsbr_fixed_tables.h"
+#endif /* CONFIG_HARDCODED_TABLES */
 
-WRITE_ARRAY_ALIGNED("static const", 32, float, sbr_qmf_window_ds);
-WRITE_ARRAY_ALIGNED("static const", 32, float, sbr_qmf_window_us);
-
-return 0;
-}
+#endif /* AVCODEC_AACSBR_FIXED_TABLEGEN_H */
diff --git a/libavcodec/aacsbr_tablegen.c b/libavcodec/aacsbr_tablegen.c
index c3c0f0c..4f58270 100644
--- a/libavcodec/aacsbr_tablegen.c
+++ b/libavcodec/aacsbr_tablegen.c
@@ -22,6 +22,7 @@
 
 #include 
 #define CONFIG_HARDCODED_TABLES 0
+#define USE_FIXED 0
 #include "libavutil/common.h"
 #include "aacsbr_tablegen.h"
 #include "tableprint.h"
diff --git a/libavcodec/aacsbr_tablegen.h b/libavcodec/aacsbr_tablegen.h
index 56fdccc..d86eba7 100644
--- a/libavcodec/aacsbr_tablegen.h
+++ b/libavcodec/aacsbr_tablegen.h
@@ -23,107 +23,10 @@
 #ifndef

[FFmpeg-devel] [PATCH 5/8] avcodec: Implementation of AAC_fixed_decoder (PS-module)

2015-07-20 Thread Nedeljko Babic
From: Djordje Pesut 

Add fixed point implementation.

Signed-off-by: Nedeljko Babic 
---
 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 f91af3f..66e3db3 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -123,12 +123,12 @@ OBJS-$(CONFIG_WMV2DSP) += wmv2dsp.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
@@ -932,6 +932,7 @@ TOOLS = fourcc2pixfmt
 
 HOSTPROGS = aac_tablegen\
 aacps_tablegen  \
+aacps_fixed_tablegen\
 aacsbr_tablegen \
 aacsbr_fixed_tablegen   \
 cabac_tablegen  \
@@ -964,7 +965,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
@@ -976,7 +977,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 AAC_MADD28(x, y, a, b) (int)int64_t)(x) 

[FFmpeg-devel] [PATCH 4/8] avcodec: Table creation for AAC_fixed_decoder (PS-module)

2015-07-20 Thread Nedeljko Babic
From: Jovan Zelincevic 

Add fixed point implementation of functions for generating tables.

Signed-off-by: Nedeljko Babic 
---
 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 
+ *
+ * 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 
+ *
+ * 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 
+#include 
+
+#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,  1073741824,   
759250125,
+ 0,  -759250125, -1073741824,  

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

2015-07-20 Thread Nedeljko Babic
From: Jovan Zelincevic 

Signed-off-by: Nedeljko Babic 
---
 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 6374f68..d29ecf4 100644
--- a/Changelog
+++ b/Changelog
@@ -20,6 +20,7 @@ version :
 - Dynamic Audio Normalizer as dynaudnorm filter
 - Reverse filter
 - Random filter
+- AAC fixed-point decoding
 
 
 version 2.7:
diff --git a/doc/general.texi b/doc/general.texi
index 617be66..a260e79 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -863,7 +863,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 07b1ae3..344391b 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  49
+#define LIBAVCODEC_VERSION_MINOR  50
 #define LIBAVCODEC_VERSION_MICRO 101
 
 #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


[FFmpeg-devel] [PATCH 7/8] tests: Add aac_fixed decoder test

2015-07-20 Thread Nedeljko Babic
Signed-off-by: Nedeljko Babic 
---
 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 1/8] avcodec: Template creation for AAC decoder (SBR-module)

2015-07-20 Thread Nedeljko Babic
From: Djordje Pesut 

Move the existing code to a new template file.

Signed-off-by: Nedeljko Babic 
---
 libavcodec/aacsbr.c| 1428 +---
 libavcodec/aacsbr.h|   45 +
 libavcodec/{aacsbr.c => aacsbr_template.c} |  377 
 libavcodec/sbrdsp.c|   75 +-
 libavcodec/sbrdsp_template.c   |   95 ++
 5 files changed, 142 insertions(+), 1878 deletions(-)
 copy libavcodec/{aacsbr.c => aacsbr_template.c} (78%)
 create mode 100644 libavcodec/sbrdsp_template.c

diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index a39b78d..766c47b 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -42,252 +42,13 @@
 #include 
 #include 
 
-#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 (sbr->bs_limiter_bands >

[FFmpeg-devel] [PATCH 3/8] avcodec: Implementation of AAC_fixed_decoder (SBR-module)

2015-07-20 Thread Nedeljko Babic
From: Djordje Pesut 

Add fixed poind code.

Signed-off-by: Nedeljko Babic 
---
 libavcodec/Makefile  |   5 +-
 libavcodec/aac.h |  52 +---
 libavcodec/aac_defines.h |  78 ++
 libavcodec/aacdec_template.c |  14 +-
 libavcodec/aacsbr.c  |   1 +
 libavcodec/aacsbr.h  |  12 +-
 libavcodec/aacsbr_fixed.c| 586 +++
 libavcodec/aacsbr_template.c | 211 
 libavcodec/lpc.h |  15 +-
 libavcodec/sbr.h |  78 +++---
 libavcodec/sbrdsp.c  |   3 +
 libavcodec/sbrdsp.h  |  36 +--
 libavcodec/sbrdsp_fixed.c| 286 +
 libavcodec/sbrdsp_template.c |  42 ++--
 libavutil/softfloat.h|   8 +
 15 files changed, 1237 insertions(+), 190 deletions(-)
 create mode 100644 libavcodec/aac_defines.h
 create mode 100644 libavcodec/aacsbr_fixed.c
 create mode 100644 libavcodec/sbrdsp_fixed.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index c47d206..f91af3f 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -126,8 +126,9 @@ OBJS-$(CONFIG_A64MULTI5_ENCODER)   += a64multienc.o 
elbg.o
 OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps.o \
   aacadtsdec.o mpeg4audio.o kbdwin.o \
   sbrdsp.o aacpsdsp.o
-OBJS-$(CONFIG_AAC_FIXED_DECODER)   += aacdec_fixed.o aactab.o \
-  aacadtsdec.o mpeg4audio.o kbdwin.o
+OBJS-$(CONFIG_AAC_FIXED_DECODER)   += aacdec_fixed.o aactab.o 
aacsbr_fixed.o \
+  aacadtsdec.o mpeg4audio.o kbdwin.o \
+  sbrdsp_fixed.o
 OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o\
   aacpsy.o aactab.o  \
   psymodel.o mpeg4audio.o kbdwin.o
diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index f6fd446..d62455d 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -30,58 +30,8 @@
 #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 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 "aac_defines.h"
 #include "libavutil/float_dsp.h"
 #include "libavutil/fixed_dsp.h"
 #include "avcodec.h"
diff --git a/libavcodec/aac_defines.h b/libavcodec/aac_defines.h
new file mode 100644
index 000..0f3905f
--- /dev/null
+++ b/libavcodec/aac_defines.h
@@ -0,0 +1,78 @@
+/*
+ * AAC defines
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_AAC_DEFINES_H
+#define AVCODEC_AAC_DEFINES_H
+
+#ifndef USE_FIXED
+#define USE_FIXED 0
+#endif
+
+#if USE_FIXED
+
+#include "libavutil/

Re: [FFmpeg-devel] [PATCH 2/2] avfilter/x86/vf_ssim: add ff_ssim_4x4_line_xop

2015-07-20 Thread Ronald S. Bultje
Hi,

On Sun, Jul 19, 2015 at 11:53 PM, James Almer  wrote:

> ~20% faster than ssse3. Also enabled for x86_32


\o/ Nice. No comments otherwise, feel free to commit if nobody else
comments.

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


Re: [FFmpeg-devel] [PATCH 1/3] aacdec: move the LTP and TNS tables out of aacdectab.h

2015-07-20 Thread Nedeljko Babic
>This commit moves the tables required for encoding and decoding
>LTP and TNS AAC files out of the decoder's standalone tables file
>and into the shared aactab.h, where they can be used by both the
>encoder and the decoder.
>
>This commit does not break the already-broken aac_fixed decoder.

Not sure I would say that it is broken, since it is not implemented fully yet...

>All of the values in aactab.* are untouched by the INTFLOAT type
>and this commit stays true to this by keeping all of the values
>as floats. This will give a heads-up to the aac_fixed maintainers
>to either keep the file as-is or to use INTFLOATS, depending on
>their choice as long as they don't break the encoder.

If this patch enters FFmpeg before rest of implementation of fixed point aac
decoder, I will do necessary rebase.

If the implementation of fixed point decoder enters first, I think that this
patch needs to be rebased, since it will break the decoder (for real this time)
and there would be unneeded additional patch to fix this.

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


Re: [FFmpeg-devel] [PATCH] conversion of FFV1 specification from lyx to markdown

2015-07-20 Thread Michael Niedermayer
On Sat, Jul 18, 2015 at 11:23:16AM -0400, Dave Rice wrote:
> 
> > On Jul 10, 2015, at 4:55 PM, Michael Niedermayer  
> > wrote:
> > 
> > On Fri, Jul 10, 2015 at 04:19:41PM -0400, Dave Rice wrote:
> >> 
> >>> On Jul 10, 2015, at 3:51 PM, Michael Niedermayer  
> >>> wrote:
> >>> 
> >>> On Fri, Jul 10, 2015 at 03:47:45PM -0400, Dave Rice wrote:
>  
> > On Jul 10, 2015, at 2:06 PM, Michael Niedermayer 
> >  wrote:
> > 
> > On Fri, Jul 10, 2015 at 07:51:20PM +0200, Michael Niedermayer wrote:
> >> On Fri, Jul 10, 2015 at 07:47:46PM +0200, Michael Niedermayer wrote:
> >>> On Fri, Jul 10, 2015 at 11:52:24AM +0200, Michael Niedermayer wrote:
>  On Thu, Jul 09, 2015 at 02:14:36PM -0400, Dave Rice wrote:
> > 
> >> On Jul 9, 2015, at 1:53 PM, Michael Niedermayer  
> >> wrote:
> >> 
> >> On Tue, Jul 07, 2015 at 11:03:39AM -0400, Dave Rice wrote:
> >>> Hi,
> >>> 
>  On Jul 7, 2015, at 10:35 AM, Michael Niedermayer 
>   wrote:
>  
>  On Thu, Jul 02, 2015 at 09:50:21AM -0400, Dave Rice wrote:
> > Hi all,
> > Last month I posted a draft of the FFV1 specification formatted 
> > in Markdown [1], whereas it currently lives in lyx. From that 
> > post there were responses in favor of the use of Markdown 
> > formatting and suggestions to not use mathml within a draft 
> > targeting an RFC specification and suggestions to update a few 
> > urls. I propose to proceed with a format conversion of the FFV1 
> > specification from lyx to Markdown and then I'll file tickets 
> > or patches to explore simplifying the mathml expressions and 
> > updating the urls. Attached is a patch to convert the 
> > formatting (but not meaning) of the FFV1 specification from lyx 
> > to markdown.
> > 
> > Best Regards,
> > Dave Rice
> > 
> > [1] 
> > http://comments.gmane.org/gmane.comp.video.ffmpeg.devel/193851
> > 
>  
>  how can this be edited and converted ?
> >>> 
> >>> Via pandoc you can get outputs that are close to the current 
> >>> ffv1.html and ffv1.pdf outputs of ffv1.lyx.
> >>> 
> >>> pandoc --mathml -s --number-sections ../ffv1.md -c lyx.css -o 
> >>> ffv1.html
> >>> pandoc -s --number-sections ../ffv1.md --latex-engine=xelatex -V 
> >>> geometry:margin=1in -o ffv1.pdf
> >>> 
> >>> I can move this info to a readme.
> >> 
> >> please do
> > 
> > Sure. Would you prefer a patch on ffmpeg-devel or a PR in github?
>  
>  whatever you prefer
> >>> 
> >>> generated files like pdf should not be checked into git.
> >>> instead add a Makefile to generate them, so a simple
> >>> make
> >>> or
> >>> make ffv1.pdf
> >>> generates the file
> >> 
> >> also the readme should document which version of markdown/pandoc
> >> this needs
> >> and something should check for that version ideally so the user
> >> is nt left wondering why "make" produces broken tables
> > 
> > reviewing the pull req
> > 
> > The conventions section 3.
> > lacks vertical alignment
>  
>  Fixed in 
>  https://github.com/MediaArea/FFV1/commit/d25fb39f7514547f72cbc13ef3851f3c9d9c0c5f
>  
> > theres an empty line after
> >  for(i=0;i  
>  Fixed in 
>  https://github.com/MediaArea/FFV1/commit/1291e6c3e90ea6816b543a9e12c08d1cbbc1f31c
>  
> >>> 
> > 4.6.2.5:
> >  log2_run[41]={JPEGLS.
> >  0,0,0,0,1,1,1,1,
> > 
> > that JPEGLS is supposed to be a link/reference/whatever but its a
> > litteral word
>  
>  I'm having trouble getting a footnote to work within a codeblock. It is 
>  feasible to use this footnote in a reference to JPEGLS in a sentence 
>  above the codeblock?
> >>> 
> >>> of course
> >>> whatever works
> >> 
> >> I don't understand the relationship between the function and the reference 
> >> to JPEG-LS. I could simply move the footnote reference to JPEGLS to 
> >> outside of the codeblock, but it would be better to also explain the 
> >> relationship at the same time. Could you provide some background as to why 
> >> JPEGLS is referenced here.
> > 
> > This table is also used by jpegls, see ff_log2_run in libavcodec
> > 
> > 
> > some other things
> > nested TOC and numbering in TOC is lost
> 
> Switching here to use pandoc's TOC features instead of maintaining them 
> manually. 
> https://github.com/MediaArea/FFV1/commit/64f643534c10ac6d680b63c75fa1b7cb670bd9c4
> 
> > in "4.6.1.4 State transition table" there should be a newline
> > before one_statei = ...
> 
> Added here: 
> https://github.com/MediaArea/FFV1/commit

Re: [FFmpeg-devel] [PATCH 1/2] avcodec: loongson constants redefined with macros

2015-07-20 Thread Michael Niedermayer
On Mon, Jul 20, 2015 at 11:25:48AM +0800, 周晓勇 wrote:
> From 9c95155e90ff5d083e56cdd2565792c9e314302a Mon Sep 17 00:00:00 2001
> From: ZhouXiaoyong 
> Date: Mon, 20 Jul 2015 10:58:30 +0800
> Subject: [PATCH 1/2] avcodec: loongson constants redefined with macros

applied

thanks

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

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


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] avcodec: loongson relocate constants of idctdsp and h264pred

2015-07-20 Thread Michael Niedermayer
On Mon, Jul 20, 2015 at 01:45:49PM +0800, 周晓勇 wrote:
> sorry, the last patch aborded, please review this one.
> because it could avoid to use load when use immediate value ff_pb_80 in 
> idctdsp_mmi.c.
> 
> ---
> From 40399677fd67087db950c7f0f8ca382e5bc2cfd2 Mon Sep 17 00:00:00 2001
> From: ZhouXiaoyong 
> Date: Mon, 20 Jul 2015 11:07:05 +0800
> Subject: [PATCH 2/2] avcodec: loongson relocate constants of idctdsp and
>  h264pred
> 
> Signed-off-by: ZhouXiaoyong 
> ---
>  libavcodec/mips/constants.c|  5 
>  libavcodec/mips/constants.h|  5 
>  libavcodec/mips/h264pred_mmi.c | 61 
> --
>  libavcodec/mips/idctdsp_mmi.c  |  8 +++---
>  4 files changed, 36 insertions(+), 43 deletions(-)

applied

thanks

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

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus


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


[FFmpeg-devel] Adding myself as maintainer for qsv*

2015-07-20 Thread Ivan Uskov
Hello All,

I have added myself as maintainer for qsv* part.
Please review.
  

-- 
Best regards,
 Ivan  mailto:ivan.us...@nablet.com

0001-Adding-myself-as-maintainer-for-qsv.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] apng: Fix typos in decoder causing incorrect results

2015-07-20 Thread Paul B Mahol
On 7/19/15, Michael Niedermayer  wrote:
> On Sun, Jul 19, 2015 at 06:34:06PM +, Donny Yang wrote:
>> Signed-off-by: Donny Yang 
>> ---
>>  libavcodec/pngdec.c | 11 ++-
>>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> works with the files i tested
> ill leave review and apply to paul
>
> thx

applied

>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Good people do not need laws to tell them to act responsibly, while bad
> people will find a way around the laws. -- Plato
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] libavcodec/qsvdec.c: missed MFXVideoDECODE_Close() call

2015-07-20 Thread Ivan Uskov
Hello All,

Current implementation never calls MFXVideoDECODE_Close() at decoding
done that may be a reason of resource leak. The attached patch solves
this issue. Please review.

  

-- 
Best regards,
 Ivan  mailto:ivan.us...@nablet.com

0001-libavcodec-qsvdec.c-missed-MFXVideoDECODE_Close-call.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] libavcodec/qsvdec_h264.c: SPS parsing now performs by MFXVideoDECODE_DecodeHeader() into libavcodec/qsvdec.c

2015-07-20 Thread Ivan Uskov
Hello Michael,

Unfortunately, I do not received any feedback from both persons which
maintain libavcodec/qsvdec_h264.c about details of current
implementation. I still believe this is just defect of initial
design.
As I can see the  libavcodec/qsvdec.c was changed recently by commit
f929081f2e64d979fd8c58b17705e9554f99baf9 so current patch does
conflict now. I will prepare another patch with same task some later.


-- 
Best regards,
 Ivanmailto:ivan.us...@nablet.com

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


Re: [FFmpeg-devel] [PATCH 1/3] aacdec: move the LTP and TNS tables out of aacdectab.h

2015-07-20 Thread Rostislav Pehlivanov
Thanks for your response.
If you are okay with it then it would make sense to push this patch to
master first then because you have to rebase aactab.* to INTFLOATs anyway.

Could you consider moving ltp.c into the aacdec_template.c file? It's
relatively short (compared to the decoder source) and it's only used a
single time in the entire libavcodec by the aac decoder? Perhaps you can
just inline the whole function in the decoder. When compiling aacdec_fixed
it prints a warning saying it expects float * rather than an INTFLOAT *.

On 20 July 2015 at 12:50, Nedeljko Babic  wrote:

> >This commit moves the tables required for encoding and decoding
> >LTP and TNS AAC files out of the decoder's standalone tables file
> >and into the shared aactab.h, where they can be used by both the
> >encoder and the decoder.
> >
> >This commit does not break the already-broken aac_fixed decoder.
>
> Not sure I would say that it is broken, since it is not implemented fully
> yet...
>
> >All of the values in aactab.* are untouched by the INTFLOAT type
> >and this commit stays true to this by keeping all of the values
> >as floats. This will give a heads-up to the aac_fixed maintainers
> >to either keep the file as-is or to use INTFLOATS, depending on
> >their choice as long as they don't break the encoder.
>
> If this patch enters FFmpeg before rest of implementation of fixed point
> aac
> decoder, I will do necessary rebase.
>
> If the implementation of fixed point decoder enters first, I think that
> this
> patch needs to be rebased, since it will break the decoder (for real this
> time)
> and there would be unneeded additional patch to fix this.
>
> Thanks,
> - Nedeljko
___
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 VP9 lpf functions

2015-07-20 Thread Shivraj Patil

Hi,

On Thu, Jul 9, 2015 at 9:15 AM, 
mailto:shivraj.pa...@imgtec.com>> wrote:
+if (__msa_test_bz_v(flat)) {
+p1_d = __msa_copy_u_d((v2i64) p1_out, 0);
+p0_d = __msa_copy_u_d((v2i64) p0_out, 0);
+q0_d = __msa_copy_u_d((v2i64) q0_out, 0);
+q1_d = __msa_copy_u_d((v2i64) q1_out, 0);
+SD4(p1_d, p0_d, q0_d, q1_d, (src - 2 * pitch), pitch);
+} else {

Can you elaborate on what this does? Does it check that none of the pixels in 
the vector of cols/rows has flat=1, and takes a shortcut if that's true? Of 
something else? (If I'm right in my assumption, can you please add a comment to 
that effect?)

Your assumption is correct. I will add appropriate comments.

+static void vp9_lpf_vertical_16_dual_msa(uint8_t *src, int32_t pitch,
+ uint8_t *b_limit_ptr,
+ uint8_t *limit_ptr,
+ uint8_t *thresh_ptr)
+{
+uint8_t early_exit = 0;
+uint8_t transposed_input[16 * 24] ALLOC_ALIGNED(ALIGNMENT);
+uint8_t *filter48 = &transposed_input[16 * 16];
+
+vp9_transpose_16x16((src - 8), pitch, &transposed_input[0], 16);
+
+early_exit = vp9_vt_lpf_t4_and_t8_16w((transposed_input + 16 * 8),
+  &filter48[0], src, pitch,
+  b_limit_ptr, limit_ptr, thresh_ptr);
+
+if (0 == early_exit) {
+early_exit = vp9_vt_lpf_t16_16w((transposed_input + 16 * 8), src, 
pitch,
+&filter48[0]);
+
+if (0 == early_exit) {
+vp9_transpose_16x16(transposed_input, 16, (src - 8), pitch);
+}
+}
+}

Since no state is shared between t16 and t4/t8, it suggests you're calculating 
some of the filters twice (since part of the condition of whether to apply the 
t16 filter is whether to apply the t8 filter), is that true? If so, do you 
think it's worth modifying this so the check on whether to run t4 or t8 is not 
re-evaluated in t16?

t4 and t8 are not re-evaluated in t16 filter function “vp9_vt_lpf_t16_16w”.
t4 and t8 filters are applied in function “vp9_vt_lpf_t4_and_t8_16w” and output 
is stored at location pointed by “filter48”, which is later used in t16 
function based on early exit flag.

+void ff_loop_filter_v_84_16_msa(uint8_t *src, ptrdiff_t stride,
+int32_t e, int32_t i, int32_t h)
+{
+uint8_t e1, i1, h1;
+uint8_t e2, i2, h2;
+
+e1 = e & 0xff;
+i1 = i & 0xff;
+h1 = h & 0xff;
+
+e2 = e >> 8;
+i2 = i >> 8;
+h2 = h >> 8;
+
+vp9_lpf_horizontal_8_msa(src, stride, &e1, &i1, &h1, 1);
+vp9_lpf_horizontal_4_msa(src + 8, stride, &e2, &i2, &h2, 1);
+}

So I think you're missing the point of why this exists. The simd code for e.g. 
88_16 suggests you're capable of doing 16 pixels at once in a single iteration, 
right? The idea here is that you can use the fact that t4 is a strict subset of 
t8 to run them both in the same iteration, with simply a mask at the end to 
assure that "whether to run t8 or t4" for the t4 half of the pixels is always 
0. Look at the x86 simd code for details on how that would work exactly.

Agreed, will incorporate the same.

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


[FFmpeg-devel] [PATCH v3] Add support for TEA (Tiny Encryption Algorithm)

2015-07-20 Thread Vesselin Bontchev
From 492262598aa5d029b6bd9c8da4ccdfad4403bc83 Mon Sep 17 00:00:00 2001
From: Vesselin Bontchev 
Date: Sun, 19 Jul 2015 22:25:53 +0200
Subject: [PATCH] Add support for TEA (Tiny Encryption Algorithm)

---
 libavutil/Makefile   |3 +
 libavutil/tea.c  |  213 ++
 libavutil/tea.h  |   71 
 tests/fate/libavutil.mak |4 +
 tests/ref/fate/tea   |1 +
 5 files changed, 292 insertions(+)
 create mode 100644 libavutil/tea.c
 create mode 100644 libavutil/tea.h
 create mode 100644 tests/ref/fate/tea

diff --git a/libavutil/Makefile b/libavutil/Makefile
index 6fa810e..70f8bae 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -63,6 +63,7 @@ HEADERS = adler32.h \
   twofish.h \
   version.h \
   xtea.h\
+  tea.h \
 
 HEADERS-$(CONFIG_LZO)   += lzo.h
 
@@ -135,6 +136,7 @@ OBJS = adler32.o\
utils.o  \
xga_font_data.o  \
xtea.o   \
+   tea.o\
 
 OBJS-$(!HAVE_ATOMICS_NATIVE)+= atomic.o \
 
@@ -192,6 +194,7 @@ TESTPROGS = adler32 \
 twofish \
 utf8\
 xtea\
+tea \
 
 TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo
 
diff --git a/libavutil/tea.c b/libavutil/tea.c
new file mode 100644
index 000..bf76718
--- /dev/null
+++ b/libavutil/tea.c
@@ -0,0 +1,213 @@
+/*
+ * A 32-bit implementation of the TEA algorithm
+ * Copyright (c) 2015 Vesselin Bontchev
+ *
+ * Loosely based on the implementation of David Wheeler and Roger Needham,
+ * https://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm#Reference_code
+ *
+ * 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 "avutil.h"
+#include "common.h"
+#include "intreadwrite.h"
+#include "tea.h"
+
+typedef struct AVTEA {
+uint32_t key[16];
+int rounds;
+} AVTEA;
+
+struct AVTEA *av_tea_alloc(void)
+{
+return av_mallocz(sizeof(struct AVTEA));
+}
+
+const int av_tea_size = sizeof(AVTEA);
+
+void av_tea_init(AVTEA *ctx, const uint8_t key[16], int rounds)
+{
+int i;
+
+for (i = 0; i < 4; i++)
+ctx->key[i] = AV_RB32(key + (i << 2));
+
+ctx->rounds = rounds;
+}
+
+static void tea_crypt_ecb(AVTEA *ctx, uint8_t *dst, const uint8_t *src,
+  int decrypt, uint8_t *iv)
+{
+uint32_t v0, v1;
+int rounds = ctx->rounds;
+uint32_t k0, k1, k2, k3;
+k0 = ctx->key[0];
+k1 = ctx->key[1];
+k2 = ctx->key[2];
+k3 = ctx->key[3];
+
+v0 = AV_RB32(src);
+v1 = AV_RB32(src + 4);
+
+if (decrypt) {
+int i;
+uint32_t delta = 0x9E3779B9U, sum = delta * (rounds / 2);
+
+for (i = 0; i < rounds / 2; i++) {
+v1 -= ((v0 << 4) + k2) ^ (v0 + sum) ^ ((v0 >> 5) + k3);
+v0 -= ((v1 << 4) + k0) ^ (v1 + sum) ^ ((v1 >> 5) + k1);
+sum -= delta;
+}
+if (iv) {
+v0 ^= AV_RB32(iv);
+v1 ^= AV_RB32(iv + 4);
+memcpy(iv, src, 8);
+}
+} else {
+int i;
+uint32_t sum = 0, delta = 0x9E3779B9U;
+
+for (i = 0; i < rounds / 2; i++) {
+sum += delta;
+v0 += ((v1 << 4) + k0) ^ (v1 + sum) ^ ((v1 >> 5) + k1);
+v1 += ((v0 << 4) + k2) ^ (v0 + sum) ^ ((v0 >> 5) + k3);
+}
+}
+
+AV_WB32(dst, v0);
+AV_WB32(dst + 4, v1);
+}
+
+void av_tea_crypt(AVTEA *ctx, uint8_t *dst, const uint8_t *src, int coun

Re: [FFmpeg-devel] [PATCH v2] Add support for TEA (Tiny Encryption Algorithm)

2015-07-20 Thread Vesselin Bontchev


20.07.2015, 04:15, "Michael Niedermayer" :
> On Mon, Jul 20, 2015 at 02:16:28AM +0300, Vesselin Bontchev wrote:
>>
>>  Date: Sun, 19 Jul 2015 22:25:53 +0200
>>  Subject: [PATCH] Add support for TEA (Tiny Encryption Algorithm)
>
> fails fate test
> reference file './tests/ref/fate/tea' not found

Oops, the new patch revision (v3) should fix this problem.

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


Re: [FFmpeg-devel] [PATCH] movtextdec.c: Correct the highlight tags

2015-07-20 Thread Philip Langdale
On Fri, 17 Jul 2015 16:03:09 +0530
Niklesh Lalwani  wrote:

> From: Niklesh 
> 
> Signed-off-by: Niklesh 
> ---
>  libavcodec/movtextdec.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
> index d564cf1..ca02107 100644
> --- a/libavcodec/movtextdec.c
> +++ b/libavcodec/movtextdec.c
> @@ -181,14 +181,14 @@ static int text_to_ass(AVBPrint *buf, const
> char *text, const char *text_end, av_bprintf(buf,
> "{\\2c&H%02x%02x%02x&}", m->c.hlit_color[2], m->c.hlit_color[1],
> m->c.hlit_color[0]); } else {
> -av_bprintf(buf, "{\\1c&H00&}{\\2c&HFF}");
> +av_bprintf(buf,
> "{\\1c&H00&}{\\2c&HFF&}"); }
>  }
>  if (text_pos == m->h.hlit_end) {
>  if (m->box_flags & HCLR_BOX) {
> -av_bprintf(buf, "{\\2c&H00}");
> +av_bprintf(buf, "{\\2c&H00&}");
>  } else {
> -av_bprintf(buf, "{\\1c&HFF&}{\\2c&H00}");
> +av_bprintf(buf,
> "{\\1c&HFF&}{\\2c&H00&}"); }
>  }
>  }

Pushed, thanks.


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


Re: [FFmpeg-devel] [PATCH 2/8] avcodec: Table creation for AAC_fixed_decoder (SBR-module)

2015-07-20 Thread Michael Niedermayer
On Mon, Jul 20, 2015 at 01:36:16PM +0200, Nedeljko Babic wrote:
> From: Jovan Zelincevic 
> 
> Create tables for fixed point code.
> 
> Signed-off-by: Nedeljko Babic 
> ---
>  libavcodec/Makefile|   5 +-
>  .../{aacsbr_tablegen.c => aacsbr_fixed_tablegen.c} |   7 +-
>  .../{aacsbr_tablegen.c => aacsbr_fixed_tablegen.h} |  21 +-
>  libavcodec/aacsbr_tablegen.c   |   1 +
>  libavcodec/aacsbr_tablegen.h   | 101 +---
>  libavcodec/aacsbr_tablegen_common.h| 129 +
>  libavcodec/aacsbrdata.h| 522 
> ++---
>  7 files changed, 408 insertions(+), 378 deletions(-)
>  copy libavcodec/{aacsbr_tablegen.c => aacsbr_fixed_tablegen.c} (84%)
>  copy libavcodec/{aacsbr_tablegen.c => aacsbr_fixed_tablegen.h} (71%)
>  create mode 100644 libavcodec/aacsbr_tablegen_common.h

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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/8] avcodec: Template creation for AAC decoder (SBR-module)

2015-07-20 Thread Michael Niedermayer
On Mon, Jul 20, 2015 at 01:36:15PM +0200, Nedeljko Babic wrote:
> From: Djordje Pesut 
> 
> Move the existing code to a new template file.
> 
> Signed-off-by: Nedeljko Babic 

applied

thanks

[...]
-- 
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


Re: [FFmpeg-devel] [PATCH 3/8] avcodec: Implementation of AAC_fixed_decoder (SBR-module)

2015-07-20 Thread Michael Niedermayer
On Mon, Jul 20, 2015 at 01:36:17PM +0200, Nedeljko Babic wrote:
> From: Djordje Pesut 
> 
> Add fixed poind code.
> 
> Signed-off-by: Nedeljko Babic 
> ---
>  libavcodec/Makefile  |   5 +-
>  libavcodec/aac.h |  52 +---
>  libavcodec/aac_defines.h |  78 ++
>  libavcodec/aacdec_template.c |  14 +-
>  libavcodec/aacsbr.c  |   1 +
>  libavcodec/aacsbr.h  |  12 +-
>  libavcodec/aacsbr_fixed.c| 586 
> +++
>  libavcodec/aacsbr_template.c | 211 
>  libavcodec/lpc.h |  15 +-
>  libavcodec/sbr.h |  78 +++---
>  libavcodec/sbrdsp.c  |   3 +
>  libavcodec/sbrdsp.h  |  36 +--
>  libavcodec/sbrdsp_fixed.c| 286 +
>  libavcodec/sbrdsp_template.c |  42 ++--
>  libavutil/softfloat.h|   8 +
>  15 files changed, 1237 insertions(+), 190 deletions(-)
>  create mode 100644 libavcodec/aac_defines.h
>  create mode 100644 libavcodec/aacsbr_fixed.c
>  create mode 100644 libavcodec/sbrdsp_fixed.c

applied

thanks

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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


Re: [FFmpeg-devel] Adding myself as maintainer for qsv*

2015-07-20 Thread Michael Niedermayer
On Mon, Jul 20, 2015 at 04:32:38PM +0300, Ivan Uskov wrote:
> Hello All,
> 
> I have added myself as maintainer for qsv* part.
> Please review.
>   
> 
> -- 
> Best regards,
>  Ivan  mailto:ivan.us...@nablet.com

>  MAINTAINERS |1 +
>  1 file changed, 1 insertion(+)
> 1b6664dac28bc8b70a9086e91e092fc13b43f655  
> 0001-Adding-myself-as-maintainer-for-qsv.patch
> From 9c64060b81603253ecd20d19e91718eac18b726c Mon Sep 17 00:00:00 2001
> From: Ivan Uskov 
> Date: Fri, 17 Jul 2015 04:38:57 -0400
> Subject: [PATCH] Adding myself as maintainer for qsv*

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


Re: [FFmpeg-devel] [PATCH 1/3] aacdec: move the LTP and TNS tables out of aacdectab.h

2015-07-20 Thread Nedeljko Babic
>Thanks for your response.
>If you are okay with it then it would make sense to push this patch to
>master first then because you have to rebase aactab.* to INTFLOATs anyway.
>

I am ok with that.

As I said, I don't have a problem to make necessary changes to my patch set if
this patch is accepted first.

And it will probably be accepted first anyhow :)

>Could you consider moving ltp.c into the aacdec_template.c file? It's
>relatively short (compared to the decoder source) and it's only used a
>single time in the entire libavcodec by the aac decoder? Perhaps you can
>just inline the whole function in the decoder. When compiling aacdec_fixed
>it prints a warning saying it expects float * rather than an INTFLOAT *.

ltp.c? Are you sure that is the name of the file that is causing a problem?

The only warning of that type that I am having while building is in 
aacdec_template.c
and that is for ff_aac_eld_window_480 table.

The reason for this warning I explained in one of my previous mails.

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


Re: [FFmpeg-devel] [PATCH] configure: check for erf() and copysign()

2015-07-20 Thread James Almer
On 20/07/15 6:50 AM, Michael Niedermayer wrote:
> On Mon, Jul 20, 2015 at 04:05:44AM -0300, James Almer wrote:
>> They are not available in some compilers.
>>
>> Signed-off-by: James Almer 
>> ---
>>  configure | 4 
>>  1 file changed, 4 insertions(+)
> 
> LGTM
> 
> thanks

Pushed.

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


Re: [FFmpeg-devel] [PATCH 2/2] avfilter/x86/vf_ssim: add ff_ssim_4x4_line_xop

2015-07-20 Thread James Almer
On 20/07/15 8:45 AM, Ronald S. Bultje wrote:
> Hi,
> 
> On Sun, Jul 19, 2015 at 11:53 PM, James Almer  wrote:
> 
>> ~20% faster than ssse3. Also enabled for x86_32
> 
> 
> \o/ Nice. No comments otherwise, feel free to commit if nobody else
> comments.
> 
> Ronald

Pushed then, thanks.

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


Re: [FFmpeg-devel] [PATCH 1/2] avfilter/x86/vf_ssim: fix some instruction comments

2015-07-20 Thread James Almer
On 20/07/15 7:05 AM, Michael Niedermayer wrote:
> On Mon, Jul 20, 2015 at 12:53:36AM -0300, James Almer wrote:
>> Signed-off-by: James Almer 
>> ---
>>  libavfilter/x86/vf_ssim.asm | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> LGTM
> 
> thx

Pushed.

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


Re: [FFmpeg-devel] [PATCH 3/3] avdevice/decklink: Add support for decoding 8-bit RGB formats.

2015-07-20 Thread Reuben Martin
On Sunday, July 19, 2015 02:50:23 PM Chris Spencer wrote:
> On 19 July 2015 at 14:30, Carl Eugen Hoyos  wrote:
> > Chris Spencer  gmail.com> writes:
> >> > > +} else if (cctx->pixel_format == AV_PIX_FMT_ARGB) {
> >> > > +ctx->bmd_format = bmdFormat8BitARGB;
> >> > > +} else if (cctx->pixel_format == AV_PIX_FMT_BGRA) {
> >> > > +ctx->bmd_format = bmdFormat8BitBGRA;
> >> > > 
> >> > > +} else if (ctx->bmd_format == bmdFormat8BitARGB) {
> >> > > +st->codec->codec_id= AV_CODEC_ID_RAWVIDEO;
> >> > > +st->codec->pix_fmt = AV_PIX_FMT_ARGB;
> >> > > +st->codec->codec_tag   = MKTAG('A', 'R', 'G', 'B');
> >> > > +} else if (ctx->bmd_format == bmdFormat8BitBGRA) {
> >> > > +st->codec->codec_id= AV_CODEC_ID_RAWVIDEO;
> >> > > +st->codec->pix_fmt = AV_PIX_FMT_BGRA;
> >> > > +st->codec->codec_tag   = MKTAG('B', 'G', 'R', 'A');
> >> > 
> >> > I would have expected these to be AV_PIX_FMT_0RGB and
> >> > AV_PIX_FMT_BGR0.
> >> 
> >> The Blackmagic documentation is kind of strange on this
> >> one actually. For bmdFormat8BitBGRA it says "alpha
> >> channel is valid". For bmdFormat8BitBGRA it says "alpha
> >> channel may be valid". Not sure how best to deal with
> >> that to be honest.
> > 
> > Can you test?
> > Is there a theoretical possibility that the content
> > contains valid alpha? If yes, please use ARGB.
> > If not and if you can confirm that the alpha channel
> > is correctly set to 0xFF, then you may use ARGB but I
> > wonder what the usecase would be (and how probable it
> > is that a future driver would not set it to 0xFF).
> > The codec_tag looks wrong to me because it would be
> > 0x00 for AV_PIX_FMT_ARGB and AV_PIX_FMT_BGRA. I think
> > it should only be set if needed (for YV12 or similar).
> 
> Ok so with the HDMI input connected to my graphics card the alpha
> channel is zero with both ARGB and BGRA (which explains why I couldn't
> get the overlay filter to work with it now that I think about it). I
> will add bgr0 and 0rgb, but I wonder if it's worth leaving bgra and
> argb in, as the Blackmagic documentation seems to imply the alpha
> channel might be present in some situation.
> 
Alpha channel is valid in the SDI spec, although not widely supported. Perhaps 
this can be used in the SDI output from decklink “extream” models that offer 
separate sync locked outputs for key and fill? I have access to such a card if 
you would want that tested.

-Reuben

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


Re: [FFmpeg-devel] [PATCH] movtextenc.c: Add support for text highlighting

2015-07-20 Thread Niklesh Lalwani
On Mon, Jul 20, 2015 at 4:29 PM, Carl Eugen Hoyos  wrote:

> Niklesh Lalwani  iitb.ac.in> writes:
>
> > This patch adds support for secondary color changes
> > through highlight and hilightcolor box. The code is
> > also reorganised to make it easier to read and maintain.
>
> If above description is correct (I did not check),
> then these should be two separate patches:
> One that reorganizes the code to make it easier
> to read and maintain, and a second patch that
> adds support for colour changes etc.
>
> Carl Eugen
>


Okay then. I'll post these as two separate patches.

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


Re: [FFmpeg-devel] [PATCH] libavcodec/qsvdec.c: missed MFXVideoDECODE_Close() call

2015-07-20 Thread Michael Niedermayer
On Mon, Jul 20, 2015 at 04:57:36PM +0300, Ivan Uskov wrote:
> Hello All,
> 
> Current implementation never calls MFXVideoDECODE_Close() at decoding
> done that may be a reason of resource leak. The attached patch solves
> this issue. Please review.
> 
>   
> 
> -- 
> Best regards,
>  Ivan  mailto:ivan.us...@nablet.com

>  qsvdec.c |3 +++
>  1 file changed, 3 insertions(+)
> 430b51330ad44b0861b5f5275690700aee4c  
> 0001-libavcodec-qsvdec.c-missed-MFXVideoDECODE_Close-call.patch
> From a4d377bcb7a6c25d6c73b02bf4c76d3707b0f381 Mon Sep 17 00:00:00 2001
> From: Ivan Uskov 
> Date: Mon, 20 Jul 2015 09:48:29 -0400
> Subject: [PATCH] libavcodec/qsvdec.c: missed MFXVideoDECODE_Close() call
> 

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus


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


Re: [FFmpeg-devel] [PATCH] conversion of FFV1 specification from lyx to markdown

2015-07-20 Thread Dave Rice
Hi Michael,

> On Jul 20, 2015, at 7:52 AM, Michael Niedermayer  
> wrote:
> 
> On Sat, Jul 18, 2015 at 11:23:16AM -0400, Dave Rice wrote:
>> 
>>> On Jul 10, 2015, at 4:55 PM, Michael Niedermayer  
>>> wrote:
>>> 
>>> On Fri, Jul 10, 2015 at 04:19:41PM -0400, Dave Rice wrote:
 
> On Jul 10, 2015, at 3:51 PM, Michael Niedermayer  
> wrote:
> 
> On Fri, Jul 10, 2015 at 03:47:45PM -0400, Dave Rice wrote:
>> 
>>> On Jul 10, 2015, at 2:06 PM, Michael Niedermayer 
>>>  wrote:
>>> 
>>> On Fri, Jul 10, 2015 at 07:51:20PM +0200, Michael Niedermayer wrote:
 On Fri, Jul 10, 2015 at 07:47:46PM +0200, Michael Niedermayer wrote:
> On Fri, Jul 10, 2015 at 11:52:24AM +0200, Michael Niedermayer wrote:
>> On Thu, Jul 09, 2015 at 02:14:36PM -0400, Dave Rice wrote:
>>> 
 On Jul 9, 2015, at 1:53 PM, Michael Niedermayer  
 wrote:
 
 On Tue, Jul 07, 2015 at 11:03:39AM -0400, Dave Rice wrote:
> Hi,
> 
>> On Jul 7, 2015, at 10:35 AM, Michael Niedermayer 
>>  wrote:
>> 
>> On Thu, Jul 02, 2015 at 09:50:21AM -0400, Dave Rice wrote:
>>> Hi all,
>>> Last month I posted a draft of the FFV1 specification formatted 
>>> in Markdown [1], whereas it currently lives in lyx. From that 
>>> post there were responses in favor of the use of Markdown 
>>> formatting and suggestions to not use mathml within a draft 
>>> targeting an RFC specification and suggestions to update a few 
>>> urls. I propose to proceed with a format conversion of the FFV1 
>>> specification from lyx to Markdown and then I'll file tickets 
>>> or patches to explore simplifying the mathml expressions and 
>>> updating the urls. Attached is a patch to convert the 
>>> formatting (but not meaning) of the FFV1 specification from lyx 
>>> to markdown.
>>> 
>>> Best Regards,
>>> Dave Rice
>>> 
>>> [1] 
>>> http://comments.gmane.org/gmane.comp.video.ffmpeg.devel/193851
>>> 
>> 
>> how can this be edited and converted ?
> 
> Via pandoc you can get outputs that are close to the current 
> ffv1.html and ffv1.pdf outputs of ffv1.lyx.
> 
> pandoc --mathml -s --number-sections ../ffv1.md -c lyx.css -o 
> ffv1.html
> pandoc -s --number-sections ../ffv1.md --latex-engine=xelatex -V 
> geometry:margin=1in -o ffv1.pdf
> 
> I can move this info to a readme.
 
 please do
>>> 
>>> Sure. Would you prefer a patch on ffmpeg-devel or a PR in github?
>> 
>> whatever you prefer
> 
> generated files like pdf should not be checked into git.
> instead add a Makefile to generate them, so a simple
> make
> or
> make ffv1.pdf
> generates the file
 
 also the readme should document which version of markdown/pandoc
 this needs
 and something should check for that version ideally so the user
 is nt left wondering why "make" produces broken tables
>>> 
>>> reviewing the pull req
>>> 
>>> The conventions section 3.
>>> lacks vertical alignment
>> 
>> Fixed in 
>> https://github.com/MediaArea/FFV1/commit/d25fb39f7514547f72cbc13ef3851f3c9d9c0c5f
>> 
>>> theres an empty line after
>>> for(i=0;i> 
>> Fixed in 
>> https://github.com/MediaArea/FFV1/commit/1291e6c3e90ea6816b543a9e12c08d1cbbc1f31c
>> 
> 
>>> 4.6.2.5:
>>> log2_run[41]={JPEGLS.
>>> 0,0,0,0,1,1,1,1,
>>> 
>>> that JPEGLS is supposed to be a link/reference/whatever but its a
>>> litteral word
>> 
>> I'm having trouble getting a footnote to work within a codeblock. It is 
>> feasible to use this footnote in a reference to JPEGLS in a sentence 
>> above the codeblock?
> 
> of course
> whatever works
 
 I don't understand the relationship between the function and the reference 
 to JPEG-LS. I could simply move the footnote reference to JPEGLS to 
 outside of the codeblock, but it would be better to also explain the 
 relationship at the same time. Could you provide some background as to why 
 JPEGLS is referenced here.
>>> 
>>> This table is also used by jpegls, see ff_log2_run in libavcodec
>>> 
>>> 
>>> some other things
>>> nested TOC and numbering in TOC is lost
>> 
>> Switching here to use pandoc's TOC features instead of maintaining them 
>> manually. 
>> https://github.com/MediaArea/FFV1/commit/64f643534c10ac6d680b63c75fa1b7cb670bd9c4
>> 
>>> in "4.6.1.4 State transition table" there should be a newline
>>> b

[FFmpeg-devel] [PATCH 1/2] movtextenc.c: Reorganize the code for easier maintenance

2015-07-20 Thread Niklesh Lalwani
From: Niklesh 

This patch reorganizes the code to make it easier to add support for different 
text modifier boxes and other styles in the future.

Signed-off-by: Niklesh 
---
 libavcodec/movtextenc.c | 104 ++--
 1 file changed, 65 insertions(+), 39 deletions(-)

diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c
index 91b73ed..f3df6a3 100644
--- a/libavcodec/movtextenc.c
+++ b/libavcodec/movtextenc.c
@@ -35,6 +35,8 @@
 #define STYLE_RECORD_SIZE   12
 #define SIZE_ADD10
 
+#define STYL_BOX   (1<<0)
+
 #define av_bprint_append_any(buf, data, size)   av_bprint_append_data(buf, 
((const char*)data), size)
 
 typedef struct {
@@ -49,9 +51,7 @@ typedef struct {
 StyleBox **style_attributes;
 StyleBox *style_attributes_temp;
 int count;
-uint8_t style_box_flag;
-uint32_t tsmb_size;
-uint32_t tsmb_type;
+uint8_t box_flags;
 uint16_t style_entries;
 uint16_t style_fontID;
 uint8_t style_fontsize;
@@ -59,6 +59,55 @@ typedef struct {
 uint16_t text_pos;
 } MovTextContext;
 
+typedef struct {
+uint32_t type;
+void (*encode)(MovTextContext *s, uint32_t tsmb_type);
+} Box;
+
+static void mov_text_cleanup(MovTextContext *s)
+{
+int j;
+if (s->box_flags & STYL_BOX) {
+for (j = 0; j < s->count; j++) {
+av_freep(&s->style_attributes[j]);
+}
+av_freep(&s->style_attributes);
+}
+}
+
+static void encode_styl(MovTextContext *s, uint32_t tsmb_type)
+{
+int j;
+uint32_t tsmb_size;
+if (s->box_flags & STYL_BOX) {
+tsmb_size = s->count * STYLE_RECORD_SIZE + SIZE_ADD;
+tsmb_size = AV_RB32(&tsmb_size);
+s->style_entries = AV_RB16(&s->count);
+s->style_fontID = 0x00 | 0x01<<8;
+s->style_fontsize = 0x12;
+s->style_color = MKTAG(0xFF, 0xFF, 0xFF, 0xFF);
+/*The above three attributes are hard coded for now
+but will come from ASS style in the future*/
+av_bprint_append_any(&s->buffer, &tsmb_size, 4);
+av_bprint_append_any(&s->buffer, &tsmb_type, 4);
+av_bprint_append_any(&s->buffer, &s->style_entries, 2);
+for (j = 0; j < s->count; j++) {
+av_bprint_append_any(&s->buffer, 
&s->style_attributes[j]->style_start, 2);
+av_bprint_append_any(&s->buffer, 
&s->style_attributes[j]->style_end, 2);
+av_bprint_append_any(&s->buffer, &s->style_fontID, 2);
+av_bprint_append_any(&s->buffer, 
&s->style_attributes[j]->style_flag, 1);
+av_bprint_append_any(&s->buffer, &s->style_fontsize, 1);
+av_bprint_append_any(&s->buffer, &s->style_color, 4);
+}
+mov_text_cleanup(s);
+}
+}
+
+static const Box box_types[] = {
+{ MKTAG('s','t','y','l'), encode_styl },
+};
+
+const static size_t box_count = FF_ARRAY_ELEMS(box_types);
 
 static av_cold int mov_text_encode_init(AVCodecContext *avctx)
 {
@@ -116,13 +165,13 @@ static void mov_text_style_cb(void *priv, const char 
style, int close)
 {
 MovTextContext *s = priv;
 if (!close) {
-if (s->style_box_flag == 0) {   //first style entry
+if (!(s->box_flags & STYL_BOX)) {   //first style entry
 
 s->style_attributes_temp = 
av_malloc(sizeof(*s->style_attributes_temp));
 
 if (!s->style_attributes_temp) {
 av_bprint_clear(&s->buffer);
-s->style_box_flag = 0;
+s->box_flags &= ~STYL_BOX;
 return;
 }
 
@@ -132,12 +181,11 @@ static void mov_text_style_cb(void *priv, const char 
style, int close)
 if (s->style_attributes_temp->style_flag) { //break the style 
record here and start a new one
 s->style_attributes_temp->style_end = AV_RB16(&s->text_pos);
 av_dynarray_add(&s->style_attributes, &s->count, 
s->style_attributes_temp);
-
 s->style_attributes_temp = 
av_malloc(sizeof(*s->style_attributes_temp));
-
 if (!s->style_attributes_temp) {
+mov_text_cleanup(s);
 av_bprint_clear(&s->buffer);
-s->style_box_flag = 0;
+s->box_flags &= ~STYL_BOX;
 return;
 }
 
@@ -166,8 +214,9 @@ static void mov_text_style_cb(void *priv, const char style, 
int close)
 s->style_attributes_temp = 
av_malloc(sizeof(*s->style_attributes_temp));
 
 if (!s->style_attributes_temp) {
+mov_text_cleanup(s);
 av_bprint_clear(&s->buffer);
-s->style_box_flag = 0;
+s->box_flags &= ~STYL_BOX;
 return;
 }
 
@@ -187,7 +236,7 @@ static void mov_text_style_cb(void *priv, const char style, 
int close)
 s->style_attributes_temp->style_start = AV_RB16(&s->text_pos);
 }
 }
-s->style_box_flag = 1;
+s->box_flags |= STYL_BOX;
 }
 
 static void mov_text_text_cb(void *priv, con

[FFmpeg-devel] [PATCH 2/2] movtextenc.c: Add support for text highlighting

2015-07-20 Thread Niklesh Lalwani
From: Niklesh 

This patch takes care of the secondary color changes in ASS through highlight 
and hilightcolor boxes.
 
Signed-off-by: Niklesh 
---
 libavcodec/movtextenc.c | 60 +
 1 file changed, 60 insertions(+)

diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c
index f3df6a3..3219858 100644
--- a/libavcodec/movtextenc.c
+++ b/libavcodec/movtextenc.c
@@ -36,6 +36,8 @@
 #define SIZE_ADD10
 
 #define STYL_BOX   (1<<0)
+#define HLIT_BOX   (1<<1)
+#define HCLR_BOX   (1<<2)
 
 #define av_bprint_append_any(buf, data, size)   av_bprint_append_data(buf, 
((const char*)data), size)
 
@@ -46,10 +48,21 @@ typedef struct {
 } StyleBox;
 
 typedef struct {
+uint16_t start;
+uint16_t end;
+} HighlightBox;
+
+typedef struct {
+   uint32_t color;
+} HilightcolorBox;
+
+typedef struct {
 ASSSplitContext *ass_ctx;
 AVBPrint buffer;
 StyleBox **style_attributes;
 StyleBox *style_attributes_temp;
+HighlightBox hlit;
+HilightcolorBox hclr;
 int count;
 uint8_t box_flags;
 uint16_t style_entries;
@@ -103,8 +116,35 @@ static void encode_styl(MovTextContext *s, uint32_t 
tsmb_type)
 }
 }
 
+static void encode_hlit(MovTextContext *s, uint32_t tsmb_type)
+{
+uint32_t tsmb_size;
+if (s->box_flags & HLIT_BOX) {
+tsmb_size = 12;
+tsmb_size = AV_RB32(&tsmb_size);
+av_bprint_append_any(&s->buffer, &tsmb_size, 4);
+av_bprint_append_any(&s->buffer, &tsmb_type, 4);
+av_bprint_append_any(&s->buffer, &s->hlit.start, 2);
+av_bprint_append_any(&s->buffer, &s->hlit.end, 2);
+}
+}
+
+static void encode_hclr(MovTextContext *s, uint32_t tsmb_type)
+{
+uint32_t tsmb_size;
+if (s->box_flags & HCLR_BOX) {
+tsmb_size = 12;
+tsmb_size = AV_RB32(&tsmb_size);
+av_bprint_append_any(&s->buffer, &tsmb_size, 4);
+av_bprint_append_any(&s->buffer, &tsmb_type, 4);
+av_bprint_append_any(&s->buffer, &s->hclr.color, 4);
+}
+}
+
 static const Box box_types[] = {
 { MKTAG('s','t','y','l'), encode_styl },
+{ MKTAG('h','l','i','t'), encode_hlit },
+{ MKTAG('h','c','l','r'), encode_hclr },
 };
 
 const static size_t box_count = FF_ARRAY_ELEMS(box_types);
@@ -239,6 +279,25 @@ static void mov_text_style_cb(void *priv, const char 
style, int close)
 s->box_flags |= STYL_BOX;
 }
 
+static void mov_text_color_cb(void *priv, unsigned int color, unsigned int 
color_id)
+{
+MovTextContext *s = priv;
+if (color_id == 2) {//secondary color changes
+if (s->box_flags & HLIT_BOX) {  //close tag
+s->hlit.end = AV_RB16(&s->text_pos);
+} else {
+s->box_flags |= HCLR_BOX;
+s->box_flags |= HLIT_BOX;
+s->hlit.start = AV_RB16(&s->text_pos);
+s->hclr.color = color | (0xFF << 24);  //set alpha value to FF
+}
+}
+/* If there are more than one secondary color changes in ASS, take start of
+   first section and end of last section. Movtext allows only one
+   highlight box per sample.
+ */
+}
+
 static void mov_text_text_cb(void *priv, const char *text, int len)
 {
 MovTextContext *s = priv;
@@ -257,6 +316,7 @@ static const ASSCodesCallbacks mov_text_callbacks = {
 .text = mov_text_text_cb,
 .new_line = mov_text_new_line_cb,
 .style= mov_text_style_cb,
+.color= mov_text_color_cb,
 };
 
 static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf,
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH 1/3] aacdec: move the LTP and TNS tables out of aacdectab.h

2015-07-20 Thread Rostislav Pehlivanov
Yep, with this patch compute_lpc_coefs() (referenced in aacdec_template.c
when applying TNS) in ltp.c prints a warning when compiling the fixed
decoder, which is fine since it changed a type from INTFLOAT to float.

>And it will probably be accepted first anyhow :)
I'm fine either way too, it's not hard to substitute a few words :)
The encoder has no problem with INTFLOATs (as long as its 'float' when
compiling the encoder) so feel free to change any shared tables later when
you fully implement the fixed point decoder.

Looking at it I was wrong, compute_lpc_coefs() is used in ra288.c as well,
so disregard what I said about moving that in the decoder, it's fine as it
is.

On 20 July 2015 at 16:52, Nedeljko Babic  wrote:

>  >Thanks for your response.
> >If you are okay with it then it would make sense to push this patch to
> >master first then because you have to rebase aactab.* to INTFLOATs anyway.
> >
>
> I am ok with that.
>
> As I said, I don't have a problem to make necessary changes to my patch
> set if
> this patch is accepted first.
>
> And it will probably be accepted first anyhow :)
>
> >Could you consider moving ltp.c into the aacdec_template.c file? It's
> >relatively short (compared to the decoder source) and it's only used a
> >single time in the entire libavcodec by the aac decoder? Perhaps you can
> >just inline the whole function in the decoder. When compiling aacdec_fixed
> >it prints a warning saying it expects float * rather than an INTFLOAT *.
>
> ltp.c? Are you sure that is the name of the file that is causing a problem?
>
> The only warning of that type that I am having while building is in
> aacdec_template.c
> and that is for ff_aac_eld_window_480 table.
>
> The reason for this warning I explained in one of my previous mails.
>
> -Nedeljko
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/aacsbr: fix compilation with hardcoded tables

2015-07-20 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/aacsbr_fixed_tablegen.c | 4 +++-
 libavcodec/aacsbr_tablegen.c   | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/aacsbr_fixed_tablegen.c 
b/libavcodec/aacsbr_fixed_tablegen.c
index 7117dbd..b896d75 100644
--- a/libavcodec/aacsbr_fixed_tablegen.c
+++ b/libavcodec/aacsbr_fixed_tablegen.c
@@ -21,9 +21,11 @@
  */
 
 #include 
+#include "libavutil/internal.h"
+#include "libavutil/common.h"
+#undef CONFIG_HARDCODED_TABLES
 #define CONFIG_HARDCODED_TABLES 0
 #define USE_FIXED 1
-#include "libavutil/common.h"
 #include "aacsbr_fixed_tablegen.h"
 #include "tableprint.h"
 
diff --git a/libavcodec/aacsbr_tablegen.c b/libavcodec/aacsbr_tablegen.c
index 4f58270..ee0d818 100644
--- a/libavcodec/aacsbr_tablegen.c
+++ b/libavcodec/aacsbr_tablegen.c
@@ -21,9 +21,11 @@
  */
 
 #include 
+#include "libavutil/internal.h"
+#include "libavutil/common.h"
+#undef CONFIG_HARDCODED_TABLES
 #define CONFIG_HARDCODED_TABLES 0
 #define USE_FIXED 0
-#include "libavutil/common.h"
 #include "aacsbr_tablegen.h"
 #include "tableprint.h"
 
-- 
2.4.5

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


[FFmpeg-devel] [PATCH] lavf/mov: add support for sidx fragment indexes

2015-07-20 Thread Rodger Combs
The logic in mov_seek_fragment for matching track_ids to AVStream ids is
almost certainly wrong, and should be corrected (by someone who knows more
about the relevant structures) before this is merged.

Fixes trac #3842
---
 libavformat/isom.h |   1 +
 libavformat/mov.c  | 181 -
 2 files changed, 168 insertions(+), 14 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index 5d48989..1578529 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -103,6 +103,7 @@ typedef struct MOVSbgp {
 typedef struct MOVFragmentIndexItem {
 int64_t moof_offset;
 int64_t time;
+int headers_read;
 } MOVFragmentIndexItem;
 
 typedef struct MOVFragmentIndex {
diff --git a/libavformat/mov.c b/libavformat/mov.c
index d24faa7..a6e1825 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3355,7 +3355,95 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return AVERROR_EOF;
 
 frag->implicit_offset = offset;
-st->duration = sc->track_end = dts + sc->time_offset;
+
+if (st->duration < (dts + sc->time_offset))
+st->duration = sc->track_end = dts + sc->time_offset;
+
+return 0;
+}
+
+static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+int64_t offset = avio_tell(pb) + atom.size, pts;
+uint8_t version;
+int i, track_id;
+AVStream *st = NULL;
+MOVStreamContext *sc;
+MOVFragmentIndex *index;
+MOVFragmentIndex **tmp;
+AVRational timescale;
+
+version = avio_r8(pb);
+if (version > 1)
+return AVERROR_PATCHWELCOME;
+
+avio_rb24(pb); // flags
+
+track_id = avio_rb32(pb); // Reference ID
+for (i = 0; i < c->fc->nb_streams; i++) {
+if (c->fc->streams[i]->id == track_id) {
+st = c->fc->streams[i];
+break;
+}
+}
+if (!st) {
+av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id 
%d\n", track_id);
+return AVERROR_INVALIDDATA;
+}
+
+sc = st->priv_data;
+
+timescale = av_make_q(1, avio_rb32(pb));
+
+if (version == 0) {
+pts = avio_rb32(pb);
+offset += avio_rb32(pb);
+} else {
+pts = avio_rb64(pb);
+offset += avio_rb64(pb);
+}
+
+avio_rb16(pb); // reserved
+
+index = av_mallocz(sizeof(MOVFragmentIndex));
+if (!index) {
+return AVERROR(ENOMEM);
+}
+
+index->track_id = track_id;
+
+index->item_count = avio_rb16(pb);
+index->items = av_mallocz_array(
+index->item_count, sizeof(MOVFragmentIndexItem));
+
+if (!index->items) {
+av_freep(&index);
+return AVERROR(ENOMEM);
+}
+
+tmp = av_realloc_array(c->fragment_index_data,
+   c->fragment_index_count + 1,
+   sizeof(MOVFragmentIndex*));
+if (!tmp) {
+av_freep(&index->items);
+av_freep(&index);
+return AVERROR(ENOMEM);
+}
+c->fragment_index_data = tmp;
+c->fragment_index_data[c->fragment_index_count++] = index;
+
+for (i = 0; i < index->item_count; i++) {
+int32_t size = avio_rb32(pb);
+int32_t duration = avio_rb32(pb);
+avio_rb32(pb); // sap_flags
+index->items[i].moof_offset = offset;
+index->items[i].time = av_rescale_q(pts, st->time_base, timescale);
+offset += size;
+pts += duration;
+}
+
+st->duration = sc->track_end = pts;
+
 return 0;
 }
 
@@ -3612,6 +3700,7 @@ static const MOVParseTableEntry mov_default_parse_table[] 
= {
 { MKTAG('a','l','a','c'), mov_read_alac }, /* alac specific atom */
 { MKTAG('a','v','c','C'), mov_read_glbl },
 { MKTAG('p','a','s','p'), mov_read_pasp },
+{ MKTAG('s','i','d','x'), mov_read_sidx },
 { MKTAG('s','t','b','l'), mov_read_default },
 { MKTAG('s','t','c','o'), mov_read_stco },
 { MKTAG('s','t','p','s'), mov_read_stps },
@@ -3735,9 +3824,9 @@ static int mov_read_default(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 return err;
 }
 if (c->found_moov && c->found_mdat &&
-((!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX) ||
+((!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX || 
c->fragment_index_data) ||
  start_pos + a.size == avio_size(pb))) {
-if (!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX)
+if (!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX || 
c->fragment_index_data)
 c->next_root_atom = start_pos + a.size;
 c->atom_depth --;
 return 0;
@@ -4340,6 +4429,39 @@ static int should_retry(AVIOContext *pb, int error_code) 
{
 return 1;
 }
 
+static int mov_switch_root(AVFormatContext *s, int64_t target)
+{
+MOVContext *mov = s->priv_data;
+int i, j;
+
+if (avio_seek(s->pb, target, SEEK_SET) != target) {
+av_log(mov->fc, AV_LOG_ERROR, "root atom offset 0x%"PRIx64": partial 
fil

Re: [FFmpeg-devel] [PATCH] avcodec/aacsbr: fix compilation with hardcoded tables

2015-07-20 Thread Michael Niedermayer
On Mon, Jul 20, 2015 at 04:49:37PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavcodec/aacsbr_fixed_tablegen.c | 4 +++-
>  libavcodec/aacsbr_tablegen.c   | 4 +++-
>  2 files changed, 6 insertions(+), 2 deletions(-)

should be ok if it works

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

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


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


Re: [FFmpeg-devel] [PATCH] avcodec/aacsbr: fix compilation with hardcoded tables

2015-07-20 Thread James Almer
On 20/07/15 8:38 PM, Michael Niedermayer wrote:
> On Mon, Jul 20, 2015 at 04:49:37PM -0300, James Almer wrote:
>> Signed-off-by: James Almer 
>> ---
>>  libavcodec/aacsbr_fixed_tablegen.c | 4 +++-
>>  libavcodec/aacsbr_tablegen.c   | 4 +++-
>>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> should be ok if it works

Tested it and both compilation and a fate run were successful.
In any case 
http://fate.ffmpeg.org/history.cgi?slot=x86_64-openbsd5.6-gcc4.2-conf2 will
tell.

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


Re: [FFmpeg-devel] [PATCH 3/3] avcodec/hap: Support chunked Hap frames

2015-07-20 Thread Tom Butterworth
Thanks Michael, new patch set to replace this patch incoming.

On 17 July 2015 at 20:13, Michael Niedermayer  wrote:
> On Thu, Jul 16, 2015 at 01:23:23PM +0100, Tom Butterworth wrote:
>> ---
>>  libavcodec/Makefile  |   4 +-
>>  libavcodec/hap.c |  51 +
>>  libavcodec/hap.h |  68 
>>  libavcodec/hapdec.c  | 278 
>> ---
>>  libavcodec/hapenc.c  | 190 ++--
>>  tests/fate/video.mak |   3 +
>>  tests/ref/fate/hap-chunk |   2 +
>>  7 files changed, 481 insertions(+), 115 deletions(-)
>>  create mode 100644 libavcodec/hap.c
>>  create mode 100644 tests/ref/fate/hap-chunk
>>
>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>> index b7fe1c9..2796035 100644
>> --- a/libavcodec/Makefile
>> +++ b/libavcodec/Makefile
>> @@ -283,8 +283,8 @@ OBJS-$(CONFIG_H264_MMAL_DECODER)   += mmaldec.o
>>  OBJS-$(CONFIG_H264_VDA_DECODER)+= vda_h264_dec.o
>>  OBJS-$(CONFIG_H264_QSV_DECODER)+= qsvdec_h264.o
>>  OBJS-$(CONFIG_H264_QSV_ENCODER)+= qsvenc_h264.o
>> -OBJS-$(CONFIG_HAP_DECODER) += hapdec.o
>> -OBJS-$(CONFIG_HAP_ENCODER) += hapenc.o
>> +OBJS-$(CONFIG_HAP_DECODER) += hapdec.o hap.o
>> +OBJS-$(CONFIG_HAP_ENCODER) += hapenc.o hap.o
>>  OBJS-$(CONFIG_HEVC_DECODER)+= hevc.o hevc_mvs.o hevc_ps.o 
>> hevc_sei.o \
>>hevc_cabac.o hevc_refs.o 
>> hevcpred.o\
>>hevcdsp.o hevc_filter.o 
>> hevc_parse.o hevc_data.o
>> diff --git a/libavcodec/hap.c b/libavcodec/hap.c
>> new file mode 100644
>> index 000..c1685ad
>> --- /dev/null
>> +++ b/libavcodec/hap.c
>> @@ -0,0 +1,51 @@
>> +/*
>> + * Vidvox Hap utility functions
>> + * Copyright (C) 2015 Tom Butterworth 
>> + *
>> + * 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
>> + */
>> +
>> +/**
>> + * @file
>> + * Hap utilities
>> + */
>> +#include "hap.h"
>> +
>> +int hap_set_chunk_count(HapContext *ctx, int count, int first_in_frame)
>
> non static functions need ff_ or av_ prefixes
>
>
>> +{
>> +int ret = 0;
>> +if (first_in_frame == 1 && ctx->chunk_count != count) {
>> +int ret = av_reallocp_array(&ctx->chunks, count, sizeof(HapChunk));
>> +if (ret == 0)
>> +ret = av_reallocp_array(&ctx->chunk_results, count, 
>> sizeof(int));
>> +if (ret < 0) {
>> +ctx->chunk_count = 0;
>> +} else {
>> +ctx->chunk_count = count;
>> +}
>> +} else if (ctx->chunk_count != count) {
>> +ret = AVERROR_INVALIDDATA;
>> +}
>> +return ret;
>> +}
>> +
>> +void hap_free_context(HapContext *ctx)
>> +{
>> +av_freep(&ctx->tex_buf);
>> +av_freep(&ctx->chunks);
>> +av_freep(&ctx->chunk_results);
>> +}
>> diff --git a/libavcodec/hap.h b/libavcodec/hap.h
>> index bd0fd37..b877c4f 100644
>> --- a/libavcodec/hap.h
>> +++ b/libavcodec/hap.h
>> @@ -1,6 +1,7 @@
>>  /*
>>   * Vidvox Hap
>>   * Copyright (C) 2015 Vittorio Giovara 
>> + * and Tom Butterworth 
>>   *
>>   * This file is part of FFmpeg.
>>   *
>> @@ -29,37 +30,66 @@
>>  #include "bytestream.h"
>>  #include "texturedsp.h"
>>
>
>> +enum HapTextureFormat {
>> +HAP_FMT_RGBDXT1   = 0x0B,
>> +HAP_FMT_RGBADXT5  = 0x0E,
>> +HAP_FMT_YCOCGDXT5 = 0x0F,
>> +};
>> +
>> +enum HapCompressor {
>> +HAP_COMP_NONE= 0xA0,
>> +HAP_COMP_SNAPPY  = 0xB0,
>> +HAP_COMP_COMPLEX = 0xC0,
>> +};
> [...]
>
>> -enum {
>> -HAP_FMT_RGBDXT1   = 0x0B,
>> -HAP_FMT_RGBADXT5  = 0x0E,
>> -HAP_FMT_YCOCGDXT5 = 0x0F,
>> -};
>> -
>> -enum {
>> -HAP_COMP_NONE= 0xA0,
>> -HAP_COMP_SNAPPY  = 0xB0,
>> -HAP_COMP_COMPLEX = 0xC0,
>> -};
>
> moving code around and giving enums names should be seperate patches
> from adding features
>
> more generically, cosmetic changes (like movig code) should be
> seperate from functional changes (like adding a feature)
>
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> While the State exists there can be no freedom; when there is freedom there
> will be no State. -- Vladimir Lenin
>
> __

[FFmpeg-devel] [PATCH 3/4] avcodec/hapdec: log reason for failure when texture type doesn't match stream

2015-07-20 Thread Tom Butterworth
---
 libavcodec/hapdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c
index f55d4b7..8e90904 100644
--- a/libavcodec/hapdec.c
+++ b/libavcodec/hapdec.c
@@ -79,8 +79,10 @@ static int setup_texture(AVCodecContext *avctx, size_t 
length)
 
 if ((avctx->codec_tag == MKTAG('H','a','p','1') && (ctx->section_type & 
0x0F) != HAP_FMT_RGBDXT1)
 || (avctx->codec_tag == MKTAG('H','a','p','5') && (ctx->section_type & 
0x0F) != HAP_FMT_RGBADXT5)
-|| (avctx->codec_tag == MKTAG('H','a','p','Y') && (ctx->section_type & 
0x0F) != HAP_FMT_YCOCGDXT5))
+|| (avctx->codec_tag == MKTAG('H','a','p','Y') && (ctx->section_type & 
0x0F) != HAP_FMT_YCOCGDXT5)) {
+av_log(avctx, AV_LOG_ERROR, "Invalid texture format %#04x.\n", 
ctx->section_type & 0x0F);
 return AVERROR_INVALIDDATA;
+}
 
 switch (ctx->section_type & 0xF0) {
 case HAP_COMP_NONE:
-- 
2.3.2 (Apple Git-55)

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


[FFmpeg-devel] [PATCH 4/4] Support the Hap chunked frame format

2015-07-20 Thread Tom Butterworth
---
 libavcodec/Makefile  |   4 +-
 libavcodec/hap.c |  55 ++
 libavcodec/hap.h |  37 ++-
 libavcodec/hapdec.c  | 272 +--
 libavcodec/hapenc.c  | 187 ++--
 tests/fate/video.mak |   3 +
 tests/ref/fate/hap-chunk |   2 +
 7 files changed, 464 insertions(+), 96 deletions(-)
 create mode 100644 libavcodec/hap.c
 create mode 100644 tests/ref/fate/hap-chunk

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index f91af3f..88e3ac2 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -291,8 +291,8 @@ OBJS-$(CONFIG_H264_MMAL_DECODER)   += mmaldec.o
 OBJS-$(CONFIG_H264_VDA_DECODER)+= vda_h264_dec.o
 OBJS-$(CONFIG_H264_QSV_DECODER)+= qsvdec_h264.o
 OBJS-$(CONFIG_H264_QSV_ENCODER)+= qsvenc_h264.o
-OBJS-$(CONFIG_HAP_DECODER) += hapdec.o
-OBJS-$(CONFIG_HAP_ENCODER) += hapenc.o
+OBJS-$(CONFIG_HAP_DECODER) += hapdec.o hap.o
+OBJS-$(CONFIG_HAP_ENCODER) += hapenc.o hap.o
 OBJS-$(CONFIG_HEVC_DECODER)+= hevc.o hevc_mvs.o hevc_ps.o 
hevc_sei.o \
   hevc_cabac.o hevc_refs.o hevcpred.o  
  \
   hevcdsp.o hevc_filter.o hevc_parse.o 
hevc_data.o
diff --git a/libavcodec/hap.c b/libavcodec/hap.c
new file mode 100644
index 000..5b3af5e
--- /dev/null
+++ b/libavcodec/hap.c
@@ -0,0 +1,55 @@
+/*
+ * Vidvox Hap utility functions
+ * Copyright (C) 2015 Tom Butterworth 
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * Hap utilities
+ */
+#include "hap.h"
+
+int ff_hap_set_chunk_count(HapContext *ctx, int count, int first_in_frame)
+{
+int ret = 0;
+if (first_in_frame == 1 && ctx->chunk_count != count) {
+int ret = av_reallocp_array(&ctx->chunks, count, sizeof(HapChunk));
+if (ret == 0)
+ret = av_reallocp_array(&ctx->chunk_results, count, sizeof(int));
+if (ret < 0) {
+ctx->chunk_count = 0;
+} else {
+ctx->chunk_count = count;
+}
+} else if (ctx->chunk_count != count) {
+/* If this is not the first chunk count calculated for a frame and a
+ * different count has already been encountered, then reject the frame:
+ * each table in the Decode Instructions Container must describe the
+ * same number of chunks. */
+ret = AVERROR_INVALIDDATA;
+}
+return ret;
+}
+
+av_cold void ff_hap_free_context(HapContext *ctx)
+{
+av_freep(&ctx->tex_buf);
+av_freep(&ctx->chunks);
+av_freep(&ctx->chunk_results);
+}
diff --git a/libavcodec/hap.h b/libavcodec/hap.h
index f36d09a..d33af93 100644
--- a/libavcodec/hap.h
+++ b/libavcodec/hap.h
@@ -1,6 +1,7 @@
 /*
  * Vidvox Hap
  * Copyright (C) 2015 Vittorio Giovara 
+ * Copyright (C) 2015 Tom Butterworth 
  *
  * This file is part of FFmpeg.
  *
@@ -41,24 +42,54 @@ enum HapCompressor {
 HAP_COMP_COMPLEX = 0xC0,
 };
 
+enum HapSectionType {
+HAP_ST_DECODE_INSTRUCTIONS = 0x01,
+HAP_ST_COMPRESSOR_TABLE= 0x02,
+HAP_ST_SIZE_TABLE  = 0x03,
+HAP_ST_OFFSET_TABLE= 0x04,
+};
+
+typedef struct HapChunk {
+enum HapCompressor compressor;
+int compressed_offset;
+size_t compressed_size;
+int uncompressed_offset;
+size_t uncompressed_size;
+} HapChunk;
+
 typedef struct HapContext {
 AVClass *class;
 
 TextureDSPContext dxtc;
 GetByteContext gbc;
 
-int section_type;/* Header type */
+enum HapTextureFormat opt_tex_fmt; /* Texture type (encoder only) */
+int opt_chunk_count; /* User-requested chunk count (encoder only) */
+
+int chunk_count;
+HapChunk *chunks;
+int *chunk_results;  /* Results from threaded operations */
 
 int tex_rat; /* Compression ratio */
 const uint8_t *tex_data; /* Compressed texture */
-uint8_t *tex_buf;/* Uncompressed texture */
+uint8_t *tex_buf;/* Buffer for compressed texture */
 size_t tex_size; /* Size of the compressed texture */
 
-uint8_t *snappied;   /* Buffer interacting with snappy */
 size_t max_snappy;   /* Maximum compressed size for snap

[FFmpeg-devel] [PATCH 1/4] libavcodec/hap: Name enums, remove unused struct member

2015-07-20 Thread Tom Butterworth
---
 libavcodec/hap.h | 25 -
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/libavcodec/hap.h b/libavcodec/hap.h
index bd0fd37..f36d09a 100644
--- a/libavcodec/hap.h
+++ b/libavcodec/hap.h
@@ -29,12 +29,23 @@
 #include "bytestream.h"
 #include "texturedsp.h"
 
+enum HapTextureFormat {
+HAP_FMT_RGBDXT1   = 0x0B,
+HAP_FMT_RGBADXT5  = 0x0E,
+HAP_FMT_YCOCGDXT5 = 0x0F,
+};
+
+enum HapCompressor {
+HAP_COMP_NONE= 0xA0,
+HAP_COMP_SNAPPY  = 0xB0,
+HAP_COMP_COMPLEX = 0xC0,
+};
+
 typedef struct HapContext {
 AVClass *class;
 
 TextureDSPContext dxtc;
 GetByteContext gbc;
-PutByteContext pbc;
 
 int section_type;/* Header type */
 
@@ -50,16 +61,4 @@ typedef struct HapContext {
 int (*tex_fun)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
 } HapContext;
 
-enum {
-HAP_FMT_RGBDXT1   = 0x0B,
-HAP_FMT_RGBADXT5  = 0x0E,
-HAP_FMT_YCOCGDXT5 = 0x0F,
-};
-
-enum {
-HAP_COMP_NONE= 0xA0,
-HAP_COMP_SNAPPY  = 0xB0,
-HAP_COMP_COMPLEX = 0xC0,
-};
-
 #endif /* AVCODEC_HAP_H */
-- 
2.3.2 (Apple Git-55)

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


Re: [FFmpeg-devel] [PATCH] conversion of FFV1 specification from lyx to markdown

2015-07-20 Thread Michael Niedermayer
On Mon, Jul 20, 2015 at 02:18:18PM -0400, Dave Rice wrote:
> Hi Michael,
> 
> > On Jul 20, 2015, at 7:52 AM, Michael Niedermayer  
> > wrote:
> > 
> > On Sat, Jul 18, 2015 at 11:23:16AM -0400, Dave Rice wrote:
> >> 
> >>> On Jul 10, 2015, at 4:55 PM, Michael Niedermayer  
> >>> wrote:
> >>> 
> >>> On Fri, Jul 10, 2015 at 04:19:41PM -0400, Dave Rice wrote:
>  
> > On Jul 10, 2015, at 3:51 PM, Michael Niedermayer 
> >  wrote:
> > 
> > On Fri, Jul 10, 2015 at 03:47:45PM -0400, Dave Rice wrote:
> >> 
> >>> On Jul 10, 2015, at 2:06 PM, Michael Niedermayer 
> >>>  wrote:
> >>> 
> >>> On Fri, Jul 10, 2015 at 07:51:20PM +0200, Michael Niedermayer wrote:
>  On Fri, Jul 10, 2015 at 07:47:46PM +0200, Michael Niedermayer wrote:
> > On Fri, Jul 10, 2015 at 11:52:24AM +0200, Michael Niedermayer wrote:
> >> On Thu, Jul 09, 2015 at 02:14:36PM -0400, Dave Rice wrote:
> >>> 
>  On Jul 9, 2015, at 1:53 PM, Michael Niedermayer 
>   wrote:
>  
>  On Tue, Jul 07, 2015 at 11:03:39AM -0400, Dave Rice wrote:
> > Hi,
> > 
> >> On Jul 7, 2015, at 10:35 AM, Michael Niedermayer 
> >>  wrote:
> >> 
> >> On Thu, Jul 02, 2015 at 09:50:21AM -0400, Dave Rice wrote:
> >>> Hi all,
> >>> Last month I posted a draft of the FFV1 specification 
> >>> formatted in Markdown [1], whereas it currently lives in lyx. 
> >>> From that post there were responses in favor of the use of 
> >>> Markdown formatting and suggestions to not use mathml within 
> >>> a draft targeting an RFC specification and suggestions to 
> >>> update a few urls. I propose to proceed with a format 
> >>> conversion of the FFV1 specification from lyx to Markdown and 
> >>> then I'll file tickets or patches to explore simplifying the 
> >>> mathml expressions and updating the urls. Attached is a patch 
> >>> to convert the formatting (but not meaning) of the FFV1 
> >>> specification from lyx to markdown.
> >>> 
> >>> Best Regards,
> >>> Dave Rice
> >>> 
> >>> [1] 
> >>> http://comments.gmane.org/gmane.comp.video.ffmpeg.devel/193851
> >>> 
> >> 
> >> how can this be edited and converted ?
> > 
> > Via pandoc you can get outputs that are close to the current 
> > ffv1.html and ffv1.pdf outputs of ffv1.lyx.
> > 
> > pandoc --mathml -s --number-sections ../ffv1.md -c lyx.css -o 
> > ffv1.html
> > pandoc -s --number-sections ../ffv1.md --latex-engine=xelatex 
> > -V geometry:margin=1in -o ffv1.pdf
> > 
> > I can move this info to a readme.
>  
>  please do
> >>> 
> >>> Sure. Would you prefer a patch on ffmpeg-devel or a PR in github?
> >> 
> >> whatever you prefer
> > 
> > generated files like pdf should not be checked into git.
> > instead add a Makefile to generate them, so a simple
> > make
> > or
> > make ffv1.pdf
> > generates the file
>  
>  also the readme should document which version of markdown/pandoc
>  this needs
>  and something should check for that version ideally so the user
>  is nt left wondering why "make" produces broken tables
> >>> 
> >>> reviewing the pull req
> >>> 
> >>> The conventions section 3.
> >>> lacks vertical alignment
> >> 
> >> Fixed in 
> >> https://github.com/MediaArea/FFV1/commit/d25fb39f7514547f72cbc13ef3851f3c9d9c0c5f
> >> 
> >>> theres an empty line after
> >>> for(i=0;i >> 
> >> Fixed in 
> >> https://github.com/MediaArea/FFV1/commit/1291e6c3e90ea6816b543a9e12c08d1cbbc1f31c
> >> 
> > 
> >>> 4.6.2.5:
> >>> log2_run[41]={JPEGLS.
> >>> 0,0,0,0,1,1,1,1,
> >>> 
> >>> that JPEGLS is supposed to be a link/reference/whatever but its a
> >>> litteral word
> >> 
> >> I'm having trouble getting a footnote to work within a codeblock. It 
> >> is feasible to use this footnote in a reference to JPEGLS in a 
> >> sentence above the codeblock?
> > 
> > of course
> > whatever works
>  
>  I don't understand the relationship between the function and the 
>  reference to JPEG-LS. I could simply move the footnote reference to 
>  JPEGLS to outside of the codeblock, but it would be better to also 
>  explain the relationship at the same time. Could you provide some 
>  background as to why JPEGLS is referenced here.
> >>> 
> >>> This table is also used by jpegls, see ff_log2_run in libavcodec
> >>> 
> >>> 
> >>> some othe

[FFmpeg-devel] [PATCH 2/4] avcodec/hapdec: don't log texture format every frame, do it once per decode session

2015-07-20 Thread Tom Butterworth
---
 libavcodec/hapdec.c | 27 ---
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c
index 7eff9e0..f55d4b7 100644
--- a/libavcodec/hapdec.c
+++ b/libavcodec/hapdec.c
@@ -74,7 +74,6 @@ static int setup_texture(AVCodecContext *avctx, size_t length)
 HapContext *ctx = avctx->priv_data;
 GetByteContext *gbc = &ctx->gbc;
 int64_t snappy_size;
-const char *texture_name;
 const char *compressorstr;
 int ret;
 
@@ -83,22 +82,6 @@ static int setup_texture(AVCodecContext *avctx, size_t 
length)
 || (avctx->codec_tag == MKTAG('H','a','p','Y') && (ctx->section_type & 
0x0F) != HAP_FMT_YCOCGDXT5))
 return AVERROR_INVALIDDATA;
 
-switch (ctx->section_type & 0x0F) {
-case HAP_FMT_RGBDXT1:
-texture_name = "DXT1";
-break;
-case HAP_FMT_RGBADXT5:
-texture_name = "DXT5";
-break;
-case HAP_FMT_YCOCGDXT5:
-texture_name = "DXT5-YCoCg-scaled";
-break;
-default:
-av_log(avctx, AV_LOG_ERROR,
-   "Invalid format mode %02X.\n", ctx->section_type);
-return AVERROR_INVALIDDATA;
-}
-
 switch (ctx->section_type & 0xF0) {
 case HAP_COMP_NONE:
 /* Only DXTC texture compression */
@@ -134,8 +117,7 @@ static int setup_texture(AVCodecContext *avctx, size_t 
length)
 return AVERROR_INVALIDDATA;
 }
 
-av_log(avctx, AV_LOG_DEBUG, "%s texture with %s compressor\n",
-   texture_name, compressorstr);
+av_log(avctx, AV_LOG_DEBUG, "%s compressor\n", compressorstr);
 
 return 0;
 }
@@ -198,6 +180,7 @@ static int hap_decode(AVCodecContext *avctx, void *data,
 static av_cold int hap_init(AVCodecContext *avctx)
 {
 HapContext *ctx = avctx->priv_data;
+const char *texture_name;
 int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
 
 if (ret < 0) {
@@ -217,20 +200,26 @@ static av_cold int hap_init(AVCodecContext *avctx)
 
 switch (avctx->codec_tag) {
 case MKTAG('H','a','p','1'):
+texture_name = "DXT1";
 ctx->tex_rat = 8;
 ctx->tex_fun = ctx->dxtc.dxt1_block;
 break;
 case MKTAG('H','a','p','5'):
+texture_name = "DXT5";
 ctx->tex_rat = 16;
 ctx->tex_fun = ctx->dxtc.dxt5_block;
 break;
 case MKTAG('H','a','p','Y'):
+texture_name = "DXT5-YCoCg-scaled";
 ctx->tex_rat = 16;
 ctx->tex_fun = ctx->dxtc.dxt5ys_block;
 break;
 default:
 return AVERROR_DECODER_NOT_FOUND;
 }
+
+av_log(avctx, AV_LOG_DEBUG, "%s texture\n", texture_name);
+
 return 0;
 }
 
-- 
2.3.2 (Apple Git-55)

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


Re: [FFmpeg-devel] [PATCH 1/3] aacdec: move the LTP and TNS tables out of aacdectab.h

2015-07-20 Thread Claudio Freire
On Mon, Jul 20, 2015 at 4:15 PM, Rostislav Pehlivanov
 wrote:
> Yep, with this patch compute_lpc_coefs() (referenced in aacdec_template.c
> when applying TNS) in ltp.c prints a warning when compiling the fixed
> decoder, which is fine since it changed a type from INTFLOAT to float.
>
>>And it will probably be accepted first anyhow :)
> I'm fine either way too, it's not hard to substitute a few words :)
> The encoder has no problem with INTFLOATs (as long as its 'float' when
> compiling the encoder) so feel free to change any shared tables later when
> you fully implement the fixed point decoder.
>
> Looking at it I was wrong, compute_lpc_coefs() is used in ra288.c as well,
> so disregard what I said about moving that in the decoder, it's fine as it
> is.

You're probably referring to lpc.c (not ltp).
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] conversion of FFV1 specification from lyx to markdown

2015-07-20 Thread Michael Niedermayer
On Tue, Jul 21, 2015 at 02:14:11AM +0200, Michael Niedermayer wrote:
[...]
> ill take another quick look and then will probably push your changes
> its probably easier to work on top of it then wait with pushing until
> its perfect

pushed it

btw please remove trailing whitespace unless some of it is required
for the formating or something

also, it seems github doesnt render all parts of the file well, some
look quite broken (found by jamrial)

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle


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/3] aacdec: move the LTP and TNS tables out of aacdectab.h

2015-07-20 Thread Claudio Freire
On Mon, Jul 20, 2015 at 8:50 AM, Nedeljko Babic
 wrote:
>>This commit moves the tables required for encoding and decoding
>>LTP and TNS AAC files out of the decoder's standalone tables file
>>and into the shared aactab.h, where they can be used by both the
>>encoder and the decoder.
>>
>>This commit does not break the already-broken aac_fixed decoder.
>
> Not sure I would say that it is broken, since it is not implemented fully 
> yet...

I think even with the other patches submitted to the list, TNS (which
uses lpc) will break. It will be sending an int* to a function that
takes float* (check lpc.h, vs aacdec_template.c:3223 + aac.h:244)

It's a bit OT in this thread but I didn't see any thread for TNS in
the fixed point decoder ones.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/3] aaccoder: Improve IS phase rejection

2015-07-20 Thread Claudio Freire
On Fri, Jul 17, 2015 at 11:19 PM, Rostislav Pehlivanov
 wrote:
>>But even if not used for avoding I/S, it can be used to pick whether
>>to invert the phases, where it was clearly more stable.
> In case the phase is very clearly wrong then there will be an increase in
> the distortion which should cause the dist2 <= dist1 check to fail and thus
> not use IS. So the phase isn't even very important. The whole point of the
> phase check is to pick out the obviously wrong phases and save time by not
> having to calculate the error of the spectral coefficients. And this works
> better when you individually pick out a majority rather than just summing
> them up and then doing the decisions.

All the more reason to use energy then.

If you use this sign-difference count, low-energy noise may change the
count while being inaudible, yielding an incorrect phase value. After
that, distortion will be huge and the band won't be I/S encoded, but
it might if the phase value was otherwise.

In general, this algorithm seems fragile (ie: not robust in the
presence of noise).

Why not forego the optimization and optimize efficiency instead? (it's
the priority now, running time optimization should be done after
exploiting the technique to increase quality as much as posibble).

An alternative technique that may be better in that regard, then,
would be to measure distortion with both phases, and pick the phase
that yields the lowest distortion?

Give it a try.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/3] aacenc: move the generation of ff_aac_pow34sf_tab[]

2015-07-20 Thread Claudio Freire
This will need rebasing, the fixed tablegen got in recently

On Fri, Jul 17, 2015 at 6:20 PM, Rostislav Pehlivanov
 wrote:
> This commit moves the generation of ff_aac_pow34sf_tab[] out of the
> encoder and into the table generator. The original commit log for
> this table in 2011 actually mentions that it should be moved outside
> but this never happened.
>
> This is the first commit which cleans up the encoder a little.
> ---
>  libavcodec/aac_tablegen.c  | 2 ++
>  libavcodec/aac_tablegen.h  | 5 -
>  libavcodec/aac_tablegen_decl.h | 2 ++
>  libavcodec/aaccoder.c  | 1 +
>  libavcodec/aacenc.c| 4 
>  libavcodec/aacenc.h| 2 --
>  6 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/libavcodec/aac_tablegen.c b/libavcodec/aac_tablegen.c
> index 33a179f..2d13211 100644
> --- a/libavcodec/aac_tablegen.c
> +++ b/libavcodec/aac_tablegen.c
> @@ -33,5 +33,7 @@ int main(void)
>
>  WRITE_ARRAY("const", float, ff_aac_pow2sf_tab);
>
> +WRITE_ARRAY("const", float, ff_aac_pow34sf_tab);
> +
>  return 0;
>  }
> diff --git a/libavcodec/aac_tablegen.h b/libavcodec/aac_tablegen.h
> index bf71e59..8b223f9 100644
> --- a/libavcodec/aac_tablegen.h
> +++ b/libavcodec/aac_tablegen.h
> @@ -30,12 +30,15 @@
>  #else
>  #include "libavutil/mathematics.h"
>  float ff_aac_pow2sf_tab[428];
> +float ff_aac_pow34sf_tab[428];
>
>  av_cold void ff_aac_tableinit(void)
>  {
>  int i;
> -for (i = 0; i < 428; i++)
> +for (i = 0; i < 428; i++) {
>  ff_aac_pow2sf_tab[i] = pow(2, (i - POW_SF2_ZERO) / 4.0);
> +ff_aac_pow34sf_tab[i] = pow(ff_aac_pow2sf_tab[i], 3.0/4.0);
> +}
>  }
>  #endif /* CONFIG_HARDCODED_TABLES */
>
> diff --git a/libavcodec/aac_tablegen_decl.h b/libavcodec/aac_tablegen_decl.h
> index 5105dae..ef86f85 100644
> --- a/libavcodec/aac_tablegen_decl.h
> +++ b/libavcodec/aac_tablegen_decl.h
> @@ -28,9 +28,11 @@
>  #if CONFIG_HARDCODED_TABLES
>  #define ff_aac_tableinit()
>  extern const float ff_aac_pow2sf_tab[428];
> +extern const float ff_aac_pow34sf_tab[428];
>  #else
>  void ff_aac_tableinit(void);
>  extern   float ff_aac_pow2sf_tab[428];
> +extern   float ff_aac_pow34sf_tab[428];
>  #endif /* CONFIG_HARDCODED_TABLES */
>
>  #endif /* AVCODEC_AAC_TABLEGEN_DECL_H */
> diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
> index 5bdba46..17b14d6 100644
> --- a/libavcodec/aaccoder.c
> +++ b/libavcodec/aaccoder.c
> @@ -39,6 +39,7 @@
>  #include "aac.h"
>  #include "aacenc.h"
>  #include "aactab.h"
> +#include "aac_tablegen_decl.h"
>
>  /** Frequency in Hz for lower limit of noise substitution **/
>  #define NOISE_LOW_LIMIT 4500
> diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
> index f05f51b..a3c31de 100644
> --- a/libavcodec/aacenc.c
> +++ b/libavcodec/aacenc.c
> @@ -58,7 +58,6 @@
>  av_log(avctx, AV_LOG_WARNING, __VA_ARGS__); \
>  }
>
> -float ff_aac_pow34sf_tab[428];
>
>  static const uint8_t swb_size_1024_96[] = {
>  4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8,
> @@ -855,9 +854,6 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
>
>  ff_aac_tableinit();
>
> -for (i = 0; i < 428; i++)
> -ff_aac_pow34sf_tab[i] = sqrt(ff_aac_pow2sf_tab[i] * 
> sqrt(ff_aac_pow2sf_tab[i]));
> -
>  avctx->initial_padding = 1024;
>  ff_af_queue_init(avctx, &s->afq);
>
> diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
> index 966c708..4210455 100644
> --- a/libavcodec/aacenc.h
> +++ b/libavcodec/aacenc.h
> @@ -95,8 +95,6 @@ typedef struct AACEncContext {
>  } buffer;
>  } AACEncContext;
>
> -extern float ff_aac_pow34sf_tab[428];
> -
>  void ff_aac_coder_init_mips(AACEncContext *c);
>
>  #endif /* AVCODEC_AACENC_H */
> --
> 2.4.3.573.g4eafbef
>
> ___
> 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] [PATCH 1/4] libavcodec/hap: Name enums, remove unused struct member

2015-07-20 Thread Michael Niedermayer
On Tue, Jul 21, 2015 at 01:12:09AM +0100, Tom Butterworth wrote:
> ---
>  libavcodec/hap.h | 25 -
>  1 file changed, 12 insertions(+), 13 deletions(-)

applied

thanks

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

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"


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/4] avcodec/hapdec: don't log texture format every frame, do it once per decode session

2015-07-20 Thread Michael Niedermayer
On Tue, Jul 21, 2015 at 01:12:10AM +0100, Tom Butterworth wrote:
> ---
>  libavcodec/hapdec.c | 27 ---
>  1 file changed, 8 insertions(+), 19 deletions(-)

applied

thanks

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

What does censorship reveal? It reveals fear. -- Julian Assange


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


Re: [FFmpeg-devel] [PATCH] lavf/mov: add support for sidx fragment indexes

2015-07-20 Thread Michael Niedermayer
On Mon, Jul 20, 2015 at 03:04:55PM -0500, Rodger Combs wrote:
> The logic in mov_seek_fragment for matching track_ids to AVStream ids is
> almost certainly wrong, and should be corrected (by someone who knows more
> about the relevant structures) before this is merged.
> 
> Fixes trac #3842
> ---
>  libavformat/isom.h |   1 +
>  libavformat/mov.c  | 181 
> -
>  2 files changed, 168 insertions(+), 14 deletions(-)

breaks fate
stddev: 7200.16 PSNR: 19.18 MAXDIFF:33041 bytes:   884736/   679936
MAXDIFF: |33041 - 0| >= 1
size: |884736 - 679936| >= 0
Test wmapro-ism failed. Look at tests/data/fate/wmapro-ism.err for details.
make: *** [fate-wmapro-ism] Error 1


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

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus


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


Re: [FFmpeg-devel] [PATCH] AAC Encoder: clipping avoidance

2015-07-20 Thread Claudio Freire
On Fri, Jul 17, 2015 at 8:42 PM, Michael Niedermayer
 wrote:
>> If you mean a transition in time, I don't think it makes any
>> difference. 0.95 is a ~0.5db change in intensity, which ought to be
>> inaudible, and windowing will already take care to make the transition
>> smooth. And the logic wouldn't be completely free either to ramp
>> gradually, as it would have to ramp fully to 0.95 by the time it
>> reaches the first window marked as clipping hazard, and it could very
>> well be the frist window.
>
> what i meant was that whatever condition is used to hard switch
> between 1.0 and 0.95 could be rather a soft transition that is
> for example
> insteda of
> if (x > 0.0) f = 0.95
>
> something like
> if (x > 0.0 && x<1.0) f = 1.0 + (0.95 - 1.0)*x
>
> so theres no discontinuity in the transition

Attached is a patch with something like that.

1. It measures per-window minimum clip avoidance factor
2. Computes a whole-frame factor (minimum of all)
3. Applies the clip avoidance factor to the whole frame (to make it
smooth and almost linear, and avoid adding harmonic distortion).
From 57522de7c5fcdbef222c2425a4add6fa4528f0e7 Mon Sep 17 00:00:00 2001
From: Claudio Freire 
Date: Mon, 20 Jul 2015 22:53:24 -0300
Subject: [PATCH] AAC Encoder: clipping avoidance

Avoid clipping due to quantization noise to produce audible
artifacts, by detecting near-clipping signals and both attenuating
them a little and encoding escape-encoded bands (usually the
loudest) rounding towards zero instead of nearest, which tends to
decrease overall energy and thus clipping.

Currently fate tests measure numerical error so this change makes
tests using asynth (which are near clipping) report higher error
not less, because of window attenuation. Yet, they sound better,
not worse (albeit subtle, other samples aren't subtle at all).
Only measuring psychoacoustically weighted error would make for
a representative test, so that will be left for a future patch.
---
 libavcodec/aac.h  |   4 ++
 libavcodec/aaccoder.c | 108 --
 libavcodec/aacenc.c   |  38 +-
 libavcodec/aacenc.h   |   2 +-
 libavcodec/aacpsy.c   |  30 ++
 libavcodec/psymodel.h |   1 +
 tests/fate/aac.mak|   4 +-
 7 files changed, 145 insertions(+), 42 deletions(-)

diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index d62455d..3e3e479 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -50,6 +50,8 @@
 #define TNS_MAX_ORDER 20
 #define MAX_LTP_LONG_SFB 40
 
+#define CLIP_AVOIDANCE_FACTOR 0.95f
+
 enum RawDataBlockType {
 TYPE_SCE,
 TYPE_CPE,
@@ -180,6 +182,8 @@ typedef struct IndividualChannelStream {
 int predictor_initialized;
 int predictor_reset_group;
 uint8_t prediction_used[41];
+uint8_t window_clipping[8]; ///< set if a certain window is near clipping
+float clip_avoidance_factor; ///< set if any window is near clipping to the necessary atennuation factor to avoid it
 } IndividualChannelStream;
 
 /**
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 5bdba46..d606119 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -78,6 +78,9 @@ static const uint8_t * const run_value_bits[2] = {
 run_value_bits_long, run_value_bits_short
 };
 
+#define ROUND_STANDARD 0.4054f
+#define ROUND_TO_ZERO 0.1054f
+
 /** Map to convert values from BandCodingPath index to a codebook index **/
 static const uint8_t aac_cb_out_map[CB_TOT_ALL]  = {0,1,2,3,4,5,6,7,8,9,10,11,13,14,15};
 /** Inverse map to convert from codebooks to BandCodingPath indices **/
@@ -88,20 +91,20 @@ static const uint8_t aac_cb_in_map[CB_TOT_ALL+1] = {0,1,2,3,4,5,6,7,8,9,10,11,0,
  * @return absolute value of the quantized coefficient
  * @see 3GPP TS26.403 5.6.2 "Scalefactor determination"
  */
-static av_always_inline int quant(float coef, const float Q)
+static av_always_inline int quant(float coef, const float Q, const float rounding)
 {
 float a = coef * Q;
-return sqrtf(a * sqrtf(a)) + 0.4054;
+return sqrtf(a * sqrtf(a)) + rounding;
 }
 
 static void quantize_bands(int *out, const float *in, const float *scaled,
-   int size, float Q34, int is_signed, int maxval)
+   int size, float Q34, int is_signed, int maxval, const float rounding)
 {
 int i;
 double qc;
 for (i = 0; i < size; i++) {
 qc = scaled[i] * Q34;
-out[i] = (int)FFMIN(qc + 0.4054, (double)maxval);
+out[i] = (int)FFMIN(qc + rounding, (double)maxval);
 if (is_signed && in[i] < 0.0f) {
 out[i] = -out[i];
 }
@@ -133,7 +136,8 @@ static av_always_inline float quantize_and_encode_band_cost_template(
 const float *scaled, int size, int scale_idx,
 int cb, const float lambda, const float uplim,
 int *bits, int BT_ZERO, int BT_UNSIGNED,
-int BT_PAIR, int BT_ESC, int 

Re: [FFmpeg-devel] [PATCH] AAC Encoder: clipping avoidance

2015-07-20 Thread Claudio Freire
On Mon, Jul 20, 2015 at 11:39 PM, Claudio Freire  wrote:
> On Fri, Jul 17, 2015 at 8:42 PM, Michael Niedermayer
>  wrote:
>>> If you mean a transition in time, I don't think it makes any
>>> difference. 0.95 is a ~0.5db change in intensity, which ought to be
>>> inaudible, and windowing will already take care to make the transition
>>> smooth. And the logic wouldn't be completely free either to ramp
>>> gradually, as it would have to ramp fully to 0.95 by the time it
>>> reaches the first window marked as clipping hazard, and it could very
>>> well be the frist window.
>>
>> what i meant was that whatever condition is used to hard switch
>> between 1.0 and 0.95 could be rather a soft transition that is
>> for example
>> insteda of
>> if (x > 0.0) f = 0.95
>>
>> something like
>> if (x > 0.0 && x<1.0) f = 1.0 + (0.95 - 1.0)*x
>>
>> so theres no discontinuity in the transition
>
> Attached is a patch with something like that.
>
> 1. It measures per-window minimum clip avoidance factor
> 2. Computes a whole-frame factor (minimum of all)
> 3. Applies the clip avoidance factor to the whole frame (to make it
> smooth and almost linear, and avoid adding harmonic distortion).


Sorry, that one had trailing whitespace again.

Attached.
From 57522de7c5fcdbef222c2425a4add6fa4528f0e7 Mon Sep 17 00:00:00 2001
From: Claudio Freire 
Date: Mon, 20 Jul 2015 22:53:24 -0300
Subject: [PATCH] AAC Encoder: clipping avoidance

Avoid clipping due to quantization noise to produce audible
artifacts, by detecting near-clipping signals and both attenuating
them a little and encoding escape-encoded bands (usually the
loudest) rounding towards zero instead of nearest, which tends to
decrease overall energy and thus clipping.

Currently fate tests measure numerical error so this change makes
tests using asynth (which are near clipping) report higher error
not less, because of window attenuation. Yet, they sound better,
not worse (albeit subtle, other samples aren't subtle at all).
Only measuring psychoacoustically weighted error would make for
a representative test, so that will be left for a future patch.
---
 libavcodec/aac.h  |   4 ++
 libavcodec/aaccoder.c | 108 --
 libavcodec/aacenc.c   |  38 +-
 libavcodec/aacenc.h   |   2 +-
 libavcodec/aacpsy.c   |  30 ++
 libavcodec/psymodel.h |   1 +
 tests/fate/aac.mak|   4 +-
 7 files changed, 145 insertions(+), 42 deletions(-)

diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index d62455d..3e3e479 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -50,6 +50,8 @@
 #define TNS_MAX_ORDER 20
 #define MAX_LTP_LONG_SFB 40
 
+#define CLIP_AVOIDANCE_FACTOR 0.95f
+
 enum RawDataBlockType {
 TYPE_SCE,
 TYPE_CPE,
@@ -180,6 +182,8 @@ typedef struct IndividualChannelStream {
 int predictor_initialized;
 int predictor_reset_group;
 uint8_t prediction_used[41];
+uint8_t window_clipping[8]; ///< set if a certain window is near clipping
+float clip_avoidance_factor; ///< set if any window is near clipping to the necessary atennuation factor to avoid it
 } IndividualChannelStream;
 
 /**
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 5bdba46..d606119 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -78,6 +78,9 @@ static const uint8_t * const run_value_bits[2] = {
 run_value_bits_long, run_value_bits_short
 };
 
+#define ROUND_STANDARD 0.4054f
+#define ROUND_TO_ZERO 0.1054f
+
 /** Map to convert values from BandCodingPath index to a codebook index **/
 static const uint8_t aac_cb_out_map[CB_TOT_ALL]  = {0,1,2,3,4,5,6,7,8,9,10,11,13,14,15};
 /** Inverse map to convert from codebooks to BandCodingPath indices **/
@@ -88,20 +91,20 @@ static const uint8_t aac_cb_in_map[CB_TOT_ALL+1] = {0,1,2,3,4,5,6,7,8,9,10,11,0,
  * @return absolute value of the quantized coefficient
  * @see 3GPP TS26.403 5.6.2 "Scalefactor determination"
  */
-static av_always_inline int quant(float coef, const float Q)
+static av_always_inline int quant(float coef, const float Q, const float rounding)
 {
 float a = coef * Q;
-return sqrtf(a * sqrtf(a)) + 0.4054;
+return sqrtf(a * sqrtf(a)) + rounding;
 }
 
 static void quantize_bands(int *out, const float *in, const float *scaled,
-   int size, float Q34, int is_signed, int maxval)
+   int size, float Q34, int is_signed, int maxval, const float rounding)
 {
 int i;
 double qc;
 for (i = 0; i < size; i++) {
 qc = scaled[i] * Q34;
-out[i] = (int)FFMIN(qc + 0.4054, (double)maxval);
+out[i] = (int)FFMIN(qc + rounding, (double)maxval);
 if (is_signed && in[i] < 0.0f) {
 out[i] = -out[i];
 }
@@ -133,7 +136,8 @@ static av_always_inline float quantize_and_encode_band_cost_template(
 const float *scaled, int size, int scale_idx,
 int cb, const float lambda, cons

[FFmpeg-devel] [PATCH] avcodec/options-test: don't alloc avctx->coded_frame

2015-07-20 Thread James Almer
It's done automatically by avcodec_open2() now.

Fixes memleaks in fate-libavcodec-options.

Signed-off-by: James Almer 
---
 libavcodec/options.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavcodec/options.c b/libavcodec/options.c
index 41471de..63a03ac 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -318,7 +318,6 @@ static int dummy_init(AVCodecContext *ctx)
 //TODO: this code should set every possible pointer that could be set by 
codec and is not an option;
 ctx->extradata_size = 8;
 ctx->extradata = av_malloc(ctx->extradata_size);
-ctx->coded_frame = av_frame_alloc();
 return 0;
 }
 
@@ -326,7 +325,6 @@ static int dummy_close(AVCodecContext *ctx)
 {
 av_freep(&ctx->extradata);
 ctx->extradata_size = 0;
-av_frame_free(&ctx->coded_frame);
 return 0;
 }
 
-- 
2.4.5

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


[FFmpeg-devel] [PATCH 1/8] lavf/network: split ff_listen_bind into ff_listen and ff_accept

2015-07-20 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 libavformat/network.c | 27 +--
 libavformat/network.h | 20 
 2 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/libavformat/network.c b/libavformat/network.c
index 47ade8c..7a326d2 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -187,12 +187,11 @@ int ff_socket(int af, int type, int proto)
 return fd;
 }
 
-int ff_listen_bind(int fd, const struct sockaddr *addr,
-   socklen_t addrlen, int timeout, URLContext *h)
+int ff_listen(int fd, const struct sockaddr *addr,
+  socklen_t addrlen)
 {
 int ret;
 int reuse = 1;
-struct pollfd lp = { fd, POLLIN, 0 };
 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse))) {
 av_log(NULL, AV_LOG_WARNING, "setsockopt(SO_REUSEADDR) failed\n");
 }
@@ -203,6 +202,13 @@ int ff_listen_bind(int fd, const struct sockaddr *addr,
 ret = listen(fd, 1);
 if (ret)
 return ff_neterrno();
+return ret;
+}
+
+int ff_accept(int fd, int timeout, URLContext *h)
+{
+int ret;
+struct pollfd lp = { fd, POLLIN, 0 };
 
 ret = ff_poll_interrupt(&lp, 1, timeout, &h->interrupt_callback);
 if (ret < 0)
@@ -211,15 +217,24 @@ int ff_listen_bind(int fd, const struct sockaddr *addr,
 ret = accept(fd, NULL, NULL);
 if (ret < 0)
 return ff_neterrno();
-
-closesocket(fd);
-
 if (ff_socket_nonblock(ret, 1) < 0)
 av_log(NULL, AV_LOG_DEBUG, "ff_socket_nonblock failed\n");
 
 return ret;
 }
 
+int ff_listen_bind(int fd, const struct sockaddr *addr,
+   socklen_t addrlen, int timeout, URLContext *h)
+{
+int ret;
+if ((ret = ff_listen(fd, addr, addrlen)) < 0)
+return ret;
+if ((ret = ff_accept(fd, timeout, h)) < 0)
+return ret;
+closesocket(fd);
+return ret;
+}
+
 int ff_listen_connect(int fd, const struct sockaddr *addr,
   socklen_t addrlen, int timeout, URLContext *h,
   int will_try_next)
diff --git a/libavformat/network.h b/libavformat/network.h
index 86fb656..f83c796 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -255,6 +255,26 @@ int ff_listen_bind(int fd, const struct sockaddr *addr,
URLContext *h);
 
 /**
+ * Bind to a file descriptor to an address without accepting connections.
+ * @param fd  First argument of bind().
+ * @param addrSecond argument of bind().
+ * @param addrlen Third argument of bind().
+ * @return0 on success or an AVERROR on failure.
+ */
+int ff_listen(int fd, const struct sockaddr *addr, socklen_t addrlen);
+
+/**
+ * Poll for a single connection on the passed file descriptor.
+ * @param fd  The listening socket file descriptor.
+ * @param timeout Polling timeout in milliseconds.
+ * @param h   URLContext providing interrupt check
+ *callback and logging context.
+ * @returnA non-blocking file descriptor on success
+ *or an AVERROR on failure.
+ */
+int ff_accept(int fd, int timeout, URLContext *h);
+
+/**
  * Connect to a file descriptor and poll for result.
  *
  * @param fd   First argument of connect(),
-- 
2.1.0

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


[FFmpeg-devel] [PATCH 2/8] lavf/avio: add ffurl_accept and ffurl_handshake

2015-07-20 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 libavformat/avio.c | 19 +++
 libavformat/url.h  | 18 ++
 2 files changed, 37 insertions(+)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index c188adc..1182336 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -211,6 +211,25 @@ int ffurl_connect(URLContext *uc, AVDictionary **options)
 return 0;
 }
 
+int ffurl_accept(URLContext *s, URLContext **c)
+{
+if (s->prot->url_accept)
+return s->prot->url_accept(s, c);
+return 0;
+}
+
+int ffurl_handshake(URLContext *c)
+{
+int ret;
+if (c->prot->url_handshake) {
+ret = c->prot->url_handshake(c);
+if (ret)
+return ret;
+}
+c->is_connected = 1;
+return 0;
+}
+
 #define URL_SCHEME_CHARS\
 "abcdefghijklmnopqrstuvwxyz"\
 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"\
diff --git a/libavformat/url.h b/libavformat/url.h
index 99a3201..d010a77 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -58,6 +58,8 @@ typedef struct URLProtocol {
  * for those nested protocols.
  */
 int (*url_open2)(URLContext *h, const char *url, int flags, 
AVDictionary **options);
+int (*url_accept)(URLContext *s, URLContext **c);
+int (*url_handshake)(URLContext *c);
 
 /**
  * Read data from the protocol.
@@ -140,6 +142,22 @@ int ffurl_open(URLContext **puc, const char *filename, int 
flags,
const AVIOInterruptCB *int_cb, AVDictionary **options);
 
 /**
+ * Accept an URLContext c on an URLContext s
+ * @param  s server context
+ * @param  c client context
+ * @return >= 0 on success, ff_neterrno() on failure.
+ */
+int ffurl_accept(URLContext *s, URLContext **c);
+
+/**
+ * Perform a protocol handshake on the passed client context.
+ * @param  c the client context
+ * @return >= 0 on success or a negative value corresponding
+ * to an AVERROR code on failure
+ */
+int ffurl_handshake(URLContext *c);
+
+/**
  * Read up to size bytes from the resource accessed by h, and store
  * the read bytes in buf.
  *
-- 
2.1.0

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


[FFmpeg-devel] [PATCH 3/8] lavf/avio: add avio_accept and avio_handshake

2015-07-20 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 libavformat/avio.h| 16 
 libavformat/aviobuf.c | 17 +
 2 files changed, 33 insertions(+)

diff --git a/libavformat/avio.h b/libavformat/avio.h
index d3d9bbd..b7a4fa8 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -648,4 +648,20 @@ struct AVBPrint;
  */
 int avio_read_to_bprint(AVIOContext *h, struct AVBPrint *pb, size_t max_size);
 
+/**
+ * Accept and allocate a client context on a server context.
+ * @param  s the server context
+ * @param  c the client context
+ * @return   >= 0 on success or a negative value corresponding
+ *   to an AVERROR on failure
+ */
+int avio_accept(AVIOContext *s, AVIOContext **c);
+
+/**
+ * Perform a protocol dependent handshake
+ * @param  c the client context to perform the handshake on
+ * @return   >= 0 on success or a negative value corresponding
+ *   to an AVERROR on failure
+ */
+int avio_handshake(AVIOContext *c);
 #endif /* AVFORMAT_AVIO_H */
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index ff85081..ce05c5d 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -1021,6 +1021,23 @@ int avio_read_to_bprint(AVIOContext *h, AVBPrint *pb, 
size_t max_size)
 return 0;
 }
 
+int avio_accept(AVIOContext *s, AVIOContext **c)
+{
+int ret;
+URLContext *sc = s->opaque;
+URLContext *cc;
+ret = ffurl_accept(sc, &cc);
+if (ret < 0)
+return ret;
+return ffio_fdopen(c, cc);
+}
+
+int avio_handshake(AVIOContext *c)
+{
+URLContext *cc = c->opaque;
+return ffurl_handshake(cc);
+}
+
 /* output in a dynamic buffer */
 
 typedef struct DynBuffer {
-- 
2.1.0

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


[FFmpeg-devel] [PATCH 5/8] lavf/tcp: increase range for listen and call the underlying socket operations accordingly

2015-07-20 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 libavformat/tcp.c | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 6f5e175..5505945 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -45,7 +45,7 @@ typedef struct TCPContext {
 #define D AV_OPT_FLAG_DECODING_PARAM
 #define E AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
-{ "listen",  "Listen for incoming connections",  OFFSET(listen),   
  AV_OPT_TYPE_INT, { .i64 = 0 }, 0,   1,   .flags = D|E },
+{ "listen",  "Listen for incoming connections",  OFFSET(listen),   
  AV_OPT_TYPE_INT, { .i64 = 0 }, 0,   2,   .flags = D|E },
 { "timeout", "set timeout (in microseconds) of socket I/O operations", 
OFFSET(rw_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, 
.flags = D|E },
 { "listen_timeout",  "Connection awaiting timeout (in milliseconds)",  
OFFSET(listen_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, 
.flags = D|E },
 { NULL }
@@ -126,12 +126,18 @@ static int tcp_open(URLContext *h, const char *uri, int 
flags)
 goto fail;
 }
 
-if (s->listen) {
-if ((ret = ff_listen_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen,
-  s->listen_timeout, h)) < 0) {
+if (s->listen == 2) {
+// multi-client
+if ((ret = ff_listen(fd, cur_ai->ai_addr, cur_ai->ai_addrlen)) < 0) {
+goto fail1;
+}
+} else if (s->listen == 1) {
+// single client
+if ((fd = ff_listen_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen,
+ s->listen_timeout, h)) < 0) {
+ret = fd;
 goto fail1;
 }
-fd = ret;
 } else {
 if ((ret = ff_listen_connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen,
  s->open_timeout / 1000, h, 
!!cur_ai->ai_next)) < 0) {
-- 
2.1.0

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


[FFmpeg-devel] [PATCH 4/8] lavf/tcp: add tcp_accept

2015-07-20 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 libavformat/tcp.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index f24cad2..6f5e175 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
+#include "libavutil/avassert.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/opt.h"
 #include "libavutil/time.h"
@@ -163,6 +164,22 @@ static int tcp_open(URLContext *h, const char *uri, int 
flags)
 return ret;
 }
 
+static int tcp_accept(URLContext *s, URLContext **c)
+{
+TCPContext *sc = s->priv_data;
+TCPContext *cc;
+int ret;
+av_assert0(sc->listen);
+if ((ret = ffurl_alloc(c, s->filename, s->flags & AVIO_FLAG_READ_WRITE, 
&s->interrupt_callback)) < 0)
+return ret;
+cc = (*c)->priv_data;
+ret = ff_accept(sc->fd, sc->listen_timeout, s);
+if (ret < 0)
+return ff_neterrno();
+cc->fd = ret;
+return 0;
+}
+
 static int tcp_read(URLContext *h, uint8_t *buf, int size)
 {
 TCPContext *s = h->priv_data;
@@ -223,6 +240,7 @@ static int tcp_get_file_handle(URLContext *h)
 URLProtocol ff_tcp_protocol = {
 .name= "tcp",
 .url_open= tcp_open,
+.url_accept  = tcp_accept,
 .url_read= tcp_read,
 .url_write   = tcp_write,
 .url_close   = tcp_close,
-- 
2.1.0

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


[FFmpeg-devel] [PATCH 6/8] lavf/http: increase range for listen, handle connection closing accordingly, add http_accept, add http_handshake and move handshake logic there

2015-07-20 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 libavformat/http.c | 126 -
 1 file changed, 105 insertions(+), 21 deletions(-)

Changes since last version:
  - Introduce constants for different client modes
  - Add resource and http_code to AVOptions
  - Add http_write_header()
  - Implement handshake that allows multiple roundtrips between application
and library.

diff --git a/libavformat/http.c b/libavformat/http.c
index 676bfd5..2597628 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -25,6 +25,7 @@
 #include 
 #endif /* CONFIG_ZLIB */
 
+#include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
 #include "libavutil/opt.h"
 
@@ -44,6 +45,9 @@
  * path names). */
 #define BUFFER_SIZE   MAX_URL_SIZE
 #define MAX_REDIRECTS 8
+#define HTTP_ONESHOT  1
+#define HTTP_MUTLI2
+#define HTTP_MULTI_CLIENT 4
 
 typedef struct HTTPContext {
 const AVClass *class;
@@ -97,6 +101,7 @@ typedef struct HTTPContext {
 char *method;
 int reconnect;
 int listen;
+char *resource;
 } HTTPContext;
 
 #define OFFSET(x) offsetof(HTTPContext, x)
@@ -128,7 +133,9 @@ static const AVOption options[] = {
 { "end_offset", "try to limit the request to bytes preceding this offset", 
OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D },
 { "method", "Override the HTTP method or set the expected HTTP method from 
a client", OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D | E },
 { "reconnect", "auto reconnect after disconnect before EOF", 
OFFSET(reconnect), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D },
-{ "listen", "listen on HTTP", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 
}, 0, 1, D | E },
+{ "listen", "listen on HTTP", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 
}, 0, 4, D | E },
+{ "resource", "The resource requested by a client", OFFSET(resource), 
AV_OPT_TYPE_STRING, { 0 }, 0, 0, E },
+{ "http_code", "The http code to send to a client", OFFSET(http_code), 
AV_OPT_TYPE_INT, { .i64 = 0}, 0, 599, E},
 { NULL }
 };
 
@@ -299,32 +306,87 @@ int ff_http_averror(int status_code, int default_averror)
 return default_averror;
 }
 
+static int http_write_header(URLContext* h, int status_code)
+{
+int ret;
+const char *message;
+// Maybe this should be done more elegantly?
+static const char bad_request[] = "HTTP/1.1 400 Bad 
Request\r\nContent-Type: text/plain\r\nContent-Length: 17\r\n400 Bad 
Request\r\n";
+static const char forbidden[] = "HTTP/1.1 403 Forbidden\r\nContent-Type: 
text/plain\r\nContent-Length: 15\r\n\r\n403 Forbidden\r\n";
+static const char not_found[] = "HTTP/1.1 404 Not Found\r\nContent-Type: 
text/plain\r\nContent-Length: 15\r\n\r\n404 Not Found\r\n";
+static const char internal_server_error[] = "HTTP/1.1 500 Internal server 
error\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n\r\n500 Internal 
server error\r\n";
+static const char ok[] = "HTTP/1.1 200 OK\r\nContent-Type: 
application/octet-stream\r\nTransfer-Encoding: chunked\r\n\r\n";
+av_log(h, AV_LOG_TRACE, "err: %d\n", status_code);
+if (status_code == 200) {
+message = ok;
+goto end;
+}
+switch(status_code) {
+case AVERROR_HTTP_BAD_REQUEST:
+message = bad_request;
+break;
+case AVERROR_HTTP_FORBIDDEN:
+message = forbidden;
+break;
+case AVERROR_HTTP_NOT_FOUND:
+message = not_found;
+break;
+default:
+message = internal_server_error;
+}
+end:
+if ((ret = ffurl_write(h, message, strlen(message))) < 0)
+return ret;
+// Avoid returning a positive value from ffurl_write()
+ret = ret > 0 ? 0 : ret;
+return ret;
+}
+
 static void handle_http_errors(URLContext *h, int error)
 {
-static const char bad_request[] = "HTTP/1.1 400 Bad 
Request\r\nContent-Type: text/plain\r\n\r\n400 Bad Request\r\n";
-static const char internal_server_error[] = "HTTP/1.1 500 Internal server 
error\r\nContent-Type: text/plain\r\n\r\n500 Internal server error\r\n";
 HTTPContext *s = h->priv_data;
-if (h->is_connected) {
-switch(error) {
-case AVERROR_HTTP_BAD_REQUEST:
-ffurl_write(s->hd, bad_request, strlen(bad_request));
-break;
-default:
-av_log(h, AV_LOG_ERROR, "Unhandled HTTP error.\n");
-ffurl_write(s->hd, internal_server_error, 
strlen(internal_server_error));
+URLContext *c = s->hd;
+av_assert0(error < 0);
+http_write_header(c, error);
+}
+
+static int http_handshake(URLContext *c)
+{
+int ret, err, new_location;
+HTTPContext *ch = c->priv_data;
+URLContext *cl = ch->hd;
+for (;;) {
+if ((ret = ffurl_handshake(cl)) < 0)
+return ret;
+if (ret == 0)
+break;
+}
+if (!ch->end_header) {
+if ((err = http_read_header(c, &new_location)) 

[FFmpeg-devel] [PATCH 8/8] doc/example: Add http multi-client example code

2015-07-20 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 doc/examples/Makefile   |   1 +
 doc/examples/http_multiclient.c | 139 
 2 files changed, 140 insertions(+)
 create mode 100644 doc/examples/http_multiclient.c

Changes since last version:
  - Use handshake API properly
  - Use perror() to print fork()'s error message. 

diff --git a/doc/examples/Makefile b/doc/examples/Makefile
index 9699f11..8c9501b 100644
--- a/doc/examples/Makefile
+++ b/doc/examples/Makefile
@@ -18,6 +18,7 @@ EXAMPLES=   avio_list_dir  \
 extract_mvs\
 filtering_video\
 filtering_audio\
+http_multiclient   \
 metadata   \
 muxing \
 remuxing   \
diff --git a/doc/examples/http_multiclient.c b/doc/examples/http_multiclient.c
new file mode 100644
index 000..a2293b8
--- /dev/null
+++ b/doc/examples/http_multiclient.c
@@ -0,0 +1,139 @@
+/*
+ * copyright (c) 2015 Stephan Holljes
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * libavformat multi-client network API usage example.
+ *
+ * @example http_multiclient.c
+ * This example will serve a file without decoding or demuxing it over http.
+ * Multiple clients can connect and will receive the same file.
+ */
+
+#include 
+#include 
+#include 
+
+void process_client(AVIOContext *client, const char* in_uri)
+{
+AVIOContext *input = NULL;
+uint8_t buf[1024];
+int ret, n, http_code;
+char *resource;
+for (;;) {
+if ((ret = avio_handshake(client)) < 0)
+goto end;
+av_opt_get(client, "resource", AV_OPT_SEARCH_CHILDREN, &resource);
+resource++;
+av_log(client, AV_LOG_TRACE, "resource=%s\n", resource);
+if (strcmp(resource, in_uri)) {
+http_code = 404;
+} else {
+http_code = 200;
+}
+av_opt_set_int(client, "http_code", http_code, AV_OPT_SEARCH_CHILDREN);
+if (ret == 0)
+break;
+}
+fprintf(stderr, "Handshake performed.\n");
+if (http_code != 200)
+goto end;
+fprintf(stderr, "Opening input file.\n");
+if ((ret = avio_open2(&input, in_uri, AVIO_FLAG_READ, NULL, NULL)) < 0) {
+av_log(input, AV_LOG_ERROR, "Failed to open input: %s\n", in_uri);
+goto end;
+}
+for(;;) {
+n = avio_read(input, buf, sizeof(buf));
+if (n < 0) {
+if (n == AVERROR_EOF)
+break;
+av_log(input, AV_LOG_ERROR, "Error reading from input: %s.\n",
+   av_err2str(n));
+ret = n;
+break;
+}
+avio_write(client, buf, n);
+avio_flush(client);
+}
+end:
+fprintf(stderr, "Flushing client\n");
+avio_flush(client);
+fprintf(stderr, "Closing client\n");
+avio_close(client);
+fprintf(stderr, "Closing input\n");
+avio_close(input);
+}
+
+int main(int argc, char **argv)
+{
+av_log_set_level(AV_LOG_TRACE);
+AVDictionary *options = NULL;
+AVIOContext *client = NULL, *server = NULL;
+const char *in_uri, *out_uri;
+int ret, pid;
+if (argc < 3) {
+printf("usage: %s input http://hostname[:port]\n";
+   "API example program to serve http to multiple clients.\n"
+   "\n", argv[0]);
+return 1;
+}
+
+in_uri = argv[1];
+out_uri = argv[2];
+
+av_register_all();
+avformat_network_init();
+
+if ((ret = av_dict_set(&options, "listen", "2", 0)) < 0)
+goto end;
+if ((ret = avio_open2(&server, out_uri, AVIO_FLAG_WRITE, NULL, &options)) 
< 0)
+goto end;
+fprintf(stderr, "Entering main loop.\n");
+for(;;) {
+if ((ret = avio_accept(server, &client)) < 0)
+goto end;
+fprintf(stderr, "Accepted client, forking process.\n");
+// XXX: Since we don't reap our children and don't ignore signals
+//  this produces zombie processes.
+pid = fork();
+if (pid < 0) {
+perror("Fork failed");
+  

[FFmpeg-devel] [PATCH 7/8] doc/protocols: document experimental mutli-client api

2015-07-20 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 doc/protocols.texi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index f152f5a..905bc09 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -304,6 +304,8 @@ autodetection in the future.
 If set to 1 enables experimental HTTP server. This can be used to send data 
when
 used as an output option, or read data from a client with HTTP POST when used 
as
 an input option.
+If set to 2 enables experimental mutli-client HTTP server. This is not yet 
implemented
+in ffmpeg.c or ffserver.c and thus must not be used as a command line option.
 @example
 # Server side (sending):
 ffmpeg -i somefile.ogg -c copy -listen 1 -f ogg http://@var{server}:@var{port}
-- 
2.1.0

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


Re: [FFmpeg-devel] Controlling the server reply (was: 9/9] doc/example: Add http multi-client) example code

2015-07-20 Thread Stephan Holljes
I will send the latest version of my patchset as git send-email messages.
The major changes are:
- Introduction of constants to distinguish the types of client the
library is dealing with. (HTTP_ONESHOT, HTTP_MULTI, HTTP_MULTI_CLIENT)
- Usage of the AVOption system for communication during handshake
- http_handshake() implemented to allow multiple round-trips between
application and library.

> [...]
> > +cc = (*c)->priv_data;
> > +if ((ret = ffurl_accept(sl, &cl)) < 0)
> > +goto fail;
>
> > +cc->hd = cl;
>
> Does it make sense to set "cc->listen = 1" here, to indicate that the client
> is not yet a normal client? It may make the tests for trailers simpler.

It makes sense to set cc->listen here, since it indicates to the
library that it has to send server-responses. However, it does not
seem to make tests for trailers simpler, or I am not seeing it.


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


[FFmpeg-devel] [PATCH] avcodec/utils: silence some deprecation warnings

2015-07-20 Thread James Almer
And prevent eventual compilation failures once the relevant functions
and fields are removed.

Signed-off-by: James Almer 
---
 libavcodec/utils.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 16601dd..d926a26 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2090,10 +2090,15 @@ int attribute_align_arg 
avcodec_encode_audio(AVCodecContext *avctx,
 
 got_packet = 0;
 ret = avcodec_encode_audio2(avctx, &pkt, frame, &got_packet);
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
 if (!ret && got_packet && avctx->coded_frame) {
 avctx->coded_frame->pts   = pkt.pts;
 avctx->coded_frame->key_frame = !!(pkt.flags & AV_PKT_FLAG_KEY);
 }
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
 /* free any side data since we cannot return it */
 av_packet_free_side_data(&pkt);
 
@@ -2123,10 +2128,14 @@ int attribute_align_arg 
avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf
 pkt.size = buf_size;
 
 ret = avcodec_encode_video2(avctx, &pkt, pict, &got_packet);
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
 if (!ret && got_packet && avctx->coded_frame) {
 avctx->coded_frame->pts   = pkt.pts;
 avctx->coded_frame->key_frame = !!(pkt.flags & AV_PKT_FLAG_KEY);
 }
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 
 /* free any side data since we cannot return it */
 if (pkt.side_data_elems > 0) {
@@ -2492,6 +2501,8 @@ int attribute_align_arg 
avcodec_decode_audio3(AVCodecContext *avctx, int16_t *sa
 
 if (!frame)
 return AVERROR(ENOMEM);
+#if FF_API_GET_BUFFER
+FF_DISABLE_DEPRECATION_WARNINGS
 if (avctx->get_buffer != avcodec_default_get_buffer) {
 av_log(avctx, AV_LOG_ERROR, "Custom get_buffer() for use with"
 "avcodec_decode_audio3() detected. 
Overriding with avcodec_default_get_buffer\n");
@@ -2500,6 +2511,8 @@ int attribute_align_arg 
avcodec_decode_audio3(AVCodecContext *avctx, int16_t *sa
 avctx->get_buffer = avcodec_default_get_buffer;
 avctx->release_buffer = avcodec_default_release_buffer;
 }
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 
 ret = avcodec_decode_audio4(avctx, frame, &got_frame, avpkt);
 
-- 
2.4.5

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


Re: [FFmpeg-devel] [PATCH] conversion of FFV1 specification from lyx to markdown

2015-07-20 Thread Dave Rice

> On Jul 20, 2015, at 8:52 PM, Michael Niedermayer  
> wrote:
> 
> On Tue, Jul 21, 2015 at 02:14:11AM +0200, Michael Niedermayer wrote:
> [...]
>> ill take another quick look and then will probably push your changes
>> its probably easier to work on top of it then wait with pushing until
>> its perfect
> 
> pushed it
> 
> btw please remove trailing whitespace unless some of it is required
> for the formating or something

Send this pull request to clean up white spaces, indentation, and trailing 
slashes. https://github.com/FFmpeg/FFV1/pull/12

> also, it seems github doesnt render all parts of the file well, some
> look quite broken (found by jamrial)

Github's markdown rendering is a little different than pandoc's rendering. Some 
table updates were done here: https://github.com/FFmpeg/FFV1/pull/11 
. There's still the header which starts 
with percent signs, this is a workaround to get pandoc to render that as a 
header but to not include it within the table of contents.

Unless I'm missing something, Github doesn't seem to support rendering latex 
style equations in markdown (although pandoc does) so we may not be able to 
have a markdown that can be fully rendered by Github alone (unless we remove 
the need for latex). Perhaps the ffv1.md could occasionally be rendered (via 
the makefile) with the outputs updated on ffmpeg.org . Then 
within the README of the FFV1 repo we could link to the rendered copy on 
ffmpeg.org .

[...]

Best Regards,
Dave Rice
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/8] lavf/tcp: add tcp_accept

2015-07-20 Thread Stephan Holljes
On Tue, Jul 21, 2015 at 5:45 AM, Stephan Holljes
 wrote:
> Signed-off-by: Stephan Holljes 
> ---
>  libavformat/tcp.c | 18 ++
>  1 file changed, 18 insertions(+)
>
> diff --git a/libavformat/tcp.c b/libavformat/tcp.c
> index f24cad2..6f5e175 100644
> --- a/libavformat/tcp.c
> +++ b/libavformat/tcp.c
> @@ -19,6 +19,7 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
>   */
>  #include "avformat.h"
> +#include "libavutil/avassert.h"
>  #include "libavutil/parseutils.h"
>  #include "libavutil/opt.h"
>  #include "libavutil/time.h"
> @@ -163,6 +164,22 @@ static int tcp_open(URLContext *h, const char *uri, int 
> flags)
>  return ret;
>  }
>
> +static int tcp_accept(URLContext *s, URLContext **c)
> +{
> +TCPContext *sc = s->priv_data;
> +TCPContext *cc;
> +int ret;
> +av_assert0(sc->listen);
> +if ((ret = ffurl_alloc(c, s->filename, s->flags & AVIO_FLAG_READ_WRITE, 
> &s->interrupt_callback)) < 0)
> +return ret;
> +cc = (*c)->priv_data;
> +ret = ff_accept(sc->fd, sc->listen_timeout, s);
> +if (ret < 0)
> +return ff_neterrno();
> +cc->fd = ret;
> +return 0;
> +}
> +
>  static int tcp_read(URLContext *h, uint8_t *buf, int size)
>  {
>  TCPContext *s = h->priv_data;
> @@ -223,6 +240,7 @@ static int tcp_get_file_handle(URLContext *h)
>  URLProtocol ff_tcp_protocol = {
>  .name= "tcp",
>  .url_open= tcp_open,
> +.url_accept  = tcp_accept,
>  .url_read= tcp_read,
>  .url_write   = tcp_write,
>  .url_close   = tcp_close,
> --
> 2.1.0
>

I forgot to filter the correct flags. Attached patch is identical, but
uses "s->flags & (AVIO_FLAG_READ_WRITE | AVIO_FLAG_DIRECT)" in
ffurl_alloc()
From 2147606264089c7cab0b44798fa2c03d5df7547b Mon Sep 17 00:00:00 2001
From: Stephan Holljes 
Date: Fri, 3 Jul 2015 02:27:09 +0200
Subject: [PATCH 6/8] lavf/tcp: add tcp_accept

Signed-off-by: Stephan Holljes 
---
 libavformat/tcp.c | 35 ++-
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index f24cad2..ed9abc5 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
+#include "libavutil/avassert.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/opt.h"
 #include "libavutil/time.h"
@@ -44,7 +45,7 @@ typedef struct TCPContext {
 #define D AV_OPT_FLAG_DECODING_PARAM
 #define E AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
-{ "listen",  "Listen for incoming connections",  OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0,   1,   .flags = D|E },
+{ "listen",  "Listen for incoming connections",  OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0,   2,   .flags = D|E },
 { "timeout", "set timeout (in microseconds) of socket I/O operations", OFFSET(rw_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E },
 { "listen_timeout",  "Connection awaiting timeout (in milliseconds)",  OFFSET(listen_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E },
 { NULL }
@@ -125,12 +126,18 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
 goto fail;
 }
 
-if (s->listen) {
-if ((ret = ff_listen_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen,
-  s->listen_timeout, h)) < 0) {
+if (s->listen == 2) {
+// multi-client
+if ((ret = ff_listen(fd, cur_ai->ai_addr, cur_ai->ai_addrlen)) < 0) {
+goto fail1;
+}
+} else if (s->listen == 1) {
+// single client
+if ((fd = ff_listen_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen,
+ s->listen_timeout, h)) < 0) {
+ret = fd;
 goto fail1;
 }
-fd = ret;
 } else {
 if ((ret = ff_listen_connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen,
  s->open_timeout / 1000, h, !!cur_ai->ai_next)) < 0) {
@@ -163,6 +170,23 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
 return ret;
 }
 
+static int tcp_accept(URLContext *s, URLContext **c)
+{
+TCPContext *sc = s->priv_data;
+TCPContext *cc;
+int ret;
+av_assert0(sc->listen);
+if ((ret = ffurl_alloc(c, s->filename, s->flags & (AVIO_FLAG_READ_WRITE | AVIO_FLAG_DIRECT),
+   &s->interrupt_callback)) < 0)
+return ret;
+cc = (*c)->priv_data;
+ret = ff_accept(sc->fd, sc->listen_timeout, s);
+if (ret < 0)
+return ff_neterrno();
+cc->fd = ret;
+return 0;
+}
+
 static int tcp_read(URLContext *h, uint8_t *buf, int size)
 {
 TCPContext *s = h->priv_data;
@@ -223,6 +247,7 @@ static int tcp_get_file_handl

Re: [FFmpeg-devel] [PATCH 4/8] lavf/tcp: add tcp_accept

2015-07-20 Thread Stephan Holljes
On Tue, Jul 21, 2015 at 5:58 AM, Stephan Holljes
 wrote:
> On Tue, Jul 21, 2015 at 5:45 AM, Stephan Holljes
>  wrote:
>> Signed-off-by: Stephan Holljes 
>> ---
>>  libavformat/tcp.c | 18 ++
>>  1 file changed, 18 insertions(+)
>>
>> diff --git a/libavformat/tcp.c b/libavformat/tcp.c
>> index f24cad2..6f5e175 100644
>> --- a/libavformat/tcp.c
>> +++ b/libavformat/tcp.c
>> @@ -19,6 +19,7 @@
>>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
>> USA
>>   */
>>  #include "avformat.h"
>> +#include "libavutil/avassert.h"
>>  #include "libavutil/parseutils.h"
>>  #include "libavutil/opt.h"
>>  #include "libavutil/time.h"
>> @@ -163,6 +164,22 @@ static int tcp_open(URLContext *h, const char *uri, int 
>> flags)
>>  return ret;
>>  }
>>
>> +static int tcp_accept(URLContext *s, URLContext **c)
>> +{
>> +TCPContext *sc = s->priv_data;
>> +TCPContext *cc;
>> +int ret;
>> +av_assert0(sc->listen);
>> +if ((ret = ffurl_alloc(c, s->filename, s->flags & AVIO_FLAG_READ_WRITE, 
>> &s->interrupt_callback)) < 0)
>> +return ret;
>> +cc = (*c)->priv_data;
>> +ret = ff_accept(sc->fd, sc->listen_timeout, s);
>> +if (ret < 0)
>> +return ff_neterrno();
>> +cc->fd = ret;
>> +return 0;
>> +}
>> +
>>  static int tcp_read(URLContext *h, uint8_t *buf, int size)
>>  {
>>  TCPContext *s = h->priv_data;
>> @@ -223,6 +240,7 @@ static int tcp_get_file_handle(URLContext *h)
>>  URLProtocol ff_tcp_protocol = {
>>  .name= "tcp",
>>  .url_open= tcp_open,
>> +.url_accept  = tcp_accept,
>>  .url_read= tcp_read,
>>  .url_write   = tcp_write,
>>  .url_close   = tcp_close,
>> --
>> 2.1.0
>>
>
> I forgot to filter the correct flags. Attached patch is identical, but
> uses "s->flags & (AVIO_FLAG_READ_WRITE | AVIO_FLAG_DIRECT)" in
> ffurl_alloc()

Disregard the previous patch, I messed up my commits in git.
From 12d9a1e1c511615275260977941aff3067f103ea Mon Sep 17 00:00:00 2001
From: Stephan Holljes 
Date: Tue, 21 Jul 2015 06:10:25 +0200
Subject: [PATCH 4/8] lavf/tcp: add tcp_accept

Signed-off-by: Stephan Holljes 
---
 libavformat/tcp.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index f24cad2..9f8c2a0 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
+#include "libavutil/avassert.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/opt.h"
 #include "libavutil/time.h"
@@ -163,6 +164,23 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
 return ret;
 }
 
+static int tcp_accept(URLContext *s, URLContext **c)
+{
+TCPContext *sc = s->priv_data;
+TCPContext *cc;
+int ret;
+av_assert0(sc->listen);
+if ((ret = ffurl_alloc(c, s->filename, s->flags & (AVIO_FLAG_READ_WRITE | AVIO_FLAG_DIRECT),
+   &s->interrupt_callback)) < 0)
+return ret;
+cc = (*c)->priv_data;
+ret = ff_accept(sc->fd, sc->listen_timeout, s);
+if (ret < 0)
+return ff_neterrno();
+cc->fd = ret;
+return 0;
+}
+
 static int tcp_read(URLContext *h, uint8_t *buf, int size)
 {
 TCPContext *s = h->priv_data;
@@ -223,6 +241,7 @@ static int tcp_get_file_handle(URLContext *h)
 URLProtocol ff_tcp_protocol = {
 .name= "tcp",
 .url_open= tcp_open,
+.url_accept  = tcp_accept,
 .url_read= tcp_read,
 .url_write   = tcp_write,
 .url_close   = tcp_close,
-- 
2.1.0

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


Re: [FFmpeg-devel] [PATCH 6/8] lavf/http: increase range for listen, handle connection closing accordingly, add http_accept, add http_handshake and move handshake logic there

2015-07-20 Thread Stephan Holljes
On Tue, Jul 21, 2015 at 5:45 AM, Stephan Holljes
 wrote:
> Signed-off-by: Stephan Holljes 
> ---
>  libavformat/http.c | 126 
> -
>  1 file changed, 105 insertions(+), 21 deletions(-)
>
> Changes since last version:
>   - Introduce constants for different client modes
>   - Add resource and http_code to AVOptions
>   - Add http_write_header()
>   - Implement handshake that allows multiple roundtrips between application
> and library.
>
> diff --git a/libavformat/http.c b/libavformat/http.c
> index 676bfd5..2597628 100644
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -25,6 +25,7 @@
>  #include 
>  #endif /* CONFIG_ZLIB */
>
> +#include "libavutil/avassert.h"
>  #include "libavutil/avstring.h"
>  #include "libavutil/opt.h"
>
> @@ -44,6 +45,9 @@
>   * path names). */
>  #define BUFFER_SIZE   MAX_URL_SIZE
>  #define MAX_REDIRECTS 8
> +#define HTTP_ONESHOT  1
> +#define HTTP_MUTLI2
> +#define HTTP_MULTI_CLIENT 4
>
>  typedef struct HTTPContext {
>  const AVClass *class;
> @@ -97,6 +101,7 @@ typedef struct HTTPContext {
>  char *method;
>  int reconnect;
>  int listen;
> +char *resource;
>  } HTTPContext;
>
>  #define OFFSET(x) offsetof(HTTPContext, x)
> @@ -128,7 +133,9 @@ static const AVOption options[] = {
>  { "end_offset", "try to limit the request to bytes preceding this 
> offset", OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D },
>  { "method", "Override the HTTP method or set the expected HTTP method 
> from a client", OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D 
> | E },
>  { "reconnect", "auto reconnect after disconnect before EOF", 
> OFFSET(reconnect), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D },
> -{ "listen", "listen on HTTP", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 
> 0 }, 0, 1, D | E },
> +{ "listen", "listen on HTTP", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 
> 0 }, 0, 4, D | E },
> +{ "resource", "The resource requested by a client", OFFSET(resource), 
> AV_OPT_TYPE_STRING, { 0 }, 0, 0, E },
> +{ "http_code", "The http code to send to a client", OFFSET(http_code), 
> AV_OPT_TYPE_INT, { .i64 = 0}, 0, 599, E},
>  { NULL }
>  };
>
> @@ -299,32 +306,87 @@ int ff_http_averror(int status_code, int 
> default_averror)
>  return default_averror;
>  }
>
> +static int http_write_header(URLContext* h, int status_code)
> +{
> +int ret;
> +const char *message;
> +// Maybe this should be done more elegantly?
> +static const char bad_request[] = "HTTP/1.1 400 Bad 
> Request\r\nContent-Type: text/plain\r\nContent-Length: 17\r\n400 Bad 
> Request\r\n";
> +static const char forbidden[] = "HTTP/1.1 403 Forbidden\r\nContent-Type: 
> text/plain\r\nContent-Length: 15\r\n\r\n403 Forbidden\r\n";
> +static const char not_found[] = "HTTP/1.1 404 Not Found\r\nContent-Type: 
> text/plain\r\nContent-Length: 15\r\n\r\n404 Not Found\r\n";
> +static const char internal_server_error[] = "HTTP/1.1 500 Internal 
> server error\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n\r\n500 
> Internal server error\r\n";
> +static const char ok[] = "HTTP/1.1 200 OK\r\nContent-Type: 
> application/octet-stream\r\nTransfer-Encoding: chunked\r\n\r\n";
> +av_log(h, AV_LOG_TRACE, "err: %d\n", status_code);
> +if (status_code == 200) {
> +message = ok;
> +goto end;
> +}
> +switch(status_code) {
> +case AVERROR_HTTP_BAD_REQUEST:
> +message = bad_request;
> +break;
> +case AVERROR_HTTP_FORBIDDEN:
> +message = forbidden;
> +break;
> +case AVERROR_HTTP_NOT_FOUND:
> +message = not_found;
> +break;
> +default:
> +message = internal_server_error;
> +}
> +end:
> +if ((ret = ffurl_write(h, message, strlen(message))) < 0)
> +return ret;
> +// Avoid returning a positive value from ffurl_write()
> +ret = ret > 0 ? 0 : ret;
> +return ret;
> +}
> +
>  static void handle_http_errors(URLContext *h, int error)
>  {
> -static const char bad_request[] = "HTTP/1.1 400 Bad 
> Request\r\nContent-Type: text/plain\r\n\r\n400 Bad Request\r\n";
> -static const char internal_server_error[] = "HTTP/1.1 500 Internal 
> server error\r\nContent-Type: text/plain\r\n\r\n500 Internal server 
> error\r\n";
>  HTTPContext *s = h->priv_data;
> -if (h->is_connected) {
> -switch(error) {
> -case AVERROR_HTTP_BAD_REQUEST:
> -ffurl_write(s->hd, bad_request, strlen(bad_request));
> -break;
> -default:
> -av_log(h, AV_LOG_ERROR, "Unhandled HTTP error.\n");
> -ffurl_write(s->hd, internal_server_error, 
> strlen(internal_server_error));
> +URLContext *c = s->hd;
> +av_assert0(error < 0);
> +http_write_header(c, error);
> +}
> +
> +static int http_handshake(URLContext *c)
> +{
> +   

Re: [FFmpeg-devel] [PATCH 3/3] aaccoder: Improve IS phase rejection

2015-07-20 Thread Rostislav Pehlivanov
>An alternative technique that may be better in that regard, then,
>would be to measure distortion with both phases, and pick the phase
>that yields the lowest distortion?
That's a very good suggestion.
Since the main problem with M/S and IS was phasing this might be a way to
solve that too.
I'll give it a try.

On 21 July 2015 at 02:02, Claudio Freire  wrote:

> On Fri, Jul 17, 2015 at 11:19 PM, Rostislav Pehlivanov
>  wrote:
> >>But even if not used for avoding I/S, it can be used to pick whether
> >>to invert the phases, where it was clearly more stable.
> > In case the phase is very clearly wrong then there will be an increase in
> > the distortion which should cause the dist2 <= dist1 check to fail and
> thus
> > not use IS. So the phase isn't even very important. The whole point of
> the
> > phase check is to pick out the obviously wrong phases and save time by
> not
> > having to calculate the error of the spectral coefficients. And this
> works
> > better when you individually pick out a majority rather than just summing
> > them up and then doing the decisions.
>
> All the more reason to use energy then.
>
> If you use this sign-difference count, low-energy noise may change the
> count while being inaudible, yielding an incorrect phase value. After
> that, distortion will be huge and the band won't be I/S encoded, but
> it might if the phase value was otherwise.
>
> In general, this algorithm seems fragile (ie: not robust in the
> presence of noise).
>
> Why not forego the optimization and optimize efficiency instead? (it's
> the priority now, running time optimization should be done after
> exploiting the technique to increase quality as much as posibble).
>
> An alternative technique that may be better in that regard, then,
> would be to measure distortion with both phases, and pick the phase
> that yields the lowest distortion?
>
> Give it a try.
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] avcodec: loongson optimize xvid idct with mmi

2015-07-20 Thread 周晓勇
From 0e387e3057deb1390adc1d12e738d7c91b59be18 Mon Sep 17 00:00:00 2001
From: ZhouXiaoyong 
Date: Tue, 21 Jul 2015 10:14:40 +0800
Subject: [PATCH 2/2] avcodec: loongson optimize xvid idct with mmi


Signed-off-by: ZhouXiaoyong 
---
 libavcodec/mips/Makefile |   2 +
 libavcodec/mips/xvid_idct_mmi.c  | 253 +++
 libavcodec/mips/xvididct_init_mips.c |  45 +++
 libavcodec/mips/xvididct_mips.h  |  30 +
 libavcodec/xvididct.c|   2 +
 libavcodec/xvididct.h|   2 +
 6 files changed, 334 insertions(+)


diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile
index 1d27edd..a105661 100644
--- a/libavcodec/mips/Makefile
+++ b/libavcodec/mips/Makefile
@@ -34,6 +34,7 @@ OBJS-$(CONFIG_IDCTDSP)+= 
mips/idctdsp_init_mips.o
 OBJS-$(CONFIG_MPEGVIDEO)  += mips/mpegvideo_init_mips.o
 OBJS-$(CONFIG_MPEGVIDEOENC)   += mips/mpegvideoencdsp_init_mips.o
 OBJS-$(CONFIG_ME_CMP) += mips/me_cmp_init_mips.o
+OBJS-$(CONFIG_MPEG4_DECODER)  += mips/xvididct_init_mips.o
 MSA-OBJS-$(CONFIG_HEVC_DECODER)   += mips/hevcdsp_msa.o\
  mips/hevc_mc_uni_msa.o\
  mips/hevc_mc_uniw_msa.o   \
@@ -65,3 +66,4 @@ MMI-OBJS-$(CONFIG_H264PRED)   += 
mips/h264pred_mmi.o
 MMI-OBJS-$(CONFIG_MPEGVIDEO)  += mips/mpegvideo_mmi.o
 MMI-OBJS-$(CONFIG_IDCTDSP)+= mips/idctdsp_mmi.o   \
  mips/simple_idct_mmi.o
+MMI-OBJS-$(CONFIG_MPEG4_DECODER)  += mips/xvid_idct_mmi.o
diff --git a/libavcodec/mips/xvid_idct_mmi.c b/libavcodec/mips/xvid_idct_mmi.c
new file mode 100644
index 000..d3f9acb
--- /dev/null
+++ b/libavcodec/mips/xvid_idct_mmi.c
@@ -0,0 +1,253 @@
+/*
+ * Loongson SIMD optimized xvid idct
+ *
+ * Copyright (c) 2015 Loongson Technology Corporation Limited
+ * Copyright (c) 2015 Zhou Xiaoyong 
+ *
+ * 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 "idctdsp_mips.h"
+#include "xvididct_mips.h"
+
+#define BITS_INV_ACC5   // 4 or 5 for IEEE
+#define SHIFT_INV_ROW   (16 - BITS_INV_ACC) //11
+#define SHIFT_INV_COL   (1 + BITS_INV_ACC)  //6
+#define RND_INV_ROW (1024 * (6 - BITS_INV_ACC))
+#define RND_INV_COL (16 * (BITS_INV_ACC - 3))
+#define RND_INV_CORR(RND_INV_COL - 1)
+
+#define BITS_FRW_ACC3   // 2 or 3 for accuracy
+#define SHIFT_FRW_COL   BITS_FRW_ACC
+#define SHIFT_FRW_ROW   (BITS_FRW_ACC + 17)
+#define RND_FRW_ROW (262144*(BITS_FRW_ACC - 1))
+
+DECLARE_ALIGNED(8, static const int16_t, tg_1_16)[4*4] = {
+ 13036, 13036, 13036, 13036,//  tg * (2<<16) + 0.5
+ 27146, 27146, 27146, 27146,//  tg * (2<<16) + 0.5
+-21746,-21746,-21746,-21746,//  tg * (2<<16) + 0.5
+ 23170, 23170, 23170, 23170 // cos * (2<<15) + 0.5
+};
+
+DECLARE_ALIGNED(8, static const int32_t, rounder_0)[2*8] = {
+65536,65536,
+ 3597, 3597,
+ 2260, 2260,
+ 1203, 1203,
+0,0,
+  120,  120,
+  512,  512,
+  512,  512
+};
+
+DECLARE_ALIGNED(8, static const int16_t, tab_i_04_mmi)[32*4] = {
+ 16384, 21407, 16384,  8867,// w05 w04 w01 w00
+ 16384,  8867,-16384,-21407,// w07 w06 w03 w02
+ 16384, -8867, 16384,-21407,// w13 w12 w09 w08
+-16384, 21407, 16384, -8867,// w15 w14 w11 w10
+ 22725, 19266, 19266, -4520,// w21 w20 w17 w16
+ 12873,  4520,-22725,-12873,// w23 w22 w19 w18
+ 12873,-22725,  4520,-12873,// w29 w28 w25 w24
+  4520, 19266, 19266,-22725,// w31 w30 w27 w26
+
+ 22725, 29692, 22725, 12299,// w05 w04 w01 w00
+ 22725, 12299,-22725,-29692,// w07 w06 w03 w02
+ 22725,-12299, 22725,-29692,// w13 w12 w09 w08
+-22725, 29692, 22725,-12299,// w15 w14 w11 w10
+ 31521, 26722, 26722, -6270,// w21 w20 w17 w16
+ 17855,  6270,-31521,-17855,// w23 w22 w19 w18
+ 17855,-31521,  6270,-17855,// w29 w28 w25 w24
+  6270, 26722, 26722,-31521,// w31 w30 w27 w26
+
+ 21407, 27969, 21407, 11585,// w05 w04 w01 w00
+   

Re: [FFmpeg-devel] [PATCH 2/3] aacenc: move the generation of ff_aac_pow34sf_tab[]

2015-07-20 Thread Claudio Freire
On Mon, Jul 20, 2015 at 10:05 PM, Claudio Freire  wrote:
> This will need rebasing, the fixed tablegen got in recently
>
>
> On Fri, Jul 17, 2015 at 6:20 PM, Rostislav Pehlivanov
>  wrote:
>> This commit moves the generation of ff_aac_pow34sf_tab[] out of the
>> encoder and into the table generator. The original commit log for
>> this table in 2011 actually mentions that it should be moved outside
>> but this never happened.
>>
>> This is the first commit which cleans up the encoder a little.
>> ---
>>  libavcodec/aac_tablegen.c  | 2 ++
>>  libavcodec/aac_tablegen.h  | 5 -
>>  libavcodec/aac_tablegen_decl.h | 2 ++
>>  libavcodec/aaccoder.c  | 1 +
>>  libavcodec/aacenc.c| 4 
>>  libavcodec/aacenc.h| 2 --
>>  6 files changed, 9 insertions(+), 7 deletions(-)


Forget I said anything, the tablegen changes that got in don't conflict.

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


[FFmpeg-devel] [PATCH 1/2] avcodec: loongson move simple idct functions to a separate file

2015-07-20 Thread 周晓勇
From f90a2009bd7fc6832cd9c1df174e52e7a1431c0e Mon Sep 17 00:00:00 2001
From: ZhouXiaoyong 
Date: Tue, 21 Jul 2015 10:08:21 +0800
Subject: [PATCH 1/2] avcodec: loongson move simple idct functions to a
 separate file


Signed-off-by: ZhouXiaoyong 
---
 libavcodec/mips/Makefile|   3 +-
 libavcodec/mips/idctdsp_init_mips.c |   4 +-
 libavcodec/mips/idctdsp_mmi.c   | 811 ---
 libavcodec/mips/simple_idct_mmi.c   | 833 
 4 files changed, 837 insertions(+), 814 deletions(-)


diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile
index c2996c2..1d27edd 100644
--- a/libavcodec/mips/Makefile
+++ b/libavcodec/mips/Makefile
@@ -63,4 +63,5 @@ MMI-OBJS-$(CONFIG_H264DSP)+= 
mips/h264dsp_mmi.o
 MMI-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_mmi.o
 MMI-OBJS-$(CONFIG_H264PRED)   += mips/h264pred_mmi.o
 MMI-OBJS-$(CONFIG_MPEGVIDEO)  += mips/mpegvideo_mmi.o
-MMI-OBJS-$(CONFIG_IDCTDSP)+= mips/idctdsp_mmi.o
+MMI-OBJS-$(CONFIG_IDCTDSP)+= mips/idctdsp_mmi.o   \
+ mips/simple_idct_mmi.o
diff --git a/libavcodec/mips/idctdsp_init_mips.c 
b/libavcodec/mips/idctdsp_init_mips.c
index 3d2192e..ac21669 100644
--- a/libavcodec/mips/idctdsp_init_mips.c
+++ b/libavcodec/mips/idctdsp_init_mips.c
@@ -43,7 +43,7 @@ static av_cold void idctdsp_init_msa(IDCTDSPContext *c, 
AVCodecContext *avctx,
 
 #if HAVE_MMI
 static av_cold void idctdsp_init_mmi(IDCTDSPContext *c, AVCodecContext *avctx,
- unsigned high_bit_depth)
+unsigned high_bit_depth)
 {
 if ((avctx->lowres != 1) && (avctx->lowres != 2) && (avctx->lowres != 3) &&
 (avctx->bits_per_raw_sample != 10) &&
@@ -61,7 +61,7 @@ static av_cold void idctdsp_init_mmi(IDCTDSPContext *c, 
AVCodecContext *avctx,
 }
 #endif /* HAVE_MMI */
 
-void ff_idctdsp_init_mips(IDCTDSPContext *c, AVCodecContext *avctx,
+av_cold void ff_idctdsp_init_mips(IDCTDSPContext *c, AVCodecContext *avctx,
   unsigned high_bit_depth)
 {
 #if HAVE_MSA
diff --git a/libavcodec/mips/idctdsp_mmi.c b/libavcodec/mips/idctdsp_mmi.c
index 83afb8a..25476f3 100644
--- a/libavcodec/mips/idctdsp_mmi.c
+++ b/libavcodec/mips/idctdsp_mmi.c
@@ -24,800 +24,6 @@
 #include "idctdsp_mips.h"
 #include "constants.h"
 
-#define C0 23170 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C1 22725 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C2 21407 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C3 19266 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C4 16383 //cos(i*M_PI/16)*sqrt(2)*(1<<14) - 0.5
-#define C5 12873 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C6 8867  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C7 4520  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-
-#define ROW_SHIFT 11
-#define COL_SHIFT 20
-
-DECLARE_ALIGNED(8, static const int16_t, coeffs)[]= {
-1<<(ROW_SHIFT-1),   0, 1<<(ROW_SHIFT-1),   0,
-1<<(ROW_SHIFT-1),   1, 1<<(ROW_SHIFT-1),   0,
-  C4,  C4,   C4,  C4,
-  C4, -C4,   C4, -C4,
-  C2,  C6,   C2,  C6,
-  C6, -C2,   C6, -C2,
-  C1,  C3,   C1,  C3,
-  C5,  C7,   C5,  C7,
-  C3, -C7,   C3, -C7,
- -C1, -C5,  -C1, -C5,
-  C5, -C1,   C5, -C1,
-  C7,  C3,   C7,  C3,
-  C7, -C5,   C7, -C5,
-  C3, -C1,   C3, -C1
-};
-
-static void simple_idct_mmi(int16_t *block)
-{
-DECLARE_ALIGNED(8, int64_t, align_tmp)[16];
-int16_t * const temp= (int16_t*)align_tmp;
-
-__asm__ volatile(
-#undef  DC_COND_IDCT
-#define DC_COND_IDCT(src0, src4, src1, src5, dst, rounder, rarg, shift) \
-"ldc1 $f0, " #src0 "\n\t" /* R4 R0  r4  r0 */\
-"ldc1 $f2, " #src4 "\n\t" /* R6 R2  r6  r2 */\
-"ldc1 $f4, " #src1 "\n\t" /* R3 R1  r3  r1 */\
-"ldc1 $f6, " #src5 "\n\t" /* R7 R5  r7  r5 */\
-"ldc1 $f8, %3   \n\t"\
-"and  $f8, $f8, $f0 \n\t"\
-"or $f8, $f8, $f2   \n\t"\
-"or $f8, $f8, $f4   \n\t"\
-"or $f8, $f8, $f6   \n\t"\
-"packsswh $f8, $f8, $f8 \n\t"\
-"li $11, " #shift " \n\t"\
-"mfc1 $10, $f8  \n\t"\
-"mtc1 $11, $f18 \n\t"\
-"beqz $10, 1f   \n\t"\
-"ldc1 $f8, 16(%2)   \n\t" /* C4 C4  C4  C4 */\
-"pmaddhw $f8, $f8, $f0  \n\t" /* C4R4+C4R0  C4r4+C4r0 */\
-"ldc1 $f10, 24(%2)  \n\t" /* -C4C4