[FFmpeg-devel] [PATCH 2/3] x86/vf_blend: make all functions work on x86_32

2015-12-23 Thread James Almer
Signed-off-by: James Almer 
---
 libavfilter/x86/vf_blend.asm| 103 +++-
 libavfilter/x86/vf_blend_init.c |   4 +-
 2 files changed, 52 insertions(+), 55 deletions(-)

diff --git a/libavfilter/x86/vf_blend.asm b/libavfilter/x86/vf_blend.asm
index d079b79..5f0271a 100644
--- a/libavfilter/x86/vf_blend.asm
+++ b/libavfilter/x86/vf_blend.asm
@@ -22,7 +22,6 @@
 
 %include "libavutil/x86/x86util.asm"
 
-%if ARCH_X86_64
 SECTION_RODATA
 
 pw_128: times 8 dw 128
@@ -34,11 +33,19 @@ pb_255: times 16 db 255
 SECTION .text
 
 %macro BLEND_INIT 2
-cglobal blend_%1, 9, 11, %2, top, top_linesize, bottom, bottom_linesize, dst, 
dst_linesize, width, start, end
+%if ARCH_X86_64
+cglobal blend_%1, 6, 9, %2, top, top_linesize, bottom, bottom_linesize, dst, 
dst_linesize, width, end, x
+movwidthd, dword widthm
+%else
+cglobal blend_%1, 5, 7, %2, top, top_linesize, bottom, bottom_linesize, dst, 
end, x
+%define dst_linesizeq r5mp
+%define widthq r6mp
+%endif
+mov  endd, dword r8m
 add  topq, widthq
 add   bottomq, widthq
 add  dstq, widthq
-sub  endq, startq
+sub  endd, dword r7m ; start
 negwidthq
 %endmacro
 
@@ -54,15 +61,14 @@ REP_RET
 %macro BLEND_SIMPLE 2
 BLEND_INIT %1, 2
 .nextrow:
-mov   r10q, widthq
-%define  x  r10q
+movxq, widthq
 
 .loop:
-movum0, [topq + x]
-movum1, [bottomq + x]
+movum0, [topq + xq]
+movum1, [bottomq + xq]
 p%2 m0, m1
-mova[dstq + x], m0
-add   r10q, mmsize
+mova   [dstq + xq], m0
+add xq, mmsize
 jl .loop
 BLEND_END
 %endmacro
@@ -80,38 +86,36 @@ BLEND_INIT difference128, 4
 pxor   m2, m2
 mova   m3, [pw_128]
 .nextrow:
-mov   r10q, widthq
-%define  x  r10q
+movxq, widthq
 
 .loop:
-movhm0, [topq + x]
-movhm1, [bottomq + x]
+movhm0, [topq + xq]
+movhm1, [bottomq + xq]
 punpcklbw   m0, m2
 punpcklbw   m1, m2
 paddw   m0, m3
 psubw   m0, m1
 packuswbm0, m0
-movh[dstq + x], m0
-add   r10q, mmsize / 2
+movh   [dstq + xq], m0
+add xq, mmsize / 2
 jl .loop
 BLEND_END
 
 BLEND_INIT average, 3
 pxor   m2, m2
 .nextrow:
-mov   r10q, widthq
-%define  x  r10q
+movxq, widthq
 
 .loop:
-movhm0, [topq + x]
-movhm1, [bottomq + x]
+movhm0, [topq + xq]
+movhm1, [bottomq + xq]
 punpcklbw   m0, m2
 punpcklbw   m1, m2
 paddw   m0, m1
 psrlw   m0, 1
 packuswbm0, m0
-movh[dstq + x], m0
-add   r10q, mmsize / 2
+movh   [dstq + xq], m0
+add xq, mmsize / 2
 jl .loop
 BLEND_END
 
@@ -119,19 +123,18 @@ BLEND_INIT addition128, 4
 pxor   m2, m2
 mova   m3, [pw_128]
 .nextrow:
-mov   r10q, widthq
-%define  x  r10q
+movxq, widthq
 
 .loop:
-movhm0, [topq + x]
-movhm1, [bottomq + x]
+movhm0, [topq + xq]
+movhm1, [bottomq + xq]
 punpcklbw   m0, m2
 punpcklbw   m1, m2
 paddw   m0, m1
 psubw   m0, m3
 packuswbm0, m0
-movh[dstq + x], m0
-add   r10q, mmsize / 2
+movh   [dstq + xq], m0
+add xq, mmsize / 2
 jl .loop
 BLEND_END
 
@@ -140,38 +143,36 @@ BLEND_INIT hardmix, 5
 mova   m3, [pb_128]
 mova   m4, [pb_127]
 .nextrow:
-mov   r10q, widthq
-%define  x  r10q
+movxq, widthq
 
 .loop:
-movum0, [topq + x]
-movum1, [bottomq + x]
+movum0, [topq + xq]
+movum1, [bottomq + xq]
 pxorm1, m4
 pxorm0, m3
 pcmpgtb m1, m0
 pxorm1, m2
-mova[dstq + x], m1
-add   r10q, mmsize
+mova   [dstq + xq], m1
+add xq, mmsize
 jl .loop
 BLEND_END
 
 BLEND_INIT phoenix, 4
 mova   m3, [pb_255]
 .nextrow:
-mov   r10q, widthq
-%define  x  r10q
+movxq, widthq
 
 .loop:
-movum0, [topq + x]
-movum1, [bottomq + x]
+movum0, [topq + xq]
+movum1, [bottomq + xq]
 movam2, m0
 pminub  m0, m1
 pmaxub  m1, m2
 movam2, m3
 psubusb m2, m1
 paddusb m2, m0

[FFmpeg-devel] [PATCH 3/3] x86/vf_blend: add sse2 versions of blend_difference and blend_negation

2015-12-23 Thread James Almer
Signed-off-by: James Almer 
---
 libavfilter/x86/vf_blend.asm| 12 +---
 libavfilter/x86/vf_blend_init.c |  4 
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/libavfilter/x86/vf_blend.asm b/libavfilter/x86/vf_blend.asm
index 5f0271a..730be77 100644
--- a/libavfilter/x86/vf_blend.asm
+++ b/libavfilter/x86/vf_blend.asm
@@ -176,7 +176,7 @@ BLEND_INIT phoenix, 4
 jl .loop
 BLEND_END
 
-INIT_XMM ssse3
+%macro BLEND_ABS 0
 BLEND_INIT difference, 3
 pxor   m2, m2
 .nextrow:
@@ -188,7 +188,7 @@ BLEND_INIT difference, 3
 punpcklbw   m0, m2
 punpcklbw   m1, m2
 psubw   m0, m1
-pabsw   m0, m0
+ABS1m0, m1
 packuswbm0, m0
 movh   [dstq + xq], m0
 add xq, mmsize / 2
@@ -209,7 +209,7 @@ BLEND_INIT negation, 5
 movam3, m4
 psubw   m3, m0
 psubw   m3, m1
-pabsw   m3, m3
+ABS1m3, m1
 movam0, m4
 psubw   m0, m3
 packuswbm0, m0
@@ -217,3 +217,9 @@ BLEND_INIT negation, 5
 add xq, mmsize / 2
 jl .loop
 BLEND_END
+%endmacro
+
+INIT_XMM sse2
+BLEND_ABS
+INIT_XMM ssse3
+BLEND_ABS
diff --git a/libavfilter/x86/vf_blend_init.c b/libavfilter/x86/vf_blend_init.c
index b7d234f..dc29547 100644
--- a/libavfilter/x86/vf_blend_init.c
+++ b/libavfilter/x86/vf_blend_init.c
@@ -42,7 +42,9 @@ BLEND_FUNC(or, sse2)
 BLEND_FUNC(phoenix, sse2)
 BLEND_FUNC(subtract, sse2)
 BLEND_FUNC(xor, sse2)
+BLEND_FUNC(difference, sse2)
 BLEND_FUNC(difference, ssse3)
+BLEND_FUNC(negation, sse2)
 BLEND_FUNC(negation, ssse3)
 
 av_cold void ff_blend_init_x86(FilterParams *param, int is_16bit)
@@ -63,6 +65,8 @@ av_cold void ff_blend_init_x86(FilterParams *param, int 
is_16bit)
 case BLEND_PHOENIX:  param->blend = ff_blend_phoenix_sse2;  break;
 case BLEND_SUBTRACT: param->blend = ff_blend_subtract_sse2; break;
 case BLEND_XOR:  param->blend = ff_blend_xor_sse2;  break;
+case BLEND_DIFFERENCE: param->blend = ff_blend_difference_sse2; break;
+case BLEND_NEGATION:   param->blend = ff_blend_negation_sse2;   break;
 }
 }
 if (EXTERNAL_SSSE3(cpu_flags) && param->opacity == 1 && !is_16bit) {
-- 
2.6.3

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


[FFmpeg-devel] [PATCH 1/3] x86/vf_blend: simplify using macros

2015-12-23 Thread James Almer
Signed-off-by: James Almer 
---
 libavfilter/x86/vf_blend.asm| 276 +---
 libavfilter/x86/vf_blend_init.c | 102 +++
 2 files changed, 53 insertions(+), 325 deletions(-)

diff --git a/libavfilter/x86/vf_blend.asm b/libavfilter/x86/vf_blend.asm
index f0fb2ea..d079b79 100644
--- a/libavfilter/x86/vf_blend.asm
+++ b/libavfilter/x86/vf_blend.asm
@@ -33,113 +33,26 @@ pb_255: times 16 db 255
 
 SECTION .text
 
-INIT_XMM sse2
-cglobal blend_xor, 9, 11, 2, 0, top, top_linesize, bottom, bottom_linesize, 
dst, dst_linesize, width, start, end
-add  topq, widthq
-add   bottomq, widthq
-add  dstq, widthq
-sub  endq, startq
-negwidthq
-.nextrow:
-mov   r10q, widthq
-%define  x  r10q
-
-.loop:
-movum0, [topq + x]
-movum1, [bottomq + x]
-pxorm0, m1
-mova[dstq + x], m0
-add   r10q, mmsize
-jl .loop
-
-add  topq, top_linesizeq
-add   bottomq, bottom_linesizeq
-add  dstq, dst_linesizeq
-sub  endd, 1
-jg .nextrow
-REP_RET
-
-cglobal blend_or, 9, 11, 2, 0, top, top_linesize, bottom, bottom_linesize, 
dst, dst_linesize, width, start, end
-add  topq, widthq
-add   bottomq, widthq
-add  dstq, widthq
-sub  endq, startq
-negwidthq
-.nextrow:
-mov   r10q, widthq
-%define  x  r10q
-
-.loop:
-movum0, [topq + x]
-movum1, [bottomq + x]
-por m0, m1
-mova[dstq + x], m0
-add   r10q, mmsize
-jl .loop
-
-add  topq, top_linesizeq
-add   bottomq, bottom_linesizeq
-add  dstq, dst_linesizeq
-sub  endd, 1
-jg .nextrow
-REP_RET
-
-cglobal blend_and, 9, 11, 2, 0, top, top_linesize, bottom, bottom_linesize, 
dst, dst_linesize, width, start, end
-add  topq, widthq
-add   bottomq, widthq
-add  dstq, widthq
-sub  endq, startq
-negwidthq
-.nextrow:
-mov   r10q, widthq
-%define  x  r10q
-
-.loop:
-movum0, [topq + x]
-movum1, [bottomq + x]
-pandm0, m1
-mova[dstq + x], m0
-add   r10q, mmsize
-jl .loop
-
-add  topq, top_linesizeq
-add   bottomq, bottom_linesizeq
-add  dstq, dst_linesizeq
-sub  endd, 1
-jg .nextrow
-REP_RET
-
-cglobal blend_addition, 9, 11, 2, 0, top, top_linesize, bottom, 
bottom_linesize, dst, dst_linesize, width, start, end
+%macro BLEND_INIT 2
+cglobal blend_%1, 9, 11, %2, top, top_linesize, bottom, bottom_linesize, dst, 
dst_linesize, width, start, end
 add  topq, widthq
 add   bottomq, widthq
 add  dstq, widthq
 sub  endq, startq
 negwidthq
-.nextrow:
-mov   r10q, widthq
-%define  x  r10q
-
-.loop:
-movum0, [topq + x]
-movum1, [bottomq + x]
-paddusb m0, m1
-mova[dstq + x], m0
-add   r10q, mmsize
-jl .loop
+%endmacro
 
+%macro BLEND_END 0
 add  topq, top_linesizeq
 add   bottomq, bottom_linesizeq
 add  dstq, dst_linesizeq
 sub  endd, 1
 jg .nextrow
 REP_RET
+%endmacro
 
-cglobal blend_subtract, 9, 11, 2, 0, top, top_linesize, bottom, 
bottom_linesize, dst, dst_linesize, width, start, end
-add  topq, widthq
-add   bottomq, widthq
-add  dstq, widthq
-sub  endq, startq
-negwidthq
+%macro BLEND_SIMPLE 2
+BLEND_INIT %1, 2
 .nextrow:
 mov   r10q, widthq
 %define  x  r10q
@@ -147,26 +60,25 @@ cglobal blend_subtract, 9, 11, 2, 0, top, top_linesize, 
bottom, bottom_linesize,
 .loop:
 movum0, [topq + x]
 movum1, [bottomq + x]
-psubusb m0, m1
+p%2 m0, m1
 mova[dstq + x], m0
 add   r10q, mmsize
 jl .loop
+BLEND_END
+%endmacro
 
-add  topq, top_linesizeq
-add   bottomq, bottom_linesizeq
-add  dstq, dst_linesizeq
-sub  endd, 1
-jg .nextrow
-REP_RET
-
-cglobal blend_difference128, 9, 11, 4, 0, top, top_linesize, bottom, 
bottom_linesize, dst, dst_linesize, width, start, end
-add  topq, widthq
-add   bottomq, widthq
-add  dstq, widthq
-sub  endq, startq
+INIT_XMM sse2
+BLEND_SIMPLE xor,  xor
+BLEND_SIMPLE or,   or
+BLEND_SIMPLE and,  and
+BLEND_SIMPLE addition, addusb
+BLEND_SIMPLE subtract, subusb
+BLEND_SIMPLE darken,   minub
+BLEND_SIMPLE lighten,  maxub
+
+BLEND_INIT difference128, 4
 pxor   m2, m2
 mova   m3, [pw_128]
-negwidthq
 .nextrow:
 mov   r10q, widthq
 %define  x  r10q
@@ -182,21 +94,10 @@ cglobal blend_difference128, 9, 11, 4, 0, top, 
to

Re: [FFmpeg-devel] [PATCH] lavu: add pthread asserts if ASSERT_LEVEL>1

2015-12-23 Thread Ganesh Ajjanagadde
On Wed, Dec 23, 2015 at 7:59 PM, Ganesh Ajjanagadde  wrote:
> On Tue, Dec 22, 2015 at 12:05 PM, Clément Bœsch  wrote:
>> ---
>>  libavutil/thread.h | 96 
>> ++
>>  1 file changed, 96 insertions(+)
>>
>> diff --git a/libavutil/thread.h b/libavutil/thread.h
>> index 3d15737..0bb745e 100644
>> --- a/libavutil/thread.h
>> +++ b/libavutil/thread.h
>> @@ -30,6 +30,102 @@
>>
>>  #if HAVE_PTHREADS
>>  #include 
>> +
>> +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0
>> +
>> +#include "log.h"
>> +
>> +#define ASSERT_PTHREAD_NORET(func, ...) do {\
>> +int ret = func(__VA_ARGS__);\
>> +if (ret) {  \
>> +av_log(NULL, AV_LOG_FATAL, AV_STRINGIFY(func)   \
>> +   " failed with error: %s\n", av_err2str(AVERROR(ret)));   \
>> +abort();\
>> +}   \
>> +} while (0)
>> +
>> +#define ASSERT_PTHREAD(func, ...) do {  \
>> +ASSERT_PTHREAD_NORET(func, __VA_ARGS__);\
>> +return 0;   \
>> +} while (0)
>> +
>> +static inline int strict_pthread_join(pthread_t thread, void **value_ptr)
>> +{
>> +ASSERT_PTHREAD(pthread_join, thread, value_ptr);
>> +}
>> +
>> +static inline int strict_pthread_mutex_init(pthread_mutex_t *mutex, const 
>> pthread_mutexattr_t *attr)
>> +{
>> +if (attr) {
>> +ASSERT_PTHREAD_NORET(pthread_mutex_init, mutex, attr);
>> +} else {
>> +pthread_mutexattr_t local_attr;
>> +ASSERT_PTHREAD_NORET(pthread_mutexattr_init, &local_attr);
>> +ASSERT_PTHREAD_NORET(pthread_mutexattr_settype, &local_attr, 
>> PTHREAD_MUTEX_ERRORCHECK);
>> +ASSERT_PTHREAD_NORET(pthread_mutex_init, mutex, &local_attr);
>> +ASSERT_PTHREAD_NORET(pthread_mutexattr_destroy, &local_attr);
>> +}
>> +return 0;
>> +}
>> +
>> +static inline int strict_pthread_mutex_destroy(pthread_mutex_t *mutex)
>> +{
>> +ASSERT_PTHREAD(pthread_mutex_destroy, mutex);
>> +}
>> +
>> +static inline int strict_pthread_mutex_lock(pthread_mutex_t *mutex)
>> +{
>> +ASSERT_PTHREAD(pthread_mutex_lock, mutex);
>> +}
>> +
>> +static inline int strict_pthread_mutex_unlock(pthread_mutex_t *mutex)
>> +{
>> +ASSERT_PTHREAD(pthread_mutex_unlock, mutex);
>> +}
>> +
>> +static inline int strict_pthread_cond_init(pthread_cond_t *cond, const 
>> pthread_condattr_t *attr)
>> +{
>> +ASSERT_PTHREAD(pthread_cond_init, cond, attr);
>> +}
>> +
>> +static inline int strict_pthread_cond_destroy(pthread_cond_t *cond)
>> +{
>> +ASSERT_PTHREAD(pthread_cond_destroy, cond);
>> +}
>> +
>> +static inline int strict_pthread_cond_signal(pthread_cond_t *cond)
>> +{
>> +ASSERT_PTHREAD(pthread_cond_signal, cond);
>> +}
>> +
>> +static inline int strict_pthread_cond_broadcast(pthread_cond_t *cond)
>> +{
>> +ASSERT_PTHREAD(pthread_cond_broadcast, cond);
>> +}
>> +
>> +static inline int strict_pthread_cond_wait(pthread_cond_t *cond, 
>> pthread_mutex_t *mutex)
>> +{
>> +ASSERT_PTHREAD(pthread_cond_wait, cond, mutex);
>> +}
>> +
>> +static inline int strict_pthread_once(pthread_once_t *once_control, void 
>> (*init_routine)(void))
>> +{
>> +ASSERT_PTHREAD(pthread_once, once_control, init_routine);
>> +}
>> +
>> +#define pthread_join   strict_pthread_join
>> +#define pthread_mutex_init strict_pthread_mutex_init
>> +#define pthread_mutex_destroy  strict_pthread_mutex_destroy
>> +#define pthread_mutex_lock strict_pthread_mutex_lock
>> +#define pthread_mutex_unlock   strict_pthread_mutex_unlock
>> +#define pthread_cond_init  strict_pthread_cond_init
>> +#define pthread_cond_destroy   strict_pthread_cond_destroy
>> +#define pthread_cond_signalstrict_pthread_cond_signal
>> +#define pthread_cond_broadcast strict_pthread_cond_broadcast
>> +#define pthread_cond_wait  strict_pthread_cond_wait
>> +#define pthread_once   strict_pthread_once
>> +#endif
>
> I like the idea here, and it is superior to some thoughts I had on
> addressing this. There is a question whether aborting is the right
> thing to do here though. Technically, I guess in some instances a
> client can do something meaningful if these functions fail, and
> aborting may be too drastic. However, this approach has a good
> advantage of simplicity, and is reasonable in my view.
>
> One thing I don't like are the macros. Are you sure they are unavoidable?

Please ignore the comment regarding the macros: I thought over it, and
I am pretty sure they can't be avoided.

>
>> +
>>  #elif HAVE_OS2THREADS
>>  #include "compat/os2threads.h"
>>  #else
>> --
>> 2.6.4
>>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.

Re: [FFmpeg-devel] [PATCH] lavu: add pthread asserts if ASSERT_LEVEL>1

2015-12-23 Thread Ganesh Ajjanagadde
On Tue, Dec 22, 2015 at 12:05 PM, Clément Bœsch  wrote:
> ---
>  libavutil/thread.h | 96 
> ++
>  1 file changed, 96 insertions(+)
>
> diff --git a/libavutil/thread.h b/libavutil/thread.h
> index 3d15737..0bb745e 100644
> --- a/libavutil/thread.h
> +++ b/libavutil/thread.h
> @@ -30,6 +30,102 @@
>
>  #if HAVE_PTHREADS
>  #include 
> +
> +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0
> +
> +#include "log.h"
> +
> +#define ASSERT_PTHREAD_NORET(func, ...) do {\
> +int ret = func(__VA_ARGS__);\
> +if (ret) {  \
> +av_log(NULL, AV_LOG_FATAL, AV_STRINGIFY(func)   \
> +   " failed with error: %s\n", av_err2str(AVERROR(ret)));   \
> +abort();\
> +}   \
> +} while (0)
> +
> +#define ASSERT_PTHREAD(func, ...) do {  \
> +ASSERT_PTHREAD_NORET(func, __VA_ARGS__);\
> +return 0;   \
> +} while (0)
> +
> +static inline int strict_pthread_join(pthread_t thread, void **value_ptr)
> +{
> +ASSERT_PTHREAD(pthread_join, thread, value_ptr);
> +}
> +
> +static inline int strict_pthread_mutex_init(pthread_mutex_t *mutex, const 
> pthread_mutexattr_t *attr)
> +{
> +if (attr) {
> +ASSERT_PTHREAD_NORET(pthread_mutex_init, mutex, attr);
> +} else {
> +pthread_mutexattr_t local_attr;
> +ASSERT_PTHREAD_NORET(pthread_mutexattr_init, &local_attr);
> +ASSERT_PTHREAD_NORET(pthread_mutexattr_settype, &local_attr, 
> PTHREAD_MUTEX_ERRORCHECK);
> +ASSERT_PTHREAD_NORET(pthread_mutex_init, mutex, &local_attr);
> +ASSERT_PTHREAD_NORET(pthread_mutexattr_destroy, &local_attr);
> +}
> +return 0;
> +}
> +
> +static inline int strict_pthread_mutex_destroy(pthread_mutex_t *mutex)
> +{
> +ASSERT_PTHREAD(pthread_mutex_destroy, mutex);
> +}
> +
> +static inline int strict_pthread_mutex_lock(pthread_mutex_t *mutex)
> +{
> +ASSERT_PTHREAD(pthread_mutex_lock, mutex);
> +}
> +
> +static inline int strict_pthread_mutex_unlock(pthread_mutex_t *mutex)
> +{
> +ASSERT_PTHREAD(pthread_mutex_unlock, mutex);
> +}
> +
> +static inline int strict_pthread_cond_init(pthread_cond_t *cond, const 
> pthread_condattr_t *attr)
> +{
> +ASSERT_PTHREAD(pthread_cond_init, cond, attr);
> +}
> +
> +static inline int strict_pthread_cond_destroy(pthread_cond_t *cond)
> +{
> +ASSERT_PTHREAD(pthread_cond_destroy, cond);
> +}
> +
> +static inline int strict_pthread_cond_signal(pthread_cond_t *cond)
> +{
> +ASSERT_PTHREAD(pthread_cond_signal, cond);
> +}
> +
> +static inline int strict_pthread_cond_broadcast(pthread_cond_t *cond)
> +{
> +ASSERT_PTHREAD(pthread_cond_broadcast, cond);
> +}
> +
> +static inline int strict_pthread_cond_wait(pthread_cond_t *cond, 
> pthread_mutex_t *mutex)
> +{
> +ASSERT_PTHREAD(pthread_cond_wait, cond, mutex);
> +}
> +
> +static inline int strict_pthread_once(pthread_once_t *once_control, void 
> (*init_routine)(void))
> +{
> +ASSERT_PTHREAD(pthread_once, once_control, init_routine);
> +}
> +
> +#define pthread_join   strict_pthread_join
> +#define pthread_mutex_init strict_pthread_mutex_init
> +#define pthread_mutex_destroy  strict_pthread_mutex_destroy
> +#define pthread_mutex_lock strict_pthread_mutex_lock
> +#define pthread_mutex_unlock   strict_pthread_mutex_unlock
> +#define pthread_cond_init  strict_pthread_cond_init
> +#define pthread_cond_destroy   strict_pthread_cond_destroy
> +#define pthread_cond_signalstrict_pthread_cond_signal
> +#define pthread_cond_broadcast strict_pthread_cond_broadcast
> +#define pthread_cond_wait  strict_pthread_cond_wait
> +#define pthread_once   strict_pthread_once
> +#endif

I like the idea here, and it is superior to some thoughts I had on
addressing this. There is a question whether aborting is the right
thing to do here though. Technically, I guess in some instances a
client can do something meaningful if these functions fail, and
aborting may be too drastic. However, this approach has a good
advantage of simplicity, and is reasonable in my view.

One thing I don't like are the macros. Are you sure they are unavoidable?

> +
>  #elif HAVE_OS2THREADS
>  #include "compat/os2threads.h"
>  #else
> --
> 2.6.4
>
> ___
> 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] fate: replace custom md5 tests with those from RFC 1321

2015-12-23 Thread James Almer
On 11/3/2015 2:18 PM, James Almer wrote:
> On 11/3/2015 4:44 AM, Clément Bœsch wrote:
>> On Tue, Nov 03, 2015 at 04:09:43AM -0300, James Almer wrote:
>>> Signed-off-by: James Almer 
>>> ---
>>>  libavutil/md5.c| 23 ++-
>>>  tests/ref/fate/md5 | 12 +++-
>>>  2 files changed, 17 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/libavutil/md5.c b/libavutil/md5.c
>>> index 876bd55..2a77304 100644
>>> --- a/libavutil/md5.c
>>> +++ b/libavutil/md5.c
>>> @@ -217,19 +217,16 @@ static void print_md5(uint8_t *md5)
>>>  
>>>  int main(void){
>>>  uint8_t md5val[16];
>>> -int i;
>>> -volatile uint8_t in[1000]; // volatile to workaround 
>>> http://llvm.org/bugs/show_bug.cgi?id=20849
>>> -// FIXME remove volatile once it has been fixed and all fate clients 
>>> are updated
>>> -
>>> -for (i = 0; i < 1000; i++)
>>> -in[i] = i * i;
>>> -av_md5_sum(md5val, in, 1000); print_md5(md5val);
>>> -av_md5_sum(md5val, in,   63); print_md5(md5val);
>>> -av_md5_sum(md5val, in,   64); print_md5(md5val);
>>> -av_md5_sum(md5val, in,   65); print_md5(md5val);
>>> -for (i = 0; i < 1000; i++)
>>> -in[i] = i % 127;
>>> -av_md5_sum(md5val, in,  999); print_md5(md5val);
>>> +
>>> +av_md5_sum(md5val, "",0); print_md5(md5val);
>>> +av_md5_sum(md5val, "a",   1); print_md5(md5val);
>>> +av_md5_sum(md5val, "abc", 3); print_md5(md5val);
>>> +av_md5_sum(md5val, "message digest", 14); 
>>> print_md5(md5val);
>>> +av_md5_sum(md5val, "abcdefghijklmnopqrstuvwxyz", 26); 
>>> print_md5(md5val);
>>> +av_md5_sum(md5val, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcde"
>>> +   "fghijklmnopqrstuvwxyz0123456789",  62); 
>>> print_md5(md5val);
>>> +av_md5_sum(md5val, "1234567890123456789012345678901234567890"
>>> +   "1234567890123456789012345678901234567890", 80); 
>>> print_md5(md5val);
>>
>> Is it really OK to only test ASCII?
> 
> I don't see why not. We're doing that for every other hash algorithm as 
> described
> in their respective RFCs for that matter.

Ping.

This is both getting rid of that volatile hack for an old clang version and 
using
the actual test vectors defined in the RFC for md5, so IMO it's indeed ok.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/mpegtsenc: add flag to embed an AC-3/E-AC-3 ES the DVB way

2015-12-23 Thread Michael Niedermayer
On Sun, Dec 13, 2015 at 11:54:32AM +0100, Stefan Pöschel wrote:
> So far an AC-3 elementary stream is refered to in the PMT according to
> System A (ATSC). An E-AC-3 ES in contrast is embedded the System B (DVB) way.
> To fix this inconsistency, this commit changes the default E-AC-3 behaviour to
> use the ATSC way, too. Furthermore a new flag is added to optionally select 
> the
> DVB way (regarding both codecs and possible further differences in the 
> future).
> ---
>  libavformat/mpegts.h|  1 +
>  libavformat/mpegtsenc.c | 20 ++--
>  2 files changed, 19 insertions(+), 2 deletions(-)

patch applied

please also send one to update the docs

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] swr/resample: use av_clip_int16 instead of av_clip

2015-12-23 Thread Michael Niedermayer
On Wed, Dec 23, 2015 at 02:50:33PM -0800, Ganesh Ajjanagadde wrote:
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libswresample/resample.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

LGTM

thx

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

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


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


Re: [FFmpeg-devel] [PATCH 00/15] replace pow(10, x) by exp10(x) across FFmpeg

2015-12-23 Thread Ganesh Ajjanagadde
On Wed, Dec 23, 2015 at 4:39 PM, Michael Niedermayer
 wrote:
> On Wed, Dec 23, 2015 at 03:52:50PM -0800, Ganesh Ajjanagadde wrote:
>> On Wed, Dec 23, 2015 at 3:38 PM, Michael Niedermayer
>>  wrote:
>> > On Wed, Dec 23, 2015 at 10:47:20AM -0800, Ganesh Ajjanagadde wrote:
>> >> exp10(x) is superior to pow(10,x).
>> >> Note that in some cases, this may affect integers derived from pow calls. 
>> >> When
>> >> spotted, this remark has been added to the relevant commit message.
>> >>
>> >> Note that if such a thing is troublesome, one can do one of two things:
>> >> 1. leave the pow(10,x) call as is in such places.
>> >> 2. replace the lavu/libm fallback by the correct pow(10,x) as opposed to 
>> >> the
>> >> sloppy exp2(M_LOG2_10 * x).
>> >>
>> >> Patches tested with FATE on x86-64, GNU/Linux.
>> >
>> > some of these fail on arm
>> >
>> > i suspect thats because exp10 is only available with GNU_SOURCE
>> > and we dont define that nor do we want to define that
>> > -DGNU_SOURCE often leaks in from pkg_config files though
>>
>> ah, thanks for this. Out of curiousity, why don't we want to always
>> define it? My FFmpeg runs fine, built with GNU_SOURCE.
>
> it would hide any use of GNU features and FFmpeg should work
> on non GNU platforms too.
> Its best if any non standard (c99/posix) features trigger immedeate
> errors for developers instead of having to depend on the roundtrip
> over bug reports to find and remove such uses
>
>
>>
>> > my arm setup doesnt include many external libs so GNU_SOURCE doesnt
>> > get enabled
>>
>> It is only with GNU_SOURCE as per man page; I assumed that was handled
>> via configure and the like and I thought I mentioned this somewhere
>> during the discussion.
>
>
>
>
>>
>> >
>> > i didnt think deeply abot it but would it make sense to always enable
>> > the fallback even if exp10 is available? that is assuming the fallback
>> > is faster everywhere
>>
>> The fallback is faster everywhere. The trouble is I run into linker
>> issues when it is available natively.
>
> ifdef ... undef ...
> #define exp10(x) ...
> might work
> not sure this has other issues or not

Have not checked yet, see below for a different idea.

>
>
>> Better solution may be via an ifdef GNU_SOURCE in addition to HAVE_EXP10.
>> Can you please check if that works?
>
> I dont think a check based on GNU_SOURCE can work entirely reliably
> HAVE_EXP10 is set and the function should be available during link time
> but without GNU_SOURCE it is not available from the headers
> configure doesnt check the headers and the check is likely before it
> is known if GNU_SOURCE is set
> a libc could provide exp10 without GNU_SOURCE and a libc could lack
> exp10 even though GNU_SOURCE is set

Practically speaking, there is no libc (or more precisely libm)
providing exp10 apart from GNU.

What I meant was the following (I casually labelled it as ifdef, I
meant some preprocessor stuff):
#if !HAVE_EXP10 || !(defined(_GNU_SOURCE))
...
#endif

I have reproduced your issues via a minimal configure line, and the
above idea fixes those. Do you see any issues? Of course, there is the
theoretical one of a libc (more precisely libm) having exp10 without
GNU_SOURCE, but in that case it should just use the fallback.

>
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Everything should be made as simple as possible, but not simpler.
> -- Albert Einstein
>
> ___
> 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 00/15] replace pow(10, x) by exp10(x) across FFmpeg

2015-12-23 Thread Michael Niedermayer
On Wed, Dec 23, 2015 at 03:52:50PM -0800, Ganesh Ajjanagadde wrote:
> On Wed, Dec 23, 2015 at 3:38 PM, Michael Niedermayer
>  wrote:
> > On Wed, Dec 23, 2015 at 10:47:20AM -0800, Ganesh Ajjanagadde wrote:
> >> exp10(x) is superior to pow(10,x).
> >> Note that in some cases, this may affect integers derived from pow calls. 
> >> When
> >> spotted, this remark has been added to the relevant commit message.
> >>
> >> Note that if such a thing is troublesome, one can do one of two things:
> >> 1. leave the pow(10,x) call as is in such places.
> >> 2. replace the lavu/libm fallback by the correct pow(10,x) as opposed to 
> >> the
> >> sloppy exp2(M_LOG2_10 * x).
> >>
> >> Patches tested with FATE on x86-64, GNU/Linux.
> >
> > some of these fail on arm
> >
> > i suspect thats because exp10 is only available with GNU_SOURCE
> > and we dont define that nor do we want to define that
> > -DGNU_SOURCE often leaks in from pkg_config files though
> 
> ah, thanks for this. Out of curiousity, why don't we want to always
> define it? My FFmpeg runs fine, built with GNU_SOURCE.

it would hide any use of GNU features and FFmpeg should work
on non GNU platforms too.
Its best if any non standard (c99/posix) features trigger immedeate
errors for developers instead of having to depend on the roundtrip
over bug reports to find and remove such uses


> 
> > my arm setup doesnt include many external libs so GNU_SOURCE doesnt
> > get enabled
> 
> It is only with GNU_SOURCE as per man page; I assumed that was handled
> via configure and the like and I thought I mentioned this somewhere
> during the discussion.




> 
> >
> > i didnt think deeply abot it but would it make sense to always enable
> > the fallback even if exp10 is available? that is assuming the fallback
> > is faster everywhere
> 
> The fallback is faster everywhere. The trouble is I run into linker
> issues when it is available natively.

ifdef ... undef ...
#define exp10(x) ...
might work
not sure this has other issues or not


> Better solution may be via an ifdef GNU_SOURCE in addition to HAVE_EXP10.
> Can you please check if that works?

I dont think a check based on GNU_SOURCE can work entirely reliably
HAVE_EXP10 is set and the function should be available during link time
but without GNU_SOURCE it is not available from the headers
configure doesnt check the headers and the check is likely before it
is known if GNU_SOURCE is set
a libc could provide exp10 without GNU_SOURCE and a libc could lack
exp10 even though GNU_SOURCE is set


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

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein


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


Re: [FFmpeg-devel] [PATCH 00/15] replace pow(10, x) by exp10(x) across FFmpeg

2015-12-23 Thread Ganesh Ajjanagadde
On Wed, Dec 23, 2015 at 3:38 PM, Michael Niedermayer
 wrote:
> On Wed, Dec 23, 2015 at 10:47:20AM -0800, Ganesh Ajjanagadde wrote:
>> exp10(x) is superior to pow(10,x).
>> Note that in some cases, this may affect integers derived from pow calls. 
>> When
>> spotted, this remark has been added to the relevant commit message.
>>
>> Note that if such a thing is troublesome, one can do one of two things:
>> 1. leave the pow(10,x) call as is in such places.
>> 2. replace the lavu/libm fallback by the correct pow(10,x) as opposed to the
>> sloppy exp2(M_LOG2_10 * x).
>>
>> Patches tested with FATE on x86-64, GNU/Linux.
>
> some of these fail on arm
>
> i suspect thats because exp10 is only available with GNU_SOURCE
> and we dont define that nor do we want to define that
> -DGNU_SOURCE often leaks in from pkg_config files though

ah, thanks for this. Out of curiousity, why don't we want to always
define it? My FFmpeg runs fine, built with GNU_SOURCE.

> my arm setup doesnt include many external libs so GNU_SOURCE doesnt
> get enabled

It is only with GNU_SOURCE as per man page; I assumed that was handled
via configure and the like and I thought I mentioned this somewhere
during the discussion.

>
> i didnt think deeply abot it but would it make sense to always enable
> the fallback even if exp10 is available? that is assuming the fallback
> is faster everywhere

The fallback is faster everywhere. The trouble is I run into linker
issues when it is available natively.
Better solution may be via an ifdef GNU_SOURCE in addition to HAVE_EXP10.
Can you please check if that works?

>
>
>
> ffmpeg/libavfilter/af_volume.c: In function ‘filter_frame’:
> ffmpeg/libavfilter/af_volume.c:379:13: error: implicit declaration of 
> function ‘exp10’
> ffmpeg/libavfilter/af_compand.c: In function ‘config_output’:
> ffmpeg/libavfilter/af_compand.c:509:9: error: implicit declaration of 
> function ‘exp10’
> CC  libavcodec/cngdec.o
> make: *** [libavfilter/af_compand.o] Error 1
> make: *** [libavfilter/af_volume.o] Error 1
> CC  libavcodec/dcaenc.o
> ffmpeg/libavfilter/f_ebur128.c: In function ‘get_histogram’:
> ffmpeg/libavfilter/f_ebur128.c:451:9: error: implicit declaration of function 
> ‘exp10’
> make: *** [libavfilter/f_ebur128.o] Error 1
> CC  libavcodec/imc.o
> ffmpeg/libavfilter/vsrc_testsrc.c: In function ‘test_fill_picture’:
> ffmpeg/libavfilter/vsrc_testsrc.c:618:23: error: implicit declaration of 
> function ‘exp10’
> make: *** [libavfilter/vsrc_testsrc.o] Error 1
> CC  libavcodec/on2avc.o
> CC  libavcodec/opus.o
> ffmpeg/libavcodec/acelp_pitch_delay.c: In function ‘ff_amr_set_fixed_gain’:
> ffmpeg/libavcodec/acelp_pitch_delay.c:135:9: error: implicit declaration of 
> function ‘exp10f’
> CC  libavcodec/wmadec.o
> make: CClibavcodec/wmaenc.o
> *** [libavcodec/acelp_pitch_delay.o] Error 1
> CC  libavcodec/wmaprodec.o
> CC  libavutil/eval.o
> ffmpeg/libavcodec/aacpsy.c: In function ‘psy_3gpp_init’:
> ffmpeg/libavcodec/aacpsy.c:352:13: error: implicit declaration of function 
> ‘exp10’
> make: *** [libavcodec/aacpsy.o] Error 1
> ffmpeg/libavcodec/cngdec.c: In function ‘cng_decode_frame’:
> ffmpeg/libavcodec/cngdec.c:116:9: error: implicit declaration of function 
> ‘exp10’
> make: *** [libavcodec/cngdec.o] Error 1
> ffmpeg/libavcodec/dcaenc.c: In function ‘encode_init’:
> ffmpeg/libavcodec/dcaenc.c:183:13: error: implicit declaration of function 
> ‘exp10’
> make: *** [libavcodec/dcaenc.o] Error 1
> ffmpeg/libavcodec/opus.c: In function ‘ff_opus_parse_extradata’:
> ffmpeg/libavcodec/opus.c:337:9: error: implicit declaration of function 
> ‘exp10’
> make: *** [libavcodec/opus.o] Error 1
> ffmpeg/libavcodec/imc.c: In function ‘iac_generate_tabs’:
> ffmpeg/libavcodec/imc.c:140:13: error: implicit declaration of function 
> ‘exp10’
> make: *** [libavcodec/imc.o] Error 1
> ffmpeg/libavcodec/wmadec.c: In function ‘wma_decode_block’:
> ffmpeg/libavcodec/wmadec.c:630:13: error: implicit declaration of function 
> ‘exp10’
> make: *** [libavcodec/wmadec.o] Error 1
> ffmpeg/libavcodec/on2avc.c: In function ‘on2avc_decode_init’:
> ffmpeg/libavcodec/on2avc.c:938:9: error: implicit declaration of function 
> ‘exp10’
> make: *** [libavcodec/on2avc.o] Error 1
> ffmpeg/libavcodec/wmaenc.c: In function ‘init_exp’:
> ffmpeg/libavcodec/wmaenc.c:136:9: error: implicit declaration of function 
> ‘exp10’
> make: *** [libavcodec/wmaenc.o] Error 1
> ffmpeg/libavutil/eval.c: In function ‘av_strtod’:
> ffmpeg/libavutil/eval.c:109:13: error: implicit declaration of function 
> ‘exp10’
> make: *** [libavutil/eval.o] Error 1
> ffmpeg/libavcodec/wmaprodec.c: In function ‘decode_subframe’:
> ffmpeg/libavcodec/wmaprodec.c:1354:17: error: implicit declaration of 
> function ‘exp10’
> make: *** [libavcodec/wmaprodec.o] Error 1
> make: Target `all' not remade because of errors.
>
>
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> He who knows, does not speak. He who speaks, doe

[FFmpeg-devel] [PATCH] x86/vf_maskedmerge: make ff_maskedmerge8_sse2 work on x86_32

2015-12-23 Thread James Almer
Signed-off-by: James Almer 
---
 libavfilter/x86/vf_maskedmerge.asm| 29 ++---
 libavfilter/x86/vf_maskedmerge_init.c |  2 +-
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/libavfilter/x86/vf_maskedmerge.asm 
b/libavfilter/x86/vf_maskedmerge.asm
index 1970b0c..7e61935 100644
--- a/libavfilter/x86/vf_maskedmerge.asm
+++ b/libavfilter/x86/vf_maskedmerge.asm
@@ -22,7 +22,6 @@
 
 %include "libavutil/x86/x86util.asm"
 
-%if ARCH_X86_64
 SECTION_RODATA
 
 pw_128: times 8 dw 128
@@ -31,24 +30,33 @@ pw_256: times 8 dw 256
 SECTION .text
 
 INIT_XMM sse2
-cglobal maskedmerge8, 10, 11, 7, 0, bsrc, osrc, msrc, dst, blinesize, 
olinesize, mlinesize, dlinesize, w, h
+%if ARCH_X86_64
+cglobal maskedmerge8, 8, 11, 7, bsrc, osrc, msrc, dst, blinesize, olinesize, 
mlinesize, dlinesize, w, h, x
+mov wd, dword wm
+mov hd, dword hm
+%else
+cglobal maskedmerge8, 5, 7, 7, bsrc, osrc, msrc, dst, blinesize, w, x
+mov wd, r8m
+%define olinesizeq r5mp
+%define mlinesizeq r6mp
+%define dlinesizeq r7mp
+%define hd r9mp
+%endif
 movam4, [pw_256]
 movam5, [pw_128]
 pxorm6, m6
-movsxdifnidn wq, wd
 add  bsrcq, wq
 add  osrcq, wq
 add  msrcq, wq
 add   dstq, wq
 neg wq
-%define  x  r10q
 .nextrow:
-mov  x, wq
+mov xq, wq
 
 .loop:
-movhm0, [bsrcq + x]
-movhm1, [osrcq + x]
-movhm3, [msrcq + x]
+movhm0, [bsrcq + xq]
+movhm1, [osrcq + xq]
+movhm3, [msrcq + xq]
 movam2, m4
 punpcklbw   m0, m6
 punpcklbw   m1, m6
@@ -60,8 +68,8 @@ cglobal maskedmerge8, 10, 11, 7, 0, bsrc, osrc, msrc, dst, 
blinesize, olinesize,
 paddw   m1, m5
 psrlw   m1, 8
 packuswbm1, m1
-movh[dstq + x], m1
-add   r10q, mmsize / 2
+movh   [dstq + xq], m1
+add xq, mmsize / 2
 jl .loop
 
 add bsrcq, blinesizeq
@@ -71,4 +79,3 @@ cglobal maskedmerge8, 10, 11, 7, 0, bsrc, osrc, msrc, dst, 
blinesize, olinesize,
 sub hd, 1
 jg .nextrow
 REP_RET
-%endif
diff --git a/libavfilter/x86/vf_maskedmerge_init.c 
b/libavfilter/x86/vf_maskedmerge_init.c
index 4435700..73ab888 100644
--- a/libavfilter/x86/vf_maskedmerge_init.c
+++ b/libavfilter/x86/vf_maskedmerge_init.c
@@ -34,7 +34,7 @@ av_cold void ff_maskedmerge_init_x86(MaskedMergeContext *s)
 {
 int cpu_flags = av_get_cpu_flags();
 
-if (ARCH_X86_64 && EXTERNAL_SSE2(cpu_flags) && s->depth == 8) {
+if (EXTERNAL_SSE2(cpu_flags) && s->depth == 8) {
 s->maskedmerge = ff_maskedmerge8_sse2;
 }
 }
-- 
2.6.3

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


Re: [FFmpeg-devel] [PATCH 00/15] replace pow(10, x) by exp10(x) across FFmpeg

2015-12-23 Thread Michael Niedermayer
On Wed, Dec 23, 2015 at 10:47:20AM -0800, Ganesh Ajjanagadde wrote:
> exp10(x) is superior to pow(10,x).
> Note that in some cases, this may affect integers derived from pow calls. When
> spotted, this remark has been added to the relevant commit message.
> 
> Note that if such a thing is troublesome, one can do one of two things:
> 1. leave the pow(10,x) call as is in such places.
> 2. replace the lavu/libm fallback by the correct pow(10,x) as opposed to the
> sloppy exp2(M_LOG2_10 * x).
> 
> Patches tested with FATE on x86-64, GNU/Linux.

some of these fail on arm

i suspect thats because exp10 is only available with GNU_SOURCE
and we dont define that nor do we want to define that
-DGNU_SOURCE often leaks in from pkg_config files though
my arm setup doesnt include many external libs so GNU_SOURCE doesnt
get enabled

i didnt think deeply abot it but would it make sense to always enable
the fallback even if exp10 is available? that is assuming the fallback
is faster everywhere



ffmpeg/libavfilter/af_volume.c: In function ‘filter_frame’:
ffmpeg/libavfilter/af_volume.c:379:13: error: implicit declaration of function 
‘exp10’
ffmpeg/libavfilter/af_compand.c: In function ‘config_output’:
ffmpeg/libavfilter/af_compand.c:509:9: error: implicit declaration of function 
‘exp10’
CC  libavcodec/cngdec.o
make: *** [libavfilter/af_compand.o] Error 1
make: *** [libavfilter/af_volume.o] Error 1
CC  libavcodec/dcaenc.o
ffmpeg/libavfilter/f_ebur128.c: In function ‘get_histogram’:
ffmpeg/libavfilter/f_ebur128.c:451:9: error: implicit declaration of function 
‘exp10’
make: *** [libavfilter/f_ebur128.o] Error 1
CC  libavcodec/imc.o
ffmpeg/libavfilter/vsrc_testsrc.c: In function ‘test_fill_picture’:
ffmpeg/libavfilter/vsrc_testsrc.c:618:23: error: implicit declaration of 
function ‘exp10’
make: *** [libavfilter/vsrc_testsrc.o] Error 1
CC  libavcodec/on2avc.o
CC  libavcodec/opus.o
ffmpeg/libavcodec/acelp_pitch_delay.c: In function ‘ff_amr_set_fixed_gain’:
ffmpeg/libavcodec/acelp_pitch_delay.c:135:9: error: implicit declaration of 
function ‘exp10f’
CC  libavcodec/wmadec.o
make: CClibavcodec/wmaenc.o
*** [libavcodec/acelp_pitch_delay.o] Error 1
CC  libavcodec/wmaprodec.o
CC  libavutil/eval.o
ffmpeg/libavcodec/aacpsy.c: In function ‘psy_3gpp_init’:
ffmpeg/libavcodec/aacpsy.c:352:13: error: implicit declaration of function 
‘exp10’
make: *** [libavcodec/aacpsy.o] Error 1
ffmpeg/libavcodec/cngdec.c: In function ‘cng_decode_frame’:
ffmpeg/libavcodec/cngdec.c:116:9: error: implicit declaration of function 
‘exp10’
make: *** [libavcodec/cngdec.o] Error 1
ffmpeg/libavcodec/dcaenc.c: In function ‘encode_init’:
ffmpeg/libavcodec/dcaenc.c:183:13: error: implicit declaration of function 
‘exp10’
make: *** [libavcodec/dcaenc.o] Error 1
ffmpeg/libavcodec/opus.c: In function ‘ff_opus_parse_extradata’:
ffmpeg/libavcodec/opus.c:337:9: error: implicit declaration of function ‘exp10’
make: *** [libavcodec/opus.o] Error 1
ffmpeg/libavcodec/imc.c: In function ‘iac_generate_tabs’:
ffmpeg/libavcodec/imc.c:140:13: error: implicit declaration of function ‘exp10’
make: *** [libavcodec/imc.o] Error 1
ffmpeg/libavcodec/wmadec.c: In function ‘wma_decode_block’:
ffmpeg/libavcodec/wmadec.c:630:13: error: implicit declaration of function 
‘exp10’
make: *** [libavcodec/wmadec.o] Error 1
ffmpeg/libavcodec/on2avc.c: In function ‘on2avc_decode_init’:
ffmpeg/libavcodec/on2avc.c:938:9: error: implicit declaration of function 
‘exp10’
make: *** [libavcodec/on2avc.o] Error 1
ffmpeg/libavcodec/wmaenc.c: In function ‘init_exp’:
ffmpeg/libavcodec/wmaenc.c:136:9: error: implicit declaration of function 
‘exp10’
make: *** [libavcodec/wmaenc.o] Error 1
ffmpeg/libavutil/eval.c: In function ‘av_strtod’:
ffmpeg/libavutil/eval.c:109:13: error: implicit declaration of function ‘exp10’
make: *** [libavutil/eval.o] Error 1
ffmpeg/libavcodec/wmaprodec.c: In function ‘decode_subframe’:
ffmpeg/libavcodec/wmaprodec.c:1354:17: error: implicit declaration of function 
‘exp10’
make: *** [libavcodec/wmaprodec.o] Error 1
make: Target `all' not remade because of errors.



[...]
-- 
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] Changelog: add note on dynaudnorm availability on all platforms

2015-12-23 Thread Hendrik Leppkes
Am 23.12.2015 19:47 schrieb "Ganesh Ajjanagadde" :
>
> On Wed, Dec 23, 2015 at 10:02 AM, Hendrik Leppkes 
wrote:
> > Am 23.12.2015 18:30 schrieb "Ganesh Ajjanagadde" :
> >>
> >> Commits 062e3e23824ba3d25594ea966d7834bcf34db49b and
> >> dd68cde28a44bbf5307d29ee6cb8ebd14985dea5 added support for erf and
> >> copysign on broken libms, and so dynaudnorm is now available on all
> >> platforms.
> >>
> >> This is user facing; hence the Changelog entry.
> >>
> >> Signed-off-by: Ganesh Ajjanagadde 
> >> ---
> >>  Changelog | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/Changelog b/Changelog
> >> index 2b46ddb..bb29afb 100644
> >> --- a/Changelog
> >> +++ b/Changelog
> >> @@ -47,6 +47,7 @@ version :
> >>  - DXVA2-accelerated VP9 decoding
> >>  - SOFAlizer: virtual binaural acoustics filter
> >>  - VAAPI VP9 hwaccel
> >> +- dynaudnorm filter availability on all platforms
> >>
> >>
> >>  version 2.8:
> >> --
> >> 2.6.4
> >>
> >
> > dynaudnorm hasnt been in any previous release, has it? IIRC its still
very
> > new itself, so no need for a change log entry IMHO.
>
> As Paul points out, it was added in 2.8. It was for this precise
> reason that I wondered about the Changelog. So is the summary that the
> patch is ok (or neutral)? In other words, does anyone oppose it?
>

Personally I wouldn't care that much to mention it in the change log, but
its not like I would oppose it, so if Paul as the author of the filter
feels its fine, then LGTM as well.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] swr/resample: use av_clip_int16 instead of av_clip

2015-12-23 Thread Ganesh Ajjanagadde
Signed-off-by: Ganesh Ajjanagadde 
---
 libswresample/resample.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libswresample/resample.c b/libswresample/resample.c
index 6c83eef..7e3bda5 100644
--- a/libswresample/resample.c
+++ b/libswresample/resample.c
@@ -200,7 +200,7 @@ static int build_filter(ResampleContext *c, void *filter, 
double factor, int tap
 switch(c->format){
 case AV_SAMPLE_FMT_S16P:
 for(i=0;ihttp://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 12/15] lavc/opus: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
On Wed, Dec 23, 2015 at 12:40 PM, Rostislav Pehlivanov
 wrote:
> On Wed, 2015-12-23 at 10:47 -0800, Ganesh Ajjanagadde wrote:
>> exp10, introduced recently, is superior for the purpose.
>>
>> Signed-off-by: Ganesh Ajjanagadde 
>> ---
>>  libavcodec/opus.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/opus.c b/libavcodec/opus.c
>> index 6b3d3c3..cac9f85 100644
>> --- a/libavcodec/opus.c
>> +++ b/libavcodec/opus.c
>> @@ -27,6 +27,7 @@
>>  #include 
>>
>>  #include "libavutil/error.h"
>> +#include "libavutil/libm.h"
>>
>>  #include "opus.h"
>>  #include "vorbis.h"
>> @@ -333,7 +334,7 @@ av_cold int
>> ff_opus_parse_extradata(AVCodecContext *avctx,
>>
>>  s->gain_i = AV_RL16(extradata + 16);
>>  if (s->gain_i)
>> -s->gain = pow(10, s->gain_i / (20.0 * 256));
>> +s->gain = exp10(s->gain_i / (20.0 * 256));
>>
>>  map_type = extradata[18];
>>  if (!map_type) {
>
> Seems trivial, LGTM

Thanks for the review.

Just a cautionary message: sometimes the most trivial looking change
can have unforeseen consequences. For instance, in this case, there
are a few things:
1. Header avutil/libm must be included, and is easily missed since on
GNU/Linux, it will compile fine with/without it.
2. On non GNU/Linux, there are slight accuracy differences before/after.

Basically, just suggesting some things to keep an eye for while reviewing.

>
> Thanks
> ___
> 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 12/15] lavc/opus: replace pow(10, x) by exp10(x)

2015-12-23 Thread Rostislav Pehlivanov
On Wed, 2015-12-23 at 10:47 -0800, Ganesh Ajjanagadde wrote:
> exp10, introduced recently, is superior for the purpose.
> 
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavcodec/opus.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/opus.c b/libavcodec/opus.c
> index 6b3d3c3..cac9f85 100644
> --- a/libavcodec/opus.c
> +++ b/libavcodec/opus.c
> @@ -27,6 +27,7 @@
>  #include 
>  
>  #include "libavutil/error.h"
> +#include "libavutil/libm.h"
>  
>  #include "opus.h"
>  #include "vorbis.h"
> @@ -333,7 +334,7 @@ av_cold int
> ff_opus_parse_extradata(AVCodecContext *avctx,
>  
>  s->gain_i = AV_RL16(extradata + 16);
>  if (s->gain_i)
> -s->gain = pow(10, s->gain_i / (20.0 * 256));
> +s->gain = exp10(s->gain_i / (20.0 * 256));
>  
>  map_type = extradata[18];
>  if (!map_type) {

Seems trivial, LGTM

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


Re: [FFmpeg-devel] [PATCH 06/15] lavc/aacpsy: replace pow(10, x) by exp10(x)

2015-12-23 Thread Rostislav Pehlivanov
On Wed, 2015-12-23 at 10:47 -0800, Ganesh Ajjanagadde wrote:
> exp10, recently introduced, is superior for the purpose.
> 
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavcodec/aacpsy.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
> index 71eeb3e..163ee43 100644
> --- a/libavcodec/aacpsy.c
> +++ b/libavcodec/aacpsy.c
> @@ -349,10 +349,10 @@ static av_cold int psy_3gpp_init(FFPsyContext
> *ctx) {
>  for (g = 0; g < ctx->num_bands[j] - 1; g++) {
>  AacPsyCoeffs *coeff = &coeffs[g];
>  float bark_width = coeffs[g+1].barks - coeffs->barks;
> -coeff->spread_low[0] = pow(10.0, -bark_width *
> PSY_3GPP_THR_SPREAD_LOW);
> -coeff->spread_hi [0] = pow(10.0, -bark_width *
> PSY_3GPP_THR_SPREAD_HI);
> -coeff->spread_low[1] = pow(10.0, -bark_width *
> en_spread_low);
> -coeff->spread_hi [1] = pow(10.0, -bark_width *
> en_spread_hi);
> +coeff->spread_low[0] = exp10(-bark_width *
> PSY_3GPP_THR_SPREAD_LOW);
> +coeff->spread_hi [0] = exp10(-bark_width *
> PSY_3GPP_THR_SPREAD_HI);
> +coeff->spread_low[1] = exp10(-bark_width *
> en_spread_low);
> +coeff->spread_hi [1] = exp10(-bark_width *
> en_spread_hi);
>  pe_min = bark_pe * bark_width;
>  minsnr = exp2(pe_min / band_sizes[g]) - 1.5f;
>  coeff->min_snr = av_clipf(1.0f / minsnr, PSY_SNR_25DB,
> PSY_SNR_1DB);


LGTM

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


[FFmpeg-devel] [PATCH] lavc/acelp_pitch_delay: replace exp2f(M_LOG2_10 *x) by exp10f(x)

2015-12-23 Thread Ganesh Ajjanagadde
Suggested-by: Ronald S. Bultje 
Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/acelp_pitch_delay.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/acelp_pitch_delay.c b/libavcodec/acelp_pitch_delay.c
index 3ecec01..95272d9 100644
--- a/libavcodec/acelp_pitch_delay.c
+++ b/libavcodec/acelp_pitch_delay.c
@@ -132,7 +132,7 @@ float ff_amr_set_fixed_gain(float fixed_gain_factor, float 
fixed_mean_energy,
 // ^g_c = ^gamma_gc * 100.05 (predicted dB + mean dB - dB of fixed vector)
 // Note 10^(0.05 * -10log(average x2)) = 1/sqrt((average x2)).
 float val = fixed_gain_factor *
-exp2f(M_LOG2_10 * 0.05 *
+exp10f(0.05 *
   (avpriv_scalarproduct_float_c(pred_table, prediction_error, 4) +
energy_mean)) /
 sqrtf(fixed_mean_energy);
-- 
2.6.4

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


Re: [FFmpeg-devel] [PATCH 01/15] lavu/eval: replace pow(10, x) by exp10

2015-12-23 Thread Ganesh Ajjanagadde
On Wed, Dec 23, 2015 at 11:05 AM, Ronald S. Bultje  wrote:
> Hi,
>
> On Wed, Dec 23, 2015 at 1:47 PM, Ganesh Ajjanagadde 
> wrote:
>>
>> exp10, recently introduced, is superior for the purpose.
>
>
> Code change itself is fine. But I find this extra line in the commit message
> somewhat redundant. :)

Indeed, I was getting tired of adding it myself. Removed from all
patches, thanks.

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


Re: [FFmpeg-devel] [PATCH v5] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Mats Peterson

On 12/23/2015 07:44 PM, Lou Logan wrote:

On Wed, Dec 23, 2015, at 03:05 AM, Mats Peterson wrote:

OK Clement, I have changed some of the stuff you complained about.


Those were not complaints, but a comments from a review.

Here's a real complaint: I find it increasingly hard to follow your
stream-of-consciousness style of replies. You tend to send a message and
then soon reply to your own messages. Perhaps you can wait a short
while, re-read your message (something I wish I've done many times), and
gather your thoughts for a moment before sending. It will possibly make
things easier for us, and will reduce the number of messages on this
already high-volume mailing list.

Sorry for the noise.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



Alright then, COMMENTS. I don't agree with all of them, though. But I've 
changed most of what he mentioned.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 03/15] lavfi/f_ebur128: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
On Wed, Dec 23, 2015 at 11:08 AM, Ronald S. Bultje  wrote:
> Hi,
>
> On Wed, Dec 23, 2015 at 2:00 PM, Ganesh Ajjanagadde 
> wrote:
>
>> On Wed, Dec 23, 2015 at 10:54 AM, Clément Bœsch  wrote:
>> > On Wed, Dec 23, 2015 at 10:47:23AM -0800, Ganesh Ajjanagadde wrote:
>> >> exp10, recently introduced, is superior for the purpose.
>> >>
>> >> Signed-off-by: Ganesh Ajjanagadde 
>> >> ---
>> >>  libavfilter/f_ebur128.c | 2 +-
>> >>  1 file changed, 1 insertion(+), 1 deletion(-)
>> >>
>> >> diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
>> >> index b9577c5..6749bcd 100644
>> >> --- a/libavfilter/f_ebur128.c
>> >> +++ b/libavfilter/f_ebur128.c
>> >> @@ -435,7 +435,7 @@ static int config_audio_output(AVFilterLink
>> *outlink)
>> >>  return 0;
>> >>  }
>> >>
>> >> -#define ENERGY(loudness) (pow(10, ((loudness) + 0.691) / 10.))
>> >> +#define ENERGY(loudness) (exp10(((loudness) + 0.691) / 10.))
>> >>  #define LOUDNESS(energy) (-0.691 + 10 * log10(energy))
>> >>  #define DBFS(energy) (20 * log10(energy))
>> >
>> > OK if FATE is happy
>>
>> FATE is happy on GNU/Linux, where exp10 is correctly rounded. Can't
>> speak for the fallback; it was a risk that I explained in detail. Now
>> that I see its use, I am myself leaning towards a pow(10,x) fallback
>> instead of the exp2 based one.
>
>
> That's because your refactoring origin is biased. If you had started from
> libavcodec/acelp_pitch_delay.c:135 (the only place I could find where we
> use exp2 but where we should use exp10), you'd say the opposite.

ha ha, my bias comes from my pickiness about numerical issues.

>
> (I think the current fallback is fine.)

Ok.

>
> Ronald
> ___
> 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 03/15] lavfi/f_ebur128: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ronald S. Bultje
Hi,

On Wed, Dec 23, 2015 at 2:00 PM, Ganesh Ajjanagadde 
wrote:

> On Wed, Dec 23, 2015 at 10:54 AM, Clément Bœsch  wrote:
> > On Wed, Dec 23, 2015 at 10:47:23AM -0800, Ganesh Ajjanagadde wrote:
> >> exp10, recently introduced, is superior for the purpose.
> >>
> >> Signed-off-by: Ganesh Ajjanagadde 
> >> ---
> >>  libavfilter/f_ebur128.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
> >> index b9577c5..6749bcd 100644
> >> --- a/libavfilter/f_ebur128.c
> >> +++ b/libavfilter/f_ebur128.c
> >> @@ -435,7 +435,7 @@ static int config_audio_output(AVFilterLink
> *outlink)
> >>  return 0;
> >>  }
> >>
> >> -#define ENERGY(loudness) (pow(10, ((loudness) + 0.691) / 10.))
> >> +#define ENERGY(loudness) (exp10(((loudness) + 0.691) / 10.))
> >>  #define LOUDNESS(energy) (-0.691 + 10 * log10(energy))
> >>  #define DBFS(energy) (20 * log10(energy))
> >
> > OK if FATE is happy
>
> FATE is happy on GNU/Linux, where exp10 is correctly rounded. Can't
> speak for the fallback; it was a risk that I explained in detail. Now
> that I see its use, I am myself leaning towards a pow(10,x) fallback
> instead of the exp2 based one.


That's because your refactoring origin is biased. If you had started from
libavcodec/acelp_pitch_delay.c:135 (the only place I could find where we
use exp2 but where we should use exp10), you'd say the opposite.

(I think the current fallback is fine.)

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


Re: [FFmpeg-devel] [PATCH 01/15] lavu/eval: replace pow(10, x) by exp10

2015-12-23 Thread Ronald S. Bultje
Hi,

On Wed, Dec 23, 2015 at 1:47 PM, Ganesh Ajjanagadde 
wrote:

> exp10, recently introduced, is superior for the purpose.


Code change itself is fine. But I find this extra line in the commit
message somewhat redundant. :)

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


Re: [FFmpeg-devel] [PATCH 03/15] lavfi/f_ebur128: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
On Wed, Dec 23, 2015 at 10:54 AM, Clément Bœsch  wrote:
> On Wed, Dec 23, 2015 at 10:47:23AM -0800, Ganesh Ajjanagadde wrote:
>> exp10, recently introduced, is superior for the purpose.
>>
>> Signed-off-by: Ganesh Ajjanagadde 
>> ---
>>  libavfilter/f_ebur128.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
>> index b9577c5..6749bcd 100644
>> --- a/libavfilter/f_ebur128.c
>> +++ b/libavfilter/f_ebur128.c
>> @@ -435,7 +435,7 @@ static int config_audio_output(AVFilterLink *outlink)
>>  return 0;
>>  }
>>
>> -#define ENERGY(loudness) (pow(10, ((loudness) + 0.691) / 10.))
>> +#define ENERGY(loudness) (exp10(((loudness) + 0.691) / 10.))
>>  #define LOUDNESS(energy) (-0.691 + 10 * log10(energy))
>>  #define DBFS(energy) (20 * log10(energy))
>
> OK if FATE is happy

FATE is happy on GNU/Linux, where exp10 is correctly rounded. Can't
speak for the fallback; it was a risk that I explained in detail. Now
that I see its use, I am myself leaning towards a pow(10,x) fallback
instead of the exp2 based one.

>
> --
> Clément B.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 05/15] lavfi/af_compand: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
exp10, recently introduced, is superior for the purpose.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavfilter/af_compand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/af_compand.c b/libavfilter/af_compand.c
index 68b1fae..9c18da6 100644
--- a/libavfilter/af_compand.c
+++ b/libavfilter/af_compand.c
@@ -506,7 +506,7 @@ static int config_output(AVFilterLink *outlink)
 cp->decay = 1.0 - exp(-1.0 / (sample_rate * cp->decay));
 else
 cp->decay = 1.0;
-cp->volume = pow(10.0, s->initial_volume / 20);
+cp->volume = exp10(s->initial_volume / 20);
 }
 
 s->delay_samples = s->delay * sample_rate;
-- 
2.6.4

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


Re: [FFmpeg-devel] [PATCH 03/15] lavfi/f_ebur128: replace pow(10, x) by exp10(x)

2015-12-23 Thread Clément Bœsch
On Wed, Dec 23, 2015 at 10:47:23AM -0800, Ganesh Ajjanagadde wrote:
> exp10, recently introduced, is superior for the purpose.
> 
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavfilter/f_ebur128.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
> index b9577c5..6749bcd 100644
> --- a/libavfilter/f_ebur128.c
> +++ b/libavfilter/f_ebur128.c
> @@ -435,7 +435,7 @@ static int config_audio_output(AVFilterLink *outlink)
>  return 0;
>  }
>  
> -#define ENERGY(loudness) (pow(10, ((loudness) + 0.691) / 10.))
> +#define ENERGY(loudness) (exp10(((loudness) + 0.691) / 10.))
>  #define LOUDNESS(energy) (-0.691 + 10 * log10(energy))
>  #define DBFS(energy) (20 * log10(energy))

OK if FATE is happy

-- 
Clément B.


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


[FFmpeg-devel] [PATCH 12/15] lavc/opus: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
exp10, introduced recently, is superior for the purpose.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/opus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/opus.c b/libavcodec/opus.c
index 6b3d3c3..cac9f85 100644
--- a/libavcodec/opus.c
+++ b/libavcodec/opus.c
@@ -27,6 +27,7 @@
 #include 
 
 #include "libavutil/error.h"
+#include "libavutil/libm.h"
 
 #include "opus.h"
 #include "vorbis.h"
@@ -333,7 +334,7 @@ av_cold int ff_opus_parse_extradata(AVCodecContext *avctx,
 
 s->gain_i = AV_RL16(extradata + 16);
 if (s->gain_i)
-s->gain = pow(10, s->gain_i / (20.0 * 256));
+s->gain = exp10(s->gain_i / (20.0 * 256));
 
 map_type = extradata[18];
 if (!map_type) {
-- 
2.6.4

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


[FFmpeg-devel] [PATCH 15/15] lavc/wmaprodec: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
exp10, introduced recently, is superior for the purpose.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/wmaprodec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index f8f901c..cbda9e9 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -91,6 +91,7 @@
 #include "libavutil/float_dsp.h"
 #include "libavutil/intfloat.h"
 #include "libavutil/intreadwrite.h"
+#include "libavutil/libm.h"
 #include "avcodec.h"
 #include "internal.h"
 #include "get_bits.h"
@@ -1350,7 +1351,7 @@ static int decode_subframe(WMAProDecodeCtx *s)
 const int exp = s->channel[c].quant_step -
 (s->channel[c].max_scale_factor - *sf++) *
 s->channel[c].scale_factor_step;
-const float quant = pow(10.0, exp / 20.0);
+const float quant = exp10(exp / 20.0);
 int start = s->cur_sfb_offsets[b];
 s->fdsp->vector_fmul_scalar(s->tmp + start,
s->channel[c].coeffs + start,
-- 
2.6.4

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


[FFmpeg-devel] [PATCH 14/15] lavc/wmaenc: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
exp10, introduced recently, is superior for the purpose.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/wmaenc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index faf0cb5..c2d2236 100644
--- a/libavcodec/wmaenc.c
+++ b/libavcodec/wmaenc.c
@@ -20,6 +20,7 @@
  */
 
 #include "libavutil/attributes.h"
+#include "libavutil/libm.h"
 
 #include "avcodec.h"
 #include "internal.h"
@@ -132,7 +133,7 @@ static void init_exp(WMACodecContext *s, int ch, const int 
*exp_param)
 max_scale = 0;
 while (q < q_end) {
 /* XXX: use a table */
-v = pow(10, *exp_param++ *(1.0 / 16.0));
+v = exp10(*exp_param++ *(1.0 / 16.0));
 max_scale = FFMAX(max_scale, v);
 n = *ptr++;
 do {
@@ -227,7 +228,7 @@ static int encode_block(WMACodecContext *s, float 
(*src_coefs)[BLOCK_MAX_SIZE],
 
 coefs1= s->coefs1[ch];
 exponents = s->exponents[ch];
-mult  = pow(10, total_gain * 0.05) / s->max_exponent[ch];
+mult  = exp10(total_gain * 0.05) / s->max_exponent[ch];
 mult *= mdct_norm;
 coefs = src_coefs[ch];
 if (s->use_noise_coding && 0) {
-- 
2.6.4

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


[FFmpeg-devel] [PATCH 13/15] lavc/wmadec: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
exp10, introduced recently, is superior for the purpose.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/wmadec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
index e814007..b48cac7 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -34,6 +34,7 @@
  */
 
 #include "libavutil/attributes.h"
+#include "libavutil/libm.h"
 
 #include "avcodec.h"
 #include "internal.h"
@@ -626,7 +627,7 @@ static int wma_decode_block(WMACodecContext *s)
 coefs1= s->coefs1[ch];
 exponents = s->exponents[ch];
 esize = s->exponents_bsize[ch];
-mult  = pow(10, total_gain * 0.05) / s->max_exponent[ch];
+mult  = exp10(total_gain * 0.05) / s->max_exponent[ch];
 mult *= mdct_norm;
 coefs = s->coefs[ch];
 if (s->use_noise_coding) {
@@ -674,7 +675,7 @@ static int wma_decode_block(WMACodecContext *s)
 /* use noise with specified power */
 mult1 = sqrt(exp_power[j] / exp_power[last_high_band]);
 /* XXX: use a table */
-mult1  = mult1 * pow(10, s->high_band_values[ch][j] * 
0.05);
+mult1  = mult1 * exp10(s->high_band_values[ch][j] * 
0.05);
 mult1  = mult1 / (s->max_exponent[ch] * s->noise_mult);
 mult1 *= mdct_norm;
 for (i = 0; i < n; i++) {
-- 
2.6.4

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


[FFmpeg-devel] [PATCH 09/15] lavc/imc: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
exp10, introduced recently, is superior for the purpose.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/imc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index 14f9fa3..2335ae1e 100644
--- a/libavcodec/imc.c
+++ b/libavcodec/imc.c
@@ -137,8 +137,8 @@ static av_cold void iac_generate_tabs(IMCContext *q, int 
sampling_rate)
 
 if (i > 0) {
 tb = bark - prev_bark;
-q->weights1[i - 1] = pow(10.0, -1.0 * tb);
-q->weights2[i - 1] = pow(10.0, -2.7 * tb);
+q->weights1[i - 1] = exp10(-1.0 * tb);
+q->weights2[i - 1] = exp10(-2.7 * tb);
 }
 prev_bark = bark;
 
-- 
2.6.4

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


[FFmpeg-devel] [PATCH 10/15] lavc/libopusdec: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
exp10, introduced recently, is superior for the purpose.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/libopusdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libopusdec.c b/libavcodec/libopusdec.c
index 4cbd14a..4c663fe 100644
--- a/libavcodec/libopusdec.c
+++ b/libavcodec/libopusdec.c
@@ -24,6 +24,7 @@
 
 #include "libavutil/avassert.h"
 #include "libavutil/intreadwrite.h"
+#include "libavutil/libm.h"
 #include "avcodec.h"
 #include "internal.h"
 #include "vorbis.h"
@@ -100,7 +101,7 @@ static av_cold int libopus_decode_init(AVCodecContext *avc)
opus_strerror(ret));
 #else
 {
-double gain_lin = pow(10, gain_db / (20.0 * 256));
+double gain_lin = exp10(gain_db / (20.0 * 256));
 if (avc->sample_fmt == AV_SAMPLE_FMT_FLT)
 opus->gain.d = gain_lin;
 else
-- 
2.6.4

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


[FFmpeg-devel] [PATCH 08/15] lavc/dcaenc: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
exp10, recently introduced, is superior for the purpose.

We may want to change the exp10 fallback to pow(10,) based; value may
change slightly here.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/dcaenc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
index 6fcfb1a..cb880bd 100644
--- a/libavcodec/dcaenc.c
+++ b/libavcodec/dcaenc.c
@@ -24,6 +24,7 @@
 #include "libavutil/avassert.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/common.h"
+#include "libavutil/libm.h"
 #include "avcodec.h"
 #include "dca.h"
 #include "dcadata.h"
@@ -179,7 +180,7 @@ static int encode_init(AVCodecContext *avctx)
 cos_table[2048-i] = cos_table[i];
 }
 for (i = 0; i < 2048; i++) {
-cb_to_level[i] = (int32_t)(0x7fff * pow(10, -0.005 * i));
+cb_to_level[i] = (int32_t)(0x7fff * exp10(-0.005 * i));
 }
 
 for (k = 0; k < 32; k++) {
@@ -205,7 +206,7 @@ static int encode_init(AVCodecContext *avctx)
 }
 
 for (i = 0; i < 256; i++) {
-double add = 1 + pow(10, -0.01 * i);
+double add = 1 + exp10(-0.01 * i);
 cb_to_add[i] = (int32_t)(100 * log10(add));
 }
 for (j = 0; j < 8; j++) {
-- 
2.6.4

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


[FFmpeg-devel] [PATCH 11/15] lavc/on2avc: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
exp10, introduced recently, is superior for the purpose.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/on2avc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/on2avc.c b/libavcodec/on2avc.c
index 04c8e41..0409b3e 100644
--- a/libavcodec/on2avc.c
+++ b/libavcodec/on2avc.c
@@ -22,6 +22,7 @@
 
 #include "libavutil/channel_layout.h"
 #include "libavutil/float_dsp.h"
+#include "libavutil/libm.h"
 #include "avcodec.h"
 #include "bytestream.h"
 #include "fft.h"
@@ -934,9 +935,9 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
"Stereo mode support is not good, patch is welcome\n");
 
 for (i = 0; i < 20; i++)
-c->scale_tab[i] = ceil(pow(10.0, i * 0.1) * 16) / 32;
+c->scale_tab[i] = ceil(exp10(i * 0.1) * 16) / 32;
 for (; i < 128; i++)
-c->scale_tab[i] = ceil(pow(10.0, i * 0.1) * 0.5);
+c->scale_tab[i] = ceil(exp10(i * 0.1) * 0.5);
 
 if (avctx->sample_rate < 32000 || avctx->channels == 1)
 memcpy(c->long_win, ff_on2avc_window_long_24000,
-- 
2.6.4

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


[FFmpeg-devel] [PATCH 07/15] lavc/cngdec: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
exp10, recently introduced, is superior for the purpose.

We may want to change the exp10 fallback to pow(10,) based; value may
change slightly here.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/cngdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cngdec.c b/libavcodec/cngdec.c
index c0295cd..aed4579 100644
--- a/libavcodec/cngdec.c
+++ b/libavcodec/cngdec.c
@@ -22,6 +22,7 @@
 #include 
 
 #include "libavutil/common.h"
+#include "libavutil/libm.h"
 #include "avcodec.h"
 #include "celp_filters.h"
 #include "internal.h"
@@ -112,7 +113,7 @@ static int cng_decode_frame(AVCodecContext *avctx, void 
*data,
 
 if (avpkt->size) {
 int dbov = -avpkt->data[0];
-p->target_energy = 1081109975 * pow(10, dbov / 10.0) * 0.75;
+p->target_energy = 1081109975 * exp10(dbov / 10.0) * 0.75;
 memset(p->target_refl_coef, 0, p->order * 
sizeof(*p->target_refl_coef));
 for (i = 0; i < FFMIN(avpkt->size - 1, p->order); i++) {
 p->target_refl_coef[i] = (avpkt->data[1 + i] - 127) / 128.0;
-- 
2.6.4

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


[FFmpeg-devel] [PATCH 04/15] lavfi/af_volume: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
exp10, recently introduced, is superior for the purpose.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavfilter/af_volume.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c
index 3ba356a..6c4528a 100644
--- a/libavfilter/af_volume.c
+++ b/libavfilter/af_volume.c
@@ -376,7 +376,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
 av_log(inlink->dst, AV_LOG_VERBOSE,
"Using gain %f dB from replaygain side data.\n", g);
 
-vol->volume   = pow(10, (g + vol->replaygain_preamp) / 20);
+vol->volume   = exp10((g + vol->replaygain_preamp) / 20);
 if (vol->replaygain_noclip)
 vol->volume = FFMIN(vol->volume, 1.0 / p);
 vol->volume_i = (int)(vol->volume * 256 + 0.5);
-- 
2.6.4

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


[FFmpeg-devel] [PATCH 06/15] lavc/aacpsy: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
exp10, recently introduced, is superior for the purpose.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavcodec/aacpsy.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index 71eeb3e..163ee43 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -349,10 +349,10 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
 for (g = 0; g < ctx->num_bands[j] - 1; g++) {
 AacPsyCoeffs *coeff = &coeffs[g];
 float bark_width = coeffs[g+1].barks - coeffs->barks;
-coeff->spread_low[0] = pow(10.0, -bark_width * 
PSY_3GPP_THR_SPREAD_LOW);
-coeff->spread_hi [0] = pow(10.0, -bark_width * 
PSY_3GPP_THR_SPREAD_HI);
-coeff->spread_low[1] = pow(10.0, -bark_width * en_spread_low);
-coeff->spread_hi [1] = pow(10.0, -bark_width * en_spread_hi);
+coeff->spread_low[0] = exp10(-bark_width * 
PSY_3GPP_THR_SPREAD_LOW);
+coeff->spread_hi [0] = exp10(-bark_width * PSY_3GPP_THR_SPREAD_HI);
+coeff->spread_low[1] = exp10(-bark_width * en_spread_low);
+coeff->spread_hi [1] = exp10(-bark_width * en_spread_hi);
 pe_min = bark_pe * bark_width;
 minsnr = exp2(pe_min / band_sizes[g]) - 1.5f;
 coeff->min_snr = av_clipf(1.0f / minsnr, PSY_SNR_25DB, 
PSY_SNR_1DB);
-- 
2.6.4

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


[FFmpeg-devel] [PATCH 02/15] lavfi/vsrc_testsrc: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
exp10, recently introduced, is superior for the purpose.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavfilter/vsrc_testsrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 1fca3e7..0eff642 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -615,7 +615,7 @@ static void test_fill_picture(AVFilterContext *ctx, AVFrame 
*frame)
 if (seg_size >= 1 && height >= 13 * seg_size) {
 int64_t p10decimals = 1;
 double time = av_q2d(test->time_base) * test->nb_frame *
-  pow(10, test->nb_decimals);
+  exp10(test->nb_decimals);
 if (time >= INT_MAX)
 return;
 
-- 
2.6.4

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


[FFmpeg-devel] [PATCH 00/15] replace pow(10, x) by exp10(x) across FFmpeg

2015-12-23 Thread Ganesh Ajjanagadde
exp10(x) is superior to pow(10,x).
Note that in some cases, this may affect integers derived from pow calls. When
spotted, this remark has been added to the relevant commit message.

Note that if such a thing is troublesome, one can do one of two things:
1. leave the pow(10,x) call as is in such places.
2. replace the lavu/libm fallback by the correct pow(10,x) as opposed to the
sloppy exp2(M_LOG2_10 * x).

Patches tested with FATE on x86-64, GNU/Linux.

Ganesh Ajjanagadde (15):
  lavu/eval: replace pow(10,x) by exp10
  lavfi/vsrc_testsrc: replace pow(10,x) by exp10(x)
  lavfi/f_ebur128: replace pow(10,x) by exp10(x)
  lavfi/af_volume: replace pow(10,x) by exp10(x)
  lavfi/af_compand: replace pow(10,x) by exp10(x)
  lavc/aacpsy: replace pow(10,x) by exp10(x)
  lavc/cngdec: replace pow(10,x) by exp10(x)
  lavc/dcaenc: replace pow(10,x) by exp10(x)
  lavc/imc: replace pow(10,x) by exp10(x)
  lavc/libopusdec: replace pow(10,x) by exp10(x)
  lavc/on2avc: replace pow(10,x) by exp10(x)
  lavc/opus: replace pow(10,x) by exp10(x)
  lavc/wmadec: replace pow(10,x) by exp10(x)
  lavc/wmaenc: replace pow(10,x) by exp10(x)
  lavc/wmaprodec: replace pow(10,x) by exp10(x)

 libavcodec/aacpsy.c| 8 
 libavcodec/cngdec.c| 3 ++-
 libavcodec/dcaenc.c| 5 +++--
 libavcodec/imc.c   | 4 ++--
 libavcodec/libopusdec.c| 3 ++-
 libavcodec/on2avc.c| 5 +++--
 libavcodec/opus.c  | 3 ++-
 libavcodec/wmadec.c| 5 +++--
 libavcodec/wmaenc.c| 5 +++--
 libavcodec/wmaprodec.c | 3 ++-
 libavfilter/af_compand.c   | 2 +-
 libavfilter/af_volume.c| 2 +-
 libavfilter/f_ebur128.c| 2 +-
 libavfilter/vsrc_testsrc.c | 2 +-
 libavutil/eval.c   | 2 +-
 15 files changed, 31 insertions(+), 23 deletions(-)

-- 
2.6.4

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


[FFmpeg-devel] [PATCH 01/15] lavu/eval: replace pow(10, x) by exp10

2015-12-23 Thread Ganesh Ajjanagadde
exp10, recently introduced, is superior for the purpose.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavutil/eval.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/eval.c b/libavutil/eval.c
index dcb8c56..936e6e6 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -106,7 +106,7 @@ double av_strtod(const char *numstr, char **tail)
 if (next!=numstr) {
 if (next[0] == 'd' && next[1] == 'B') {
 /* treat dB as decibels instead of decibytes */
-d = pow(10, d / 20);
+d = exp10(d / 20);
 next += 2;
 } else if (*next >= 'E' && *next <= 'z') {
 int e= si_prefixes[*next - 'E'].exp;
-- 
2.6.4

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


[FFmpeg-devel] [PATCH 03/15] lavfi/f_ebur128: replace pow(10, x) by exp10(x)

2015-12-23 Thread Ganesh Ajjanagadde
exp10, recently introduced, is superior for the purpose.

Signed-off-by: Ganesh Ajjanagadde 
---
 libavfilter/f_ebur128.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
index b9577c5..6749bcd 100644
--- a/libavfilter/f_ebur128.c
+++ b/libavfilter/f_ebur128.c
@@ -435,7 +435,7 @@ static int config_audio_output(AVFilterLink *outlink)
 return 0;
 }
 
-#define ENERGY(loudness) (pow(10, ((loudness) + 0.691) / 10.))
+#define ENERGY(loudness) (exp10(((loudness) + 0.691) / 10.))
 #define LOUDNESS(energy) (-0.691 + 10 * log10(energy))
 #define DBFS(energy) (20 * log10(energy))
 
-- 
2.6.4

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


Re: [FFmpeg-devel] [PATCH] Changelog: add note on dynaudnorm availability on all platforms

2015-12-23 Thread Ganesh Ajjanagadde
On Wed, Dec 23, 2015 at 10:02 AM, Hendrik Leppkes  wrote:
> Am 23.12.2015 18:30 schrieb "Ganesh Ajjanagadde" :
>>
>> Commits 062e3e23824ba3d25594ea966d7834bcf34db49b and
>> dd68cde28a44bbf5307d29ee6cb8ebd14985dea5 added support for erf and
>> copysign on broken libms, and so dynaudnorm is now available on all
>> platforms.
>>
>> This is user facing; hence the Changelog entry.
>>
>> Signed-off-by: Ganesh Ajjanagadde 
>> ---
>>  Changelog | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/Changelog b/Changelog
>> index 2b46ddb..bb29afb 100644
>> --- a/Changelog
>> +++ b/Changelog
>> @@ -47,6 +47,7 @@ version :
>>  - DXVA2-accelerated VP9 decoding
>>  - SOFAlizer: virtual binaural acoustics filter
>>  - VAAPI VP9 hwaccel
>> +- dynaudnorm filter availability on all platforms
>>
>>
>>  version 2.8:
>> --
>> 2.6.4
>>
>
> dynaudnorm hasnt been in any previous release, has it? IIRC its still very
> new itself, so no need for a change log entry IMHO.

As Paul points out, it was added in 2.8. It was for this precise
reason that I wondered about the Changelog. So is the summary that the
patch is ok (or neutral)? In other words, does anyone oppose it?

> ___
> 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 v5] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Lou Logan
On Wed, Dec 23, 2015, at 03:05 AM, Mats Peterson wrote:
> OK Clement, I have changed some of the stuff you complained about. 

Those were not complaints, but a comments from a review.

Here's a real complaint: I find it increasingly hard to follow your
stream-of-consciousness style of replies. You tend to send a message and
then soon reply to your own messages. Perhaps you can wait a short
while, re-read your message (something I wish I've done many times), and
gather your thoughts for a moment before sending. It will possibly make
things easier for us, and will reduce the number of messages on this
already high-volume mailing list.

Sorry for the noise.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add audio parametric multi band equalizer filter

2015-12-23 Thread Ganesh Ajjanagadde
On Wed, Dec 23, 2015 at 10:05 AM, Paul B Mahol  wrote:
> Signed-off-by: Paul B Mahol 
> ---
>
> I'm happy with feature set so I will apply this soon.
>
> ---
>  configure|   1 +
>  doc/filters.texi |  76 +
>  libavfilter/Makefile |   1 +
>  libavfilter/af_anequalizer.c | 679 
> +++
>  libavfilter/allfilters.c |   1 +
>  5 files changed, 758 insertions(+)
>  create mode 100644 libavfilter/af_anequalizer.c
>
> diff --git a/configure b/configure
> index 54c9789..3d81e87 100755
> --- a/configure
> +++ b/configure
> @@ -2838,6 +2838,7 @@ unix_protocol_select="network"
>  # filters
>  aemphasis_filter_deps="cabs cexp"
>  amovie_filter_deps="avcodec avformat"
> +anequalizer_filter_deps="cabs cexp"
>  aresample_filter_deps="swresample"
>  ass_filter_deps="libass"
>  asyncts_filter_deps="avresample"
> diff --git a/doc/filters.texi b/doc/filters.texi
> index a55cad4..68d7628 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -992,6 +992,82 @@ stream ends. The default value is 2 seconds.
>
>  @end table
>
> +@section anequalizer
> +
> +High-order parametric equalizer with unlimited number of bands for each 
> channel.
> +
> +It accepts the following parameters:
> +@table @option
> +@item params
> +
> +This is option string is in format:
> +"c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
> +Each equalizer band is separated by '|'.
> +
> +@table @option
> +@item chn
> +Set channel number to which equalization will be applied.
> +If input doesn't have that channel the entry is ignored.
> +
> +@item cf
> +Set central frequency for band.
> +If input doesn't have that frequency the entry is ignored.
> +
> +@item w
> +Set band width in hertz.
> +
> +@item g
> +Set band gain in dB.
> +
> +@item f
> +Set filter type for band, optional, can be:
> +
> +@table @samp
> +@item 0
> +Butterworth, this is default.
> +
> +@item 1
> +Chebyshev type 1.
> +
> +@item 2
> +Chebyshev type 2.
> +@end table
> +@end table
> +
> +@item curves
> +With this option activated frequency response of anequalizer is displayed
> +in video stream.
> +
> +@item size
> +Set video stream size. Only useful if curves option is activated.
> +
> +@item mgain
> +Set max gain that will be displayed. Only useful if curves option is 
> activated.
> +Setting this to reasonable value allows to display gain which is derived from
> +neighbour bands which are too close to each other and thus produce higher 
> gain
> +when both are activated.
> +
> +@item fscale
> +Set frequency scale used to draw frequency response in video output.
> +Can be linear or logarithmic. Default is logarithmic.
> +
> +@item colors
> +Set color for each channel curve which is going to be displayed in video 
> stream.
> +This is list of color names separated by space or by '|'.
> +Unrecognised or missing colors will be replaced by white color.
> +@end table
> +
> +@subsection Examples
> +
> +@itemize
> +@item
> +Lower gain by 10 of central frequency 200Hz and width 100 Hz
> +for first 2 channels using Chebyshev type 1 filter:
> +@example
> +anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
> +@end example
> +@end itemize
> +
>  @section anull
>
>  Pass the audio source unchanged to the output.
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index dea012a..adbbc39 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -29,6 +29,7 @@ OBJS-$(CONFIG_ACROSSFADE_FILTER) += af_afade.o
>  OBJS-$(CONFIG_ADELAY_FILTER) += af_adelay.o
>  OBJS-$(CONFIG_AECHO_FILTER)  += af_aecho.o
>  OBJS-$(CONFIG_AEMPHASIS_FILTER)  += af_aemphasis.o
> +OBJS-$(CONFIG_ANEQUALIZER_FILTER)+= af_anequalizer.o
>  OBJS-$(CONFIG_AEVAL_FILTER)  += aeval.o
>  OBJS-$(CONFIG_AFADE_FILTER)  += af_afade.o
>  OBJS-$(CONFIG_AFORMAT_FILTER)+= af_aformat.o
> diff --git a/libavfilter/af_anequalizer.c b/libavfilter/af_anequalizer.c
> new file mode 100644
> index 000..72ce88a
> --- /dev/null
> +++ b/libavfilter/af_anequalizer.c
> @@ -0,0 +1,679 @@
> +/*
> + * Copyright (c) 2001-2010 Krzysztof Foltman, Markus Schmidt, Thor Harald 
> Johansen and others
> + * Copyright (c) 2015 Paul B Mahol
> + *
> + * 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

[FFmpeg-devel] [PATCH] avfilter: add audio parametric multi band equalizer filter

2015-12-23 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---

I'm happy with feature set so I will apply this soon.

---
 configure|   1 +
 doc/filters.texi |  76 +
 libavfilter/Makefile |   1 +
 libavfilter/af_anequalizer.c | 679 +++
 libavfilter/allfilters.c |   1 +
 5 files changed, 758 insertions(+)
 create mode 100644 libavfilter/af_anequalizer.c

diff --git a/configure b/configure
index 54c9789..3d81e87 100755
--- a/configure
+++ b/configure
@@ -2838,6 +2838,7 @@ unix_protocol_select="network"
 # filters
 aemphasis_filter_deps="cabs cexp"
 amovie_filter_deps="avcodec avformat"
+anequalizer_filter_deps="cabs cexp"
 aresample_filter_deps="swresample"
 ass_filter_deps="libass"
 asyncts_filter_deps="avresample"
diff --git a/doc/filters.texi b/doc/filters.texi
index a55cad4..68d7628 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -992,6 +992,82 @@ stream ends. The default value is 2 seconds.
 
 @end table
 
+@section anequalizer
+
+High-order parametric equalizer with unlimited number of bands for each 
channel.
+
+It accepts the following parameters:
+@table @option
+@item params
+
+This is option string is in format:
+"c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
+Each equalizer band is separated by '|'.
+
+@table @option
+@item chn
+Set channel number to which equalization will be applied.
+If input doesn't have that channel the entry is ignored.
+
+@item cf
+Set central frequency for band.
+If input doesn't have that frequency the entry is ignored.
+
+@item w
+Set band width in hertz.
+
+@item g
+Set band gain in dB.
+
+@item f
+Set filter type for band, optional, can be:
+
+@table @samp
+@item 0
+Butterworth, this is default.
+
+@item 1
+Chebyshev type 1.
+
+@item 2
+Chebyshev type 2.
+@end table
+@end table
+
+@item curves
+With this option activated frequency response of anequalizer is displayed
+in video stream.
+
+@item size
+Set video stream size. Only useful if curves option is activated.
+
+@item mgain
+Set max gain that will be displayed. Only useful if curves option is activated.
+Setting this to reasonable value allows to display gain which is derived from
+neighbour bands which are too close to each other and thus produce higher gain
+when both are activated.
+
+@item fscale
+Set frequency scale used to draw frequency response in video output.
+Can be linear or logarithmic. Default is logarithmic.
+
+@item colors
+Set color for each channel curve which is going to be displayed in video 
stream.
+This is list of color names separated by space or by '|'.
+Unrecognised or missing colors will be replaced by white color.
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+Lower gain by 10 of central frequency 200Hz and width 100 Hz
+for first 2 channels using Chebyshev type 1 filter:
+@example
+anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
+@end example
+@end itemize
+
 @section anull
 
 Pass the audio source unchanged to the output.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index dea012a..adbbc39 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -29,6 +29,7 @@ OBJS-$(CONFIG_ACROSSFADE_FILTER) += af_afade.o
 OBJS-$(CONFIG_ADELAY_FILTER) += af_adelay.o
 OBJS-$(CONFIG_AECHO_FILTER)  += af_aecho.o
 OBJS-$(CONFIG_AEMPHASIS_FILTER)  += af_aemphasis.o
+OBJS-$(CONFIG_ANEQUALIZER_FILTER)+= af_anequalizer.o
 OBJS-$(CONFIG_AEVAL_FILTER)  += aeval.o
 OBJS-$(CONFIG_AFADE_FILTER)  += af_afade.o
 OBJS-$(CONFIG_AFORMAT_FILTER)+= af_aformat.o
diff --git a/libavfilter/af_anequalizer.c b/libavfilter/af_anequalizer.c
new file mode 100644
index 000..72ce88a
--- /dev/null
+++ b/libavfilter/af_anequalizer.c
@@ -0,0 +1,679 @@
+/*
+ * Copyright (c) 2001-2010 Krzysztof Foltman, Markus Schmidt, Thor Harald 
Johansen and others
+ * Copyright (c) 2015 Paul B Mahol
+ *
+ * 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 
+
+#include "libavutil/intreadwrite.h"
+#include "libavutil/avstring.h"
+#include "libavutil/opt.h"
+#include "libavutil/parseutils.h"
+#include "avfilter.h"
+#include "internal.h"
+#include "audio.h"
+
+#define FILTER_ORDER 4
+
+enum Fil

Re: [FFmpeg-devel] [PATCH] Changelog: add note on dynaudnorm availability on all platforms

2015-12-23 Thread Paul B Mahol
On 12/23/15, Hendrik Leppkes  wrote:
> Am 23.12.2015 18:30 schrieb "Ganesh Ajjanagadde" :
>>
>> Commits 062e3e23824ba3d25594ea966d7834bcf34db49b and
>> dd68cde28a44bbf5307d29ee6cb8ebd14985dea5 added support for erf and
>> copysign on broken libms, and so dynaudnorm is now available on all
>> platforms.
>>
>> This is user facing; hence the Changelog entry.
>>
>> Signed-off-by: Ganesh Ajjanagadde 
>> ---
>>  Changelog | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/Changelog b/Changelog
>> index 2b46ddb..bb29afb 100644
>> --- a/Changelog
>> +++ b/Changelog
>> @@ -47,6 +47,7 @@ version :
>>  - DXVA2-accelerated VP9 decoding
>>  - SOFAlizer: virtual binaural acoustics filter
>>  - VAAPI VP9 hwaccel
>> +- dynaudnorm filter availability on all platforms
>>
>>
>>  version 2.8:
>> --
>> 2.6.4
>>
>
> dynaudnorm hasnt been in any previous release, has it? IIRC its still very
> new itself, so no need for a change log entry IMHO.

Was in previos release.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Changelog: add note on dynaudnorm availability on all platforms

2015-12-23 Thread Hendrik Leppkes
Am 23.12.2015 18:30 schrieb "Ganesh Ajjanagadde" :
>
> Commits 062e3e23824ba3d25594ea966d7834bcf34db49b and
> dd68cde28a44bbf5307d29ee6cb8ebd14985dea5 added support for erf and
> copysign on broken libms, and so dynaudnorm is now available on all
> platforms.
>
> This is user facing; hence the Changelog entry.
>
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  Changelog | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/Changelog b/Changelog
> index 2b46ddb..bb29afb 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -47,6 +47,7 @@ version :
>  - DXVA2-accelerated VP9 decoding
>  - SOFAlizer: virtual binaural acoustics filter
>  - VAAPI VP9 hwaccel
> +- dynaudnorm filter availability on all platforms
>
>
>  version 2.8:
> --
> 2.6.4
>

dynaudnorm hasnt been in any previous release, has it? IIRC its still very
new itself, so no need for a change log entry IMHO.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] ffprobe: avoid unnecessary pow and exp2 calls

2015-12-23 Thread Ganesh Ajjanagadde
These are just for prefixes and may be hardcoded easily; see lavu/eval
for this approach.

Signed-off-by: Ganesh Ajjanagadde 
---
 ffprobe.c | 27 +++
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/ffprobe.c b/ffprobe.c
index 0b672ff..c352b44 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -218,8 +218,19 @@ static AVInputFormat *iformat = NULL;
 
 static struct AVHashContext *hash;
 
-static const char *const binary_unit_prefixes [] = { "", "Ki", "Mi", "Gi", 
"Ti", "Pi" };
-static const char *const decimal_unit_prefixes[] = { "", "K" , "M" , "G" , "T" 
, "P"  };
+static const struct {
+double bin_val;
+double dec_val;
+const char *bin_str;
+const char *dec_str;
+} si_prefixes[] = {
+{ 1.0, 1.0, "", "" },
+{ 1.024e3, 1e3, "Ki", "K" },
+{ 1.048576e6, 1e6, "Mi", "M" },
+{ 1.073741824e9, 1e9, "Gi", "G" },
+{ 1.099511627776e12, 1e12, "Ti", "T" },
+{ 1.125899906842624e15, 1e15, "Pi", "P" },
+};
 
 static const char unit_second_str[] = "s";
 static const char unit_hertz_str[]  = "Hz"   ;
@@ -273,14 +284,14 @@ static char *value_string(char *buf, int buf_size, struct 
unit_value uv)
 
 if (uv.unit == unit_byte_str && use_byte_value_binary_prefix) {
 index = (long long int) (log2(vald)) / 10;
-index = av_clip(index, 0, FF_ARRAY_ELEMS(binary_unit_prefixes) 
- 1);
-vald /= exp2(index * 10);
-prefix_string = binary_unit_prefixes[index];
+index = av_clip(index, 0, FF_ARRAY_ELEMS(si_prefixes) - 1);
+vald /= si_prefixes[index].bin_val;
+prefix_string = si_prefixes[index].bin_str;
 } else {
 index = (long long int) (log10(vald)) / 3;
-index = av_clip(index, 0, 
FF_ARRAY_ELEMS(decimal_unit_prefixes) - 1);
-vald /= pow(10, index * 3);
-prefix_string = decimal_unit_prefixes[index];
+index = av_clip(index, 0, FF_ARRAY_ELEMS(si_prefixes) - 1);
+vald /= si_prefixes[index].dec_val;
+prefix_string = si_prefixes[index].dec_str;
 }
 vali = vald;
 }
-- 
2.6.4

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


[FFmpeg-devel] [PATCH] Changelog: add note on dynaudnorm availability on all platforms

2015-12-23 Thread Ganesh Ajjanagadde
Commits 062e3e23824ba3d25594ea966d7834bcf34db49b and
dd68cde28a44bbf5307d29ee6cb8ebd14985dea5 added support for erf and
copysign on broken libms, and so dynaudnorm is now available on all
platforms.

This is user facing; hence the Changelog entry.

Signed-off-by: Ganesh Ajjanagadde 
---
 Changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changelog b/Changelog
index 2b46ddb..bb29afb 100644
--- a/Changelog
+++ b/Changelog
@@ -47,6 +47,7 @@ version :
 - DXVA2-accelerated VP9 decoding
 - SOFAlizer: virtual binaural acoustics filter
 - VAAPI VP9 hwaccel
+- dynaudnorm filter availability on all platforms
 
 
 version 2.8:
-- 
2.6.4

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


Re: [FFmpeg-devel] [PATCH] lavfi/af_aemphasis: remove unnecessary complex number usage

2015-12-23 Thread Ganesh Ajjanagadde
On Wed, Dec 23, 2015 at 8:04 AM, Ganesh Ajjanagadde
 wrote:
> On Tue, Dec 22, 2015 at 11:32 PM, Paul B Mahol  wrote:
>> On 12/22/15, Ganesh Ajjanagadde  wrote:
>>> On Tue, Dec 22, 2015 at 2:10 PM, Paul B Mahol  wrote:
 On 12/22/15, Ganesh Ajjanagadde  wrote:
> On Tue, Dec 22, 2015 at 12:46 AM, Paul B Mahol  wrote:
>> On 12/22/15, Ganesh Ajjanagadde  wrote:
>>> complex is not available on all platforms. Furthermore, it is trivial
>>> to
>>> rewrite complex number expressions to real arithmetic, and in fact
>>> sometimes advantageous for performance reasons: by wrapping as a
>>> complex,
>>> one forces a particular Cartesian representation that is not
>>> necessarily
>>> optimal for the purpose.
>>>
>>> Configure tests are also removed, and aemphasis is now available
>>> across
>>> all platforms.
>>>
>>> Signed-off-by: Ganesh Ajjanagadde 
>>> ---
>>>  configure  | 26 --
>>>  libavfilter/af_aemphasis.c | 13 ++---
>>>  2 files changed, 6 insertions(+), 33 deletions(-)
>>>
>>> diff --git a/configure b/configure
>>> index 0227540..46021c4 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -1070,21 +1070,6 @@ int main(void){ $func(); }
>>>  EOF
>>>  }
>>>
>>> -check_complexfunc(){
>>> -log check_complexfunc "$@"
>>> -func=$1
>>> -narg=$2
>>> -shift 2
>>> -test $narg = 2 && args="f, g" || args="f * I"
>>> -disable $func
>>> -check_ld "cc" "$@" <>> -#include 
>>> -#include 
>>> -float foo(complex float f, complex float g) { return $func($args); }
>>> -int main(void){ return (int) foo; }
>>> -EOF
>>> -}
>>> -
>>>  check_mathfunc(){
>>>  log check_mathfunc "$@"
>>>  func=$1
>>> @@ -1803,11 +1788,6 @@ INTRINSICS_LIST="
>>>  intrinsics_neon
>>>  "
>>>
>>> -COMPLEX_FUNCS="
>>> -cabs
>>> -cexp
>>> -"
>>> -
>>>  MATH_FUNCS="
>>>  atanf
>>>  atan2f
>>> @@ -1944,7 +1924,6 @@ HAVE_LIST="
>>>  $ARCH_FEATURES
>>>  $ATOMICS_LIST
>>>  $BUILTIN_LIST
>>> -$COMPLEX_FUNCS
>>>  $HAVE_LIST_CMDLINE
>>>  $HAVE_LIST_PUB
>>>  $HEADERS_LIST
>>> @@ -2835,7 +2814,6 @@ unix_protocol_deps="sys_un_h"
>>>  unix_protocol_select="network"
>>>
>>>  # filters
>>> -aemphasis_filter_deps="cabs cexp"
>>>  amovie_filter_deps="avcodec avformat"
>>>  aresample_filter_deps="swresample"
>>>  ass_filter_deps="libass"
>>> @@ -5379,10 +5357,6 @@ for func in $MATH_FUNCS; do
>>>  eval check_mathfunc $func \${${func}_args:-1}
>>>  done
>>>
>>> -for func in $COMPLEX_FUNCS; do
>>> -eval check_complexfunc $func \${${func}_args:-1}
>>> -done
>>> -
>>>  # these are off by default, so fail if requested and not available
>>>  enabled avfoundation_indev && { check_header_objcc
>>> AVFoundation/AVFoundation.h || disable avfoundation_indev; }
>>>  enabled avfoundation_indev && { check_lib2
>>> CoreGraphics/CoreGraphics.h
>>> CGGetActiveDisplayList -framework CoreGraphics ||
>>> diff --git a/libavfilter/af_aemphasis.c b/libavfilter/af_aemphasis.c
>>> index 2966f77..a5b8e30 100644
>>> --- a/libavfilter/af_aemphasis.c
>>> +++ b/libavfilter/af_aemphasis.c
>>> @@ -18,8 +18,6 @@
>>>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
>>> 02110-1301
>>> USA
>>>   */
>>>
>>> -#include 
>>> -
>>>  #include "libavutil/opt.h"
>>>  #include "avfilter.h"
>>>  #include "internal.h"
>>> @@ -189,14 +187,15 @@ static inline void set_lp_rbj(BiquadD2 *bq,
>>> double
>>> fc,
>>> double q, double sr, doub
>>>
>>>  static double freq_gain(BiquadCoeffs *c, double freq, double sr)
>>>  {
>>> -double complex z, w;
>>> +double zr, zi;
>>>
>>>  freq *= 2.0 * M_PI / sr;
>>> -w = 0 + I * freq;
>>> -z = 1.0 / cexp(w);
>>> +zr = cos(freq);
>>> +zi = -sin(freq);
>>>
>>> -return cabs(((double complex)c->a0 + c->a1 * z + c->a2 * z*z) /
>>> -((double complex)1.0 + c->b1 * z + c->b2 * z*z));
>>> +/* |(a0 + a1*z + a2*z^2)/(1 + b1*z + b2*z^2)| */
>>> +return hypot(c->a0 + c->a1*zr + c->a2*(zr*zr-zi*zi), c->a1*zi +
>>> 2*c->a2*zr*zi) /
>>> +   hypot(1 + c->b1*zr + c->b2*(zr*zr-zi*zi), c->b1*zi +
>>> 2*c->b2*zr*zi);
>>>  }
>>>
>>>  static int config_input(AVFilterLink *inlink)
>>> --
>>> 2.6.4
>>>
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>>
>> ok
>
> I assume by this you are ok with the configure change as well.

Re: [FFmpeg-devel] [PATCH] lavu/libm: add exp10 support

2015-12-23 Thread Ganesh Ajjanagadde
On Tue, Dec 22, 2015 at 4:31 PM, Ganesh Ajjanagadde  wrote:
> On Tue, Dec 22, 2015 at 4:17 PM, Hendrik Leppkes  wrote:
>> On Wed, Dec 23, 2015 at 12:29 AM, Ganesh Ajjanagadde
>>  wrote:
>>> exp10 is a function available in GNU libm. Looks like no other common
>>> libm has it. This adds support for it to FFmpeg.
>>>
>>> There are essentially 2 ways of handling the fallback:
>>> 1. Using pow(10, x)
>>> 2. Using exp2(M_LOG2_10 * x).
>>>
>>> First one represents a Pareto improvement, with no speed or accuracy
>>> regression anywhere, but speed improvement limited to GNU libm.
>>>
>>> Second one represents a slight accuracy loss (relative error ~ 1e-13)
>>> for non GNU libm. Speedup of > 2x is obtained on non GNU libm platforms,
>>> ~30% on GNU libm. These are "average case numbers", another benefit is
>>> the lack of triggering of the well-known terrible worst case paths
>>> through pow.
>>>
>>> Based on reviews, second one chosen. Comment added accordingly.
>>>
>>> Reviewed-by: Michael Niedermayer 
>>> Reviewed-by: Ronald S. Bultje 
>>> Signed-off-by: Ganesh Ajjanagadde 
>>> ---
>>>  configure|  2 ++
>>>  libavutil/libm.h | 24 
>>>  2 files changed, 26 insertions(+)
>>>
>>> diff --git a/configure b/configure
>>> index 54c9789..ea717a5 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -1815,6 +1815,8 @@ MATH_FUNCS="
>>>  copysign
>>>  cosf
>>>  erf
>>> +exp10
>>> +exp10f
>>>  exp2
>>>  exp2f
>>>  expf
>>> diff --git a/libavutil/libm.h b/libavutil/libm.h
>>> index 146768a..9705755 100644
>>> --- a/libavutil/libm.h
>>> +++ b/libavutil/libm.h
>>> @@ -292,6 +292,30 @@ static inline double erf(double z)
>>>  #define exp2f(x) ((float)exp2(x))
>>>  #endif /* HAVE_EXP2F */
>>>
>>> +/* Somewhat inaccurate fallbacks, relative error ~ 1e-13 concentrated on 
>>> very
>>> +small and very large values. For perfection accuracy-wise, should use pow.
>>> +Speed benefits (>2x average, with no super slow paths) deemed to be worth 
>>> the
>>> +accuracy tradeoff */
>>> +#if !HAVE_EXP10
>>> +static av_always_inline double exp10(double x)
>>> +{
>>> +#ifndef M_LOG2_10
>>> +#define M_LOG2_10  3.32192809488736234787  /* log_2 10 */
>>> +#endif
>>
>> Should include mathematic.h for this constant, it already defines
>> common constants if not present.
>
> Did not know if it was safe or not. Changed locally, thanks.
>
> [...]

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


Re: [FFmpeg-devel] [PATCH v5] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Mats Peterson

On 12/23/2015 05:26 PM, Mats Peterson wrote:

On 12/23/2015 05:24 PM, Mats Peterson wrote:

On 12/23/2015 05:17 PM, Alexander Strasser wrote:

On 2015-12-23 13:33 +0100, Hendrik Leppkes wrote:

Am 23.12.2015 13:28 schrieb "Mats Peterson" <
matsp888-at-yahoo@ffmpeg.org>:


On 12/23/2015 01:15 PM, Mats Peterson wrote:


On 12/23/2015 01:13 PM, Carl Eugen Hoyos wrote:


Mats Peterson  ffmpeg.org> writes:


In matroskadec.c, I'm also putting the palette in 'extradata',
like it's done for V_MS/VFW/FOURCC; this is a requirement in
order for MPlayer to recognize the palette.



This is wrong, please remove this hunk.




The reason for this is because MPlayer won't notice the
palette otherwise, as I said before.



This is not correct.


Try it yourself.



Please do.

Carl Eugen

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



Stop this meaningless rant until you've tried it. I know more about
this
issue than you do.

Mats



Let me once and for all clarify the issue with MPlayer and the palette

for you, Eugen. The palette side data packet is sent alright in
matroskadec.c, the problem is that MPlayer sends ANOTHER palette side
data
AFTERWARDS, using whatever is in extradata as the palette. Complain
at the
authors of MPlayer, not me.




If anything it sounds like a bug in mplayer, not FFmpeg.


   I may be totally of the mark, but wasn't it fixed in MPlayer with
r37563:

   Date:   Sat Dec 12 17:34:35 2015 +

 mpcodecs/vd_ffmpeg: Do not overwrite palette with random extradata.


   If yes, I think we have some miscommunication going on here.


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



That's totally unrelated.

Mats



In matroskadec.c, a palette side data packet wasn't added whatsoever
until I patched it.

Mats



The best way to understand what this issue is about is to try the sample 
files, with and without the patch.


https://drive.google.com/open?id=0B3_pEBoLs0faWElmM2FnLTZYNlk

Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v5] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Mats Peterson

On 12/23/2015 05:24 PM, Mats Peterson wrote:

On 12/23/2015 05:17 PM, Alexander Strasser wrote:

On 2015-12-23 13:33 +0100, Hendrik Leppkes wrote:

Am 23.12.2015 13:28 schrieb "Mats Peterson" <
matsp888-at-yahoo@ffmpeg.org>:


On 12/23/2015 01:15 PM, Mats Peterson wrote:


On 12/23/2015 01:13 PM, Carl Eugen Hoyos wrote:


Mats Peterson  ffmpeg.org> writes:


In matroskadec.c, I'm also putting the palette in 'extradata',
like it's done for V_MS/VFW/FOURCC; this is a requirement in
order for MPlayer to recognize the palette.



This is wrong, please remove this hunk.




The reason for this is because MPlayer won't notice the
palette otherwise, as I said before.



This is not correct.


Try it yourself.



Please do.

Carl Eugen

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



Stop this meaningless rant until you've tried it. I know more about
this
issue than you do.

Mats



Let me once and for all clarify the issue with MPlayer and the palette

for you, Eugen. The palette side data packet is sent alright in
matroskadec.c, the problem is that MPlayer sends ANOTHER palette side
data
AFTERWARDS, using whatever is in extradata as the palette. Complain
at the
authors of MPlayer, not me.




If anything it sounds like a bug in mplayer, not FFmpeg.


   I may be totally of the mark, but wasn't it fixed in MPlayer with
r37563:

   Date:   Sat Dec 12 17:34:35 2015 +

 mpcodecs/vd_ffmpeg: Do not overwrite palette with random extradata.


   If yes, I think we have some miscommunication going on here.


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



That's totally unrelated.

Mats



In matroskadec.c, a palette side data packet wasn't added whatsoever 
until I patched it.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v5] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Mats Peterson

On 12/23/2015 05:17 PM, Alexander Strasser wrote:

On 2015-12-23 13:33 +0100, Hendrik Leppkes wrote:

Am 23.12.2015 13:28 schrieb "Mats Peterson" <
matsp888-at-yahoo@ffmpeg.org>:


On 12/23/2015 01:15 PM, Mats Peterson wrote:


On 12/23/2015 01:13 PM, Carl Eugen Hoyos wrote:


Mats Peterson  ffmpeg.org> writes:


In matroskadec.c, I'm also putting the palette in 'extradata',
like it's done for V_MS/VFW/FOURCC; this is a requirement in
order for MPlayer to recognize the palette.



This is wrong, please remove this hunk.




The reason for this is because MPlayer won't notice the
palette otherwise, as I said before.



This is not correct.


Try it yourself.



Please do.

Carl Eugen

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



Stop this meaningless rant until you've tried it. I know more about this
issue than you do.

Mats



Let me once and for all clarify the issue with MPlayer and the palette

for you, Eugen. The palette side data packet is sent alright in
matroskadec.c, the problem is that MPlayer sends ANOTHER palette side data
AFTERWARDS, using whatever is in extradata as the palette. Complain at the
authors of MPlayer, not me.




If anything it sounds like a bug in mplayer, not FFmpeg.


   I may be totally of the mark, but wasn't it fixed in MPlayer with r37563:

   Date:   Sat Dec 12 17:34:35 2015 +

 mpcodecs/vd_ffmpeg: Do not overwrite palette with random extradata.


   If yes, I think we have some miscommunication going on here.


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



That's totally unrelated.

Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v5] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Alexander Strasser
On 2015-12-23 13:33 +0100, Hendrik Leppkes wrote:
> Am 23.12.2015 13:28 schrieb "Mats Peterson" <
> matsp888-at-yahoo@ffmpeg.org>:
> >
> > On 12/23/2015 01:15 PM, Mats Peterson wrote:
> >>
> >> On 12/23/2015 01:13 PM, Carl Eugen Hoyos wrote:
> >>>
> >>> Mats Peterson  ffmpeg.org> writes:
> >>>
> >> In matroskadec.c, I'm also putting the palette in 'extradata',
> >> like it's done for V_MS/VFW/FOURCC; this is a requirement in
> >> order for MPlayer to recognize the palette.
> >
> >
> > This is wrong, please remove this hunk.
> >>>
> >>>
>  The reason for this is because MPlayer won't notice the
>  palette otherwise, as I said before.
> >>>
> >>>
> >>> This is not correct.
> >>>
>  Try it yourself.
> >>>
> >>>
> >>> Please do.
> >>>
> >>> Carl Eugen
> >>>
> >>> ___
> >>> ffmpeg-devel mailing list
> >>> ffmpeg-devel@ffmpeg.org
> >>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >>>
> >>
> >> Stop this meaningless rant until you've tried it. I know more about this
> >> issue than you do.
> >>
> >> Mats
> >>
> >
> > Let me once and for all clarify the issue with MPlayer and the palette
> for you, Eugen. The palette side data packet is sent alright in
> matroskadec.c, the problem is that MPlayer sends ANOTHER palette side data
> AFTERWARDS, using whatever is in extradata as the palette. Complain at the
> authors of MPlayer, not me.
> >
> 
> If anything it sounds like a bug in mplayer, not FFmpeg.

  I may be totally of the mark, but wasn't it fixed in MPlayer with r37563:

  Date:   Sat Dec 12 17:34:35 2015 +

mpcodecs/vd_ffmpeg: Do not overwrite palette with random extradata.


  If yes, I think we have some miscommunication going on here.


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


Re: [FFmpeg-devel] [PATCH] lavfi/af_aemphasis: remove unnecessary complex number usage

2015-12-23 Thread Ganesh Ajjanagadde
On Tue, Dec 22, 2015 at 11:32 PM, Paul B Mahol  wrote:
> On 12/22/15, Ganesh Ajjanagadde  wrote:
>> On Tue, Dec 22, 2015 at 2:10 PM, Paul B Mahol  wrote:
>>> On 12/22/15, Ganesh Ajjanagadde  wrote:
 On Tue, Dec 22, 2015 at 12:46 AM, Paul B Mahol  wrote:
> On 12/22/15, Ganesh Ajjanagadde  wrote:
>> complex is not available on all platforms. Furthermore, it is trivial
>> to
>> rewrite complex number expressions to real arithmetic, and in fact
>> sometimes advantageous for performance reasons: by wrapping as a
>> complex,
>> one forces a particular Cartesian representation that is not
>> necessarily
>> optimal for the purpose.
>>
>> Configure tests are also removed, and aemphasis is now available
>> across
>> all platforms.
>>
>> Signed-off-by: Ganesh Ajjanagadde 
>> ---
>>  configure  | 26 --
>>  libavfilter/af_aemphasis.c | 13 ++---
>>  2 files changed, 6 insertions(+), 33 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 0227540..46021c4 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1070,21 +1070,6 @@ int main(void){ $func(); }
>>  EOF
>>  }
>>
>> -check_complexfunc(){
>> -log check_complexfunc "$@"
>> -func=$1
>> -narg=$2
>> -shift 2
>> -test $narg = 2 && args="f, g" || args="f * I"
>> -disable $func
>> -check_ld "cc" "$@" <> -#include 
>> -#include 
>> -float foo(complex float f, complex float g) { return $func($args); }
>> -int main(void){ return (int) foo; }
>> -EOF
>> -}
>> -
>>  check_mathfunc(){
>>  log check_mathfunc "$@"
>>  func=$1
>> @@ -1803,11 +1788,6 @@ INTRINSICS_LIST="
>>  intrinsics_neon
>>  "
>>
>> -COMPLEX_FUNCS="
>> -cabs
>> -cexp
>> -"
>> -
>>  MATH_FUNCS="
>>  atanf
>>  atan2f
>> @@ -1944,7 +1924,6 @@ HAVE_LIST="
>>  $ARCH_FEATURES
>>  $ATOMICS_LIST
>>  $BUILTIN_LIST
>> -$COMPLEX_FUNCS
>>  $HAVE_LIST_CMDLINE
>>  $HAVE_LIST_PUB
>>  $HEADERS_LIST
>> @@ -2835,7 +2814,6 @@ unix_protocol_deps="sys_un_h"
>>  unix_protocol_select="network"
>>
>>  # filters
>> -aemphasis_filter_deps="cabs cexp"
>>  amovie_filter_deps="avcodec avformat"
>>  aresample_filter_deps="swresample"
>>  ass_filter_deps="libass"
>> @@ -5379,10 +5357,6 @@ for func in $MATH_FUNCS; do
>>  eval check_mathfunc $func \${${func}_args:-1}
>>  done
>>
>> -for func in $COMPLEX_FUNCS; do
>> -eval check_complexfunc $func \${${func}_args:-1}
>> -done
>> -
>>  # these are off by default, so fail if requested and not available
>>  enabled avfoundation_indev && { check_header_objcc
>> AVFoundation/AVFoundation.h || disable avfoundation_indev; }
>>  enabled avfoundation_indev && { check_lib2
>> CoreGraphics/CoreGraphics.h
>> CGGetActiveDisplayList -framework CoreGraphics ||
>> diff --git a/libavfilter/af_aemphasis.c b/libavfilter/af_aemphasis.c
>> index 2966f77..a5b8e30 100644
>> --- a/libavfilter/af_aemphasis.c
>> +++ b/libavfilter/af_aemphasis.c
>> @@ -18,8 +18,6 @@
>>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
>> 02110-1301
>> USA
>>   */
>>
>> -#include 
>> -
>>  #include "libavutil/opt.h"
>>  #include "avfilter.h"
>>  #include "internal.h"
>> @@ -189,14 +187,15 @@ static inline void set_lp_rbj(BiquadD2 *bq,
>> double
>> fc,
>> double q, double sr, doub
>>
>>  static double freq_gain(BiquadCoeffs *c, double freq, double sr)
>>  {
>> -double complex z, w;
>> +double zr, zi;
>>
>>  freq *= 2.0 * M_PI / sr;
>> -w = 0 + I * freq;
>> -z = 1.0 / cexp(w);
>> +zr = cos(freq);
>> +zi = -sin(freq);
>>
>> -return cabs(((double complex)c->a0 + c->a1 * z + c->a2 * z*z) /
>> -((double complex)1.0 + c->b1 * z + c->b2 * z*z));
>> +/* |(a0 + a1*z + a2*z^2)/(1 + b1*z + b2*z^2)| */
>> +return hypot(c->a0 + c->a1*zr + c->a2*(zr*zr-zi*zi), c->a1*zi +
>> 2*c->a2*zr*zi) /
>> +   hypot(1 + c->b1*zr + c->b2*(zr*zr-zi*zi), c->b1*zi +
>> 2*c->b2*zr*zi);
>>  }
>>
>>  static int config_input(AVFilterLink *inlink)
>> --
>> 2.6.4
>>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
> ok

 I assume by this you are ok with the configure change as well.
 Personally, I think the effort needed for writing the configure hacks
 is higher than using real arithmetic, and hence I removed it to help
 ensure it is not added back again.

 This fi

Re: [FFmpeg-devel] [PATCH v6] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Mats Peterson

On 12/23/2015 03:37 PM, Mats Peterson wrote:

I mistakenly used 'extradata' rather than 'st->codec->extradata',
naturally leading to a segfault. Here's an updated patch.

An explanation of the patch follows:

Palettized QuickTime video in Matroska has hitherto not been recognized
whatsoever, and the "palette" used has been completely random.

The patch for matroskadec.c fixes this issue by adding a palette side
data packet in matroska_deliver_packet(), much in the same way as it's
done in mov.c.

The change to mov.c consists mainly of moving the palette handling from
the mov_parse_stsd_video() function to a new ff_get_qtpalette() function
in the new file qtpalette.c, which is shared by both matroskadec.c and
mov.c.

In matroskadec.c, I'm also putting the palette in 'extradata', like it's
done for V_MS/VFW/FOURCC; this is a requirement in order for MPlayer to
recognize the palette. And why is this, you may wonder. Well, it's
because for some mysterious reason, MPlayer adds ANOTHER palette side
data packet after the one added in matroskadec.c. It uses whatever is in
extradata as the palette when adding this packet.

Mats



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



Samples: https://drive.google.com/open?id=0B3_pEBoLs0faWElmM2FnLTZYNlk

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v6] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Mats Peterson
I mistakenly used 'extradata' rather than 'st->codec->extradata', 
naturally leading to a segfault. Here's an updated patch.


An explanation of the patch follows:

Palettized QuickTime video in Matroska has hitherto not been recognized 
whatsoever, and the "palette" used has been completely random.


The patch for matroskadec.c fixes this issue by adding a palette side 
data packet in matroska_deliver_packet(), much in the same way as it's 
done in mov.c.


The change to mov.c consists mainly of moving the palette handling from 
the mov_parse_stsd_video() function to a new ff_get_qtpalette() function 
in the new file qtpalette.c, which is shared by both matroskadec.c and 
mov.c.


In matroskadec.c, I'm also putting the palette in 'extradata', like it's 
done for V_MS/VFW/FOURCC; this is a requirement in order for MPlayer to 
recognize the palette. And why is this, you may wonder. Well, it's 
because for some mysterious reason, MPlayer adds ANOTHER palette side 
data packet after the one added in matroskadec.c. It uses whatever is in 
extradata as the palette when adding this packet.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From 91376a9e4e0cb4a7522be565e248616c4803c0ad Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Wed, 23 Dec 2015 15:30:15 +0100
Subject: [PATCH v6] lavf: palettized QuickTime video in Matroska

---
 libavformat/Makefile  |1 +
 libavformat/matroskadec.c |   30 ++-
 libavformat/mov.c |   92 -
 libavformat/qtpalette.c   |  123 +
 libavformat/qtpalette.h   |6 ++-
 5 files changed, 178 insertions(+), 74 deletions(-)
 create mode 100644 libavformat/qtpalette.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 110e9e3..e03c73e 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -18,6 +18,7 @@ OBJS = allformats.o \
mux.o\
options.o\
os_support.o \
+   qtpalette.o  \
riff.o   \
sdp.o\
url.o\
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index c574749..cc3cdd0 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -64,6 +64,8 @@
 #include 
 #endif
 
+#include "qtpalette.h"
+
 typedef enum {
 EBML_NONE,
 EBML_UINT,
@@ -312,6 +314,9 @@ typedef struct MatroskaDemuxContext {
 
 /* WebM DASH Manifest live flag/ */
 int is_live;
+
+uint32_t palette[AVPALETTE_COUNT];
+int has_palette;
 } MatroskaDemuxContext;
 
 typedef struct MatroskaBlock {
@@ -1856,7 +1861,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
 fourcc   = st->codec->codec_tag;
 extradata_offset = FFMIN(track->codec_priv.size, 18);
 } else if (!strcmp(track->codec_id, "A_QUICKTIME")
-   && (track->codec_priv.size >= 86)
+   && (track->codec_priv.size >= 36)
&& (track->codec_priv.data)) {
 fourcc = AV_RL32(track->codec_priv.data + 4);
 codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc);
@@ -1881,6 +1886,20 @@ static int matroska_parse_tracks(AVFormatContext *s)
 av_log(matroska->ctx, AV_LOG_ERROR,
"mov FourCC not found %s.\n", buf);
 }
+if (track->codec_priv.size >= 86) {
+bit_depth = AV_RB16(track->codec_priv.data + 82);
+if (ff_get_qtpalette(codec_id, track->codec_priv.data + 16,
+NULL, matroska->palette)) {
+bit_depth &= 0x1F;
+/* Behave like V_MS/VFW/FOURCC; copy the palette to
+ * extradata */
+if (ff_alloc_extradata(st->codec, AVPALETTE_SIZE))
+return AVERROR(ENOMEM);
+memcpy(st->codec->extradata, matroska->palette,
+AVPALETTE_SIZE);
+matroska->has_palette = 1;
+}
+}
 } else if (codec_id == AV_CODEC_ID_PCM_S16BE) {
 switch (track->audio.bitdepth) {
 case  8:
@@ -2326,6 +2345,15 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska,
 if (matroska->num_packets > 0) {
 memcpy(pkt, matroska->packets[0], sizeof(AVPacket));
 av_freep(&matroska->packets[0]);
+if (matroska->has_palette) {
+uint8_t *pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
+if (!pal) {
+av_log(matroska->ctx, AV_LOG_ERROR, "Cannot append palette to packet\n");
+} else {
+memcpy(pal, matroska->palette, AVPALETTE_SIZE);
+}
+matroska->has_palette = 0;
+}
 if (matroska->num_packets > 1) {
 void *newpackets;
 memmove(&matroska->packets[0], &matroska-

Re: [FFmpeg-devel] [PATCH v5] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Mats Peterson

On 12/23/2015 01:37 PM, Mats Peterson wrote:

On 12/23/2015 01:33 PM, Hendrik Leppkes wrote:

Am 23.12.2015 13:28 schrieb "Mats Peterson" <
matsp888-at-yahoo@ffmpeg.org>:


On 12/23/2015 01:15 PM, Mats Peterson wrote:


On 12/23/2015 01:13 PM, Carl Eugen Hoyos wrote:


Mats Peterson  ffmpeg.org> writes:


In matroskadec.c, I'm also putting the palette in 'extradata',
like it's done for V_MS/VFW/FOURCC; this is a requirement in
order for MPlayer to recognize the palette.



This is wrong, please remove this hunk.




The reason for this is because MPlayer won't notice the
palette otherwise, as I said before.



This is not correct.


Try it yourself.



Please do.

Carl Eugen

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



Stop this meaningless rant until you've tried it. I know more about
this
issue than you do.

Mats



Let me once and for all clarify the issue with MPlayer and the palette

for you, Eugen. The palette side data packet is sent alright in
matroskadec.c, the problem is that MPlayer sends ANOTHER palette side
data
AFTERWARDS, using whatever is in extradata as the palette. Complain at
the
authors of MPlayer, not me.




If anything it sounds like a bug in mplayer, not FFmpeg.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



Well, before my patch, there was no palette side data packet sent
whatsoever in matroskadec.c, as I have clearly stated in the description
of the patch. But the issue with MPlayer is unrelated to that. The
problem is that MPlayer insists on sending another palette side data
packet afterwards. That's where things mess up. You're forced to place
the palette in extradata AS WELL in order to make MPlayer use
it properly when it sends it extraneous palette side data packet.

Mats



Ouch, I noticed a mistake here. New patch on its way.

Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Adding frame side data about green metadata

2015-12-23 Thread Michael Niedermayer
On Wed, Dec 23, 2015 at 12:43:48PM +, Nicolas Derouineau wrote:
> > Sorry if I missed something:
> > What is green metadata?
> 
> Greenmetadata is a set of metrics specified in ISO/IEC 23001-11.
> 
> They are used to predict the decoding complexity (in terms of cycles) of AVC 
> frames. It is useful to perform DVFS (ie: CPU frequency scaling) in order to 
> reduce decoder power consumption.
> 
> By the way, I'm not sure the patch was correctly attached. I'm trying one 
> more time to attach it.
[...]

> index e69de29..7b383e7 100644
> --- a/libavutil/greenmetadata.h
> +++ b/libavutil/greenmetadata.h
> @@ -0,0 +1,38 @@
> +/*
> + * Copyright (c) 2015 Nicolas DEROUINEAU 
> + *
> + * 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 AVUTIL_GREENMD_H
> +#define AVUTIL_GREENMD_H
> +
> +#include 

> +#include 

libavutil should not include stuff from libavcodec
also it would be "libavcodec/h264.h" not 


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway


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


Re: [FFmpeg-devel] [PATCH] Adding frame side data about green metadata

2015-12-23 Thread Vittorio Giovara
On Wed, Dec 23, 2015 at 12:28 PM, Nicolas Derouineau
 wrote:
> Hello,
> Please find here enclosed a patch adding frame side data information about 
> green metadata.

The logic is ok, but the introduction of av_greenmetadata_set is a
no-go for me. This function is exposed to every user (with a non-fixed
data type) and its only purpose is to set the values in an array.
There is no need for that: if you believe that there are going to be
many codecs needing this functionality, just add a private function in
a separate file within libavcodec, otherwise you may initialize the
array directly in the sei_green_metadata_present check in h264.c
without any function call at all.

As a minor nit, please keep the code style consistent, with spaces
around '=', 'if's and logic operators.
-- 
Vittorio
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Adding frame side data about green metadata

2015-12-23 Thread Nicolas Derouineau
> Sorry if I missed something:
> What is green metadata?

Greenmetadata is a set of metrics specified in ISO/IEC 23001-11.

They are used to predict the decoding complexity (in terms of cycles) of AVC 
frames. It is useful to perform DVFS (ie: CPU frequency scaling) in order to 
reduce decoder power consumption.

By the way, I'm not sure the patch was correctly attached. I'm trying one more 
time to attach it.


Nicolas DEROUINEAU
Research Engineer
VITEC

T.  +33 1 46 73 06 06
E.  nicolas.derouin...@vitec.com
W. www.vitec.com


De : ffmpeg-devel  de la part de Carl Eugen 
Hoyos 
Envoyé : mercredi 23 décembre 2015 12:38
À : ffmpeg-devel@ffmpeg.org
Objet : Re: [FFmpeg-devel] [PATCH] Adding frame side data about green   metadata

Nicolas Derouineau  vitec.com> writes:

> Please find here enclosed a patch adding frame
> side data information about green metadata.

Sorry if I missed something:
What is green metadata?

Carl Eugen

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
From c2959f8482065dc400d2e09002363fc8295d5400 Mon Sep 17 00:00:00 2001
From: Nicolas DEROUINEAU 
Date: Wed, 23 Dec 2015 12:19:03 +0100
Subject: [PATCH 2/2] Adding frame side data about green metadata - second part

---
 libavcodec/h264.c | 12 
 libavcodec/h264.h |  2 ++
 libavcodec/h264_sei.c |  3 +++
 libavutil/Makefile|  2 ++
 libavutil/frame.h |  7 +++
 libavutil/greenmetadata.c | 23 +++
 libavutil/greenmetadata.h | 38 ++
 7 files changed, 87 insertions(+)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 089a86f..7b28dd2 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -29,6 +29,7 @@
 
 #include "libavutil/avassert.h"
 #include "libavutil/display.h"
+#include "libavutil/greenmetadata.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/opt.h"
 #include "libavutil/stereo3d.h"
@@ -879,6 +880,17 @@ static void decode_postinit(H264Context *h, int setup_finished)
 }
 }
 
+if ( h->sei_green_metadata_present){
+AVFrameSideData *Greenmd = av_frame_new_side_data(cur->f, AV_FRAME_DATA_GREENMD,
+ sizeof(GreenMetaData));
+
+if(Greenmd){
+av_greenmetadata_set((uint8_t *)Greenmd->data, h->sei_green_metadata);
+av_freep(&h->sei_green_metadata);
+h->sei_green_metadata_present = 0;
+}
+}
+
 if (h->sei_reguserdata_afd_present) {
 AVFrameSideData *sd = av_frame_new_side_data(cur->f, AV_FRAME_DATA_AFD,
  sizeof(uint8_t));
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 5d9aecd..e6eb7c8 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -839,8 +839,10 @@ typedef struct H264Context {
 qpel_mc_func (*qpel_avg)[16];
 
 /*Green Metadata */
+int sei_green_metadata_present;
 GreenMetaData sei_green_metadata;
 
+
 } H264Context;
 
 extern const uint8_t ff_h264_chroma_qp[7][QP_MAX_NUM + 1]; ///< One chroma qp table for each possible bit depth (8-14).
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 0411b87..1ced948 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -43,6 +43,7 @@ void ff_h264_reset_sei(H264Context *h)
 h->sei_frame_packing_present=  0;
 h->sei_display_orientation_present = 0;
 h->sei_reguserdata_afd_present  =  0;
+h->sei_green_metadata_present = 0 ;
 
 h->a53_caption_size = 0;
 av_freep(&h->a53_caption);
@@ -401,6 +402,8 @@ static int decode_GreenMetadata(H264Context *h)
(float)h->sei_green_metadata.percent_six_tap_filtering/255,
(float)h->sei_green_metadata.percent_alpha_point_deblocking_instance/255);
 
+h->sei_green_metadata_present=1;
+
 }else if( h->sei_green_metadata.green_metadata_type==1){
 h->sei_green_metadata.xsd_metric_type=get_bits(&h->gb, 8);
 h->sei_green_metadata.xsd_metric_value=get_bits(&h->gb, 16);
diff --git a/libavutil/Makefile b/libavutil/Makefile
index bf8c713..c3cae53 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -29,6 +29,7 @@ HEADERS = adler32.h \
   fifo.h\
   file.h\
   frame.h   \
+  greenmetadata.h   \
   hash.h\
   hmac.h\
   imgutils.h\
@@ -105,6 +106,7 @@ OBJS = adler32.o

Re: [FFmpeg-devel] [PATCH v5] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Mats Peterson

On 12/23/2015 01:33 PM, Hendrik Leppkes wrote:

Am 23.12.2015 13:28 schrieb "Mats Peterson" <
matsp888-at-yahoo@ffmpeg.org>:


On 12/23/2015 01:15 PM, Mats Peterson wrote:


On 12/23/2015 01:13 PM, Carl Eugen Hoyos wrote:


Mats Peterson  ffmpeg.org> writes:


In matroskadec.c, I'm also putting the palette in 'extradata',
like it's done for V_MS/VFW/FOURCC; this is a requirement in
order for MPlayer to recognize the palette.



This is wrong, please remove this hunk.




The reason for this is because MPlayer won't notice the
palette otherwise, as I said before.



This is not correct.


Try it yourself.



Please do.

Carl Eugen

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



Stop this meaningless rant until you've tried it. I know more about this
issue than you do.

Mats



Let me once and for all clarify the issue with MPlayer and the palette

for you, Eugen. The palette side data packet is sent alright in
matroskadec.c, the problem is that MPlayer sends ANOTHER palette side data
AFTERWARDS, using whatever is in extradata as the palette. Complain at the
authors of MPlayer, not me.




If anything it sounds like a bug in mplayer, not FFmpeg.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



Well, before my patch, there was no palette side data packet sent 
whatsoever in matroskadec.c, as I have clearly stated in the description 
of the patch. But the issue with MPlayer is unrelated to that. The 
problem is that MPlayer insists on sending another palette side data 
packet afterwards. That's where things mess up. You're forced to place 
the palette in extradata AS WELL in order to make MPlayer use

it properly when it sends it extraneous palette side data packet.

Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v5] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Hendrik Leppkes
Am 23.12.2015 13:28 schrieb "Mats Peterson" <
matsp888-at-yahoo@ffmpeg.org>:
>
> On 12/23/2015 01:15 PM, Mats Peterson wrote:
>>
>> On 12/23/2015 01:13 PM, Carl Eugen Hoyos wrote:
>>>
>>> Mats Peterson  ffmpeg.org> writes:
>>>
>> In matroskadec.c, I'm also putting the palette in 'extradata',
>> like it's done for V_MS/VFW/FOURCC; this is a requirement in
>> order for MPlayer to recognize the palette.
>
>
> This is wrong, please remove this hunk.
>>>
>>>
 The reason for this is because MPlayer won't notice the
 palette otherwise, as I said before.
>>>
>>>
>>> This is not correct.
>>>
 Try it yourself.
>>>
>>>
>>> Please do.
>>>
>>> Carl Eugen
>>>
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>>
>> Stop this meaningless rant until you've tried it. I know more about this
>> issue than you do.
>>
>> Mats
>>
>
> Let me once and for all clarify the issue with MPlayer and the palette
for you, Eugen. The palette side data packet is sent alright in
matroskadec.c, the problem is that MPlayer sends ANOTHER palette side data
AFTERWARDS, using whatever is in extradata as the palette. Complain at the
authors of MPlayer, not me.
>

If anything it sounds like a bug in mplayer, not FFmpeg.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v5] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Mats Peterson

On 12/23/2015 01:15 PM, Mats Peterson wrote:

On 12/23/2015 01:13 PM, Carl Eugen Hoyos wrote:

Mats Peterson  ffmpeg.org> writes:


In matroskadec.c, I'm also putting the palette in 'extradata',
like it's done for V_MS/VFW/FOURCC; this is a requirement in
order for MPlayer to recognize the palette.


This is wrong, please remove this hunk.



The reason for this is because MPlayer won't notice the
palette otherwise, as I said before.


This is not correct.


Try it yourself.


Please do.

Carl Eugen

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



Stop this meaningless rant until you've tried it. I know more about this
issue than you do.

Mats



Let me once and for all clarify the issue with MPlayer and the palette 
for you, Eugen. The palette side data packet is sent alright in 
matroskadec.c, the problem is that MPlayer sends ANOTHER palette side 
data AFTERWARDS, using whatever is in extradata as the palette. Complain 
at the authors of MPlayer, not me.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] can't build the ffmpeg for iOS using the newest gas-preprocessor.pl

2015-12-23 Thread Michael Niedermayer
On Wed, Dec 23, 2015 at 07:30:05PM +0800, zhuhb wrote:
>  
> 
> aarch64 2.7.2+ build on osx should work with the options listed at:
> 
>  
>  ple-clang-n2.7>
> http://fate.ffmpeg.org/report.cgi?time=20151221193018&slot=arm64-osx10.9-app
> le-clang-n2.7
> 
>  
> 
> arm:
> 
>  
>  e-clang-n2.7>
> http://fate.ffmpeg.org/report.cgi?time=20151221184824&slot=arm-osx10.9-apple
> -clang-n2.7
> 
>  
> 
> maybe you can figure out which differences cause the failure ?
> 
> Although I change my configuration according to the website, I can't fix the
> following critical error:
> 

> Unable to identify target architecture at /usr/local/bin/gas-preprocessor.pl
> line 82.

this is not the current or even a year old gas-preprocessor.pl from
https://github.com/FFmpeg/gas-preprocessor

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

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein


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


Re: [FFmpeg-devel] [PATCH v5] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Mats Peterson

On 12/23/2015 01:13 PM, Carl Eugen Hoyos wrote:

Mats Peterson  ffmpeg.org> writes:


In matroskadec.c, I'm also putting the palette in 'extradata',
like it's done for V_MS/VFW/FOURCC; this is a requirement in
order for MPlayer to recognize the palette.


This is wrong, please remove this hunk.



The reason for this is because MPlayer won't notice the
palette otherwise, as I said before.


This is not correct.


Try it yourself.


Please do.

Carl Eugen

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



Stop this meaningless rant until you've tried it. I know more about this 
issue than you do.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Merge commit 'b9ece15a01782b4f301c0c139d1d7b20f848914c'

2015-12-23 Thread Carl Eugen Hoyos
Hendrik Leppkes  gmail.com> writes:

> > $ ffmpeg -f lavfi -i color -f yuv4mpegpipe -vcodec rawvideo /dev/null

> Just skip the vcodec entirely and it'll work magically

Thank you for this useful information, I would never 
have guessed!

> and faster as well - which is the reason for the change, 
> it avoids a costly memcpy of every single video frame.

I hadn't realized this, thanks! Imo, this should have been 
part of the commit message that instead of explaining why 
just explained what was changed.

This still leaves the question why last week you argued 
we shouldn't break user scripts...

Please add a line to the Changelog.

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH v5] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Carl Eugen Hoyos
Mats Peterson  ffmpeg.org> writes:

> >> In matroskadec.c, I'm also putting the palette in 'extradata',
> >> like it's done for V_MS/VFW/FOURCC; this is a requirement in
> >> order for MPlayer to recognize the palette.
> >
> > This is wrong, please remove this hunk.

> The reason for this is because MPlayer won't notice the 
> palette otherwise, as I said before.

This is not correct.

> Try it yourself.

Please do.

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH v5] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Mats Peterson

On 12/23/2015 01:07 PM, Carl Eugen Hoyos wrote:

Mats Peterson  ffmpeg.org> writes:


In matroskadec.c, I'm also putting the palette in 'extradata',
like it's done for V_MS/VFW/FOURCC; this is a requirement in
order for MPlayer to recognize the palette.


This is wrong, please remove this hunk.

The reason it is needed for AVI is not MPlayer but remuxing.

Carl Eugen

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



The reason for this is because MPlayer won't notice the palette 
otherwise, as I said before. Try it yourself. MPlayer uses whatever is 
in extradata as the palette, just like it does for V_MS/VFW/FOURCC. So 
it is not wrong at all.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v5] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Carl Eugen Hoyos
Mats Peterson  ffmpeg.org> writes:

> In matroskadec.c, I'm also putting the palette in 'extradata', 
> like it's done for V_MS/VFW/FOURCC; this is a requirement in 
> order for MPlayer to recognize the palette.

This is wrong, please remove this hunk.

The reason it is needed for AVI is not MPlayer but remuxing.

Carl Eugen

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


[FFmpeg-devel] [PATCH v5] lavf: palettized QuickTime video in Matroska

2015-12-23 Thread Mats Peterson
OK Clement, I have changed some of the stuff you complained about. 
Regarding my being the sole author, well, the *idea* has been there 
before in the shape of that patch by, they say, Martin Storsjö (which he 
doesn't admit to be behind, I've talked to him). I don't know how his 
name came up whatsoever. Anyway, that old patch was the "technically bad 
one", to cite another developer here, since it called into the mov 
demuxer from matroskadec.c. Nothing of that exists anymore.


Original explanation of the patch follows:

Palettized QuickTime video in Matroska has hitherto not been recognized 
whatsoever, and the "palette" used has been completely random.


The patch for matroskadec.c fixes this issue by adding a palette side 
data packet in matroska_deliver_packet(), much in the same way as it's 
done in mov.c.


The change to mov.c consists mainly of moving the palette handling from 
the mov_parse_stsd_video() function to a new ff_get_qtpalette() function 
in the new file qtpalette.c, which is shared by both matroskadec.c and 
mov.c.


In matroskadec.c, I'm also putting the palette in 'extradata', like it's 
done for V_MS/VFW/FOURCC; this is a requirement in order for MPlayer to 
recognize the palette.


--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From e764c56bc1e5a7ff475d5ab60b09121398b0fde9 Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Wed, 23 Dec 2015 12:59:23 +0100
Subject: [PATCH v5] lavf: palettized QuickTime video in Matroska

---
 libavformat/Makefile  |1 +
 libavformat/matroskadec.c |   29 ++-
 libavformat/mov.c |   92 -
 libavformat/qtpalette.c   |  123 +
 libavformat/qtpalette.h   |6 ++-
 5 files changed, 177 insertions(+), 74 deletions(-)
 create mode 100644 libavformat/qtpalette.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 110e9e3..e03c73e 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -18,6 +18,7 @@ OBJS = allformats.o \
mux.o\
options.o\
os_support.o \
+   qtpalette.o  \
riff.o   \
sdp.o\
url.o\
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index c574749..8020b88 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -64,6 +64,8 @@
 #include 
 #endif
 
+#include "qtpalette.h"
+
 typedef enum {
 EBML_NONE,
 EBML_UINT,
@@ -312,6 +314,9 @@ typedef struct MatroskaDemuxContext {
 
 /* WebM DASH Manifest live flag/ */
 int is_live;
+
+uint32_t palette[AVPALETTE_COUNT];
+int has_palette;
 } MatroskaDemuxContext;
 
 typedef struct MatroskaBlock {
@@ -1856,7 +1861,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
 fourcc   = st->codec->codec_tag;
 extradata_offset = FFMIN(track->codec_priv.size, 18);
 } else if (!strcmp(track->codec_id, "A_QUICKTIME")
-   && (track->codec_priv.size >= 86)
+   && (track->codec_priv.size >= 36)
&& (track->codec_priv.data)) {
 fourcc = AV_RL32(track->codec_priv.data + 4);
 codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc);
@@ -1881,6 +1886,19 @@ static int matroska_parse_tracks(AVFormatContext *s)
 av_log(matroska->ctx, AV_LOG_ERROR,
"mov FourCC not found %s.\n", buf);
 }
+if (track->codec_priv.size >= 86) {
+bit_depth = AV_RB16(track->codec_priv.data + 82);
+if (ff_get_qtpalette(codec_id, track->codec_priv.data + 16,
+NULL, matroska->palette)) {
+bit_depth &= 0x1F;
+/* Behave like V_MS/VFW/FOURCC; copy the palette to
+ * extradata */
+if (ff_alloc_extradata(st->codec, AVPALETTE_SIZE))
+return AVERROR(ENOMEM);
+memcpy(extradata, matroska->palette, AVPALETTE_SIZE);
+matroska->has_palette = 1;
+}
+}
 } else if (codec_id == AV_CODEC_ID_PCM_S16BE) {
 switch (track->audio.bitdepth) {
 case  8:
@@ -2326,6 +2344,15 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska,
 if (matroska->num_packets > 0) {
 memcpy(pkt, matroska->packets[0], sizeof(AVPacket));
 av_freep(&matroska->packets[0]);
+if (matroska->has_palette) {
+uint8_t *pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
+if (!pal) {
+av_log(matroska->ctx, AV_LOG_ERROR, "Cannot append palette to packet\n");
+} else {
+memcpy(pal, matroska->palette, AVPALETTE_SIZE);
+}
+matroska->has_palette = 0;
+}
 if (matroska->num_packets > 1) {
  

Re: [FFmpeg-devel] Merge commit 'b9ece15a01782b4f301c0c139d1d7b20f848914c'

2015-12-23 Thread Hendrik Leppkes
On Wed, Dec 23, 2015 at 12:47 PM, Carl Eugen Hoyos  wrote:
> Nicolas George  nsup.org> writes:
>
>>
>> Le tridi 3 nivôse, an CCXXIV, Carl Eugen Hoyos a écrit :
>> > yuv4mpegpipe used to accept (only) rawvideo as codec.
>> > Bug reports indicate that changing this (without any
>> > explanation) breaks usage of the muxer.
>>
>> Seems to work fine here.
>
> $ ffmpeg -f lavfi -i color -f yuv4mpegpipe -vcodec rawvideo /dev/null
> ffmpeg version N-77434-gb18230e Copyright (c) 2000-2015 the FFmpeg developers
>   built with gcc 4.7 (SUSE Linux)
>   configuration: --enable-gpl
>   libavutil  55. 11.100 / 55. 11.100
>   libavcodec 57. 19.100 / 57. 19.100
>   libavformat57. 20.100 / 57. 20.100
>   libavdevice57.  0.100 / 57.  0.100
>   libavfilter 6. 21.100 /  6. 21.100
>   libswscale  4.  0.100 /  4.  0.100
>   libswresample   2.  0.101 /  2.  0.101
>   libpostproc54.  0.100 / 54.  0.100
> Input #0, lavfi, from 'color':
>   Duration: N/A, start: 0.00, bitrate: N/A
> Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR
> 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
> File '/dev/null' already exists. Overwrite ? [y/N]
> Not overwriting - exiting
> cehoyos@lisbeth:~/test/cehoyos/FFmpeg> ./ffmpeg -f lavfi -i color -f
> yuv4mpegpipe -vcodec rawvideo -y /dev/null
> ffmpeg version N-77434-gb18230e Copyright (c) 2000-2015 the FFmpeg developers
>   built with gcc 4.7 (SUSE Linux)
>   configuration: --enable-gpl
>   libavutil  55. 11.100 / 55. 11.100
>   libavcodec 57. 19.100 / 57. 19.100
>   libavformat57. 20.100 / 57. 20.100
>   libavdevice57.  0.100 / 57.  0.100
>   libavfilter 6. 21.100 /  6. 21.100
>   libswscale  4.  0.100 /  4.  0.100
>   libswresample   2.  0.101 /  2.  0.101
>   libpostproc54.  0.100 / 54.  0.100
> Input #0, lavfi, from 'color':
>   Duration: N/A, start: 0.00, bitrate: N/A
> Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR
> 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
> [yuv4mpegpipe @ 0x1f79e80] ERROR: Codec not supported.
> Output #0, yuv4mpegpipe, to '/dev/null':
>   Metadata:
> encoder : Lavf57.20.100
> Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR
> 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
> Metadata:
>   encoder : Lavc57.19.100 rawvideo
> Stream mapping:
>   Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
> Could not write header for output file #0 (incorrect codec parameters ?):
> Invalid data found when processing input
>

Just skip the vcodec entirely and it'll work magically, and faster as
well - which is the reason for the change, it avoids a costly memcpy
of every single video frame.

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


Re: [FFmpeg-devel] [PATCH] avformat/mpegtsenc: add flag to embed an AC-3/E-AC-3 ES the DVB way

2015-12-23 Thread Stefan Pöschel
Just wanted to ask if there is any further information needed regarding my 
patch.

> Gesendet: Sonntag, 13. Dezember 2015 um 11:54 Uhr
> Von: "Stefan Pöschel" 
> An: ffmpeg-devel@ffmpeg.org
> Betreff: [FFmpeg-devel] [PATCH] avformat/mpegtsenc: add flag to embed an 
> AC-3/E-AC-3 ES the DVB way
>
> So far an AC-3 elementary stream is refered to in the PMT according to
> System A (ATSC). An E-AC-3 ES in contrast is embedded the System B (DVB) way.
> To fix this inconsistency, this commit changes the default E-AC-3 behaviour to
> use the ATSC way, too. Furthermore a new flag is added to optionally select 
> the
> DVB way (regarding both codecs and possible further differences in the 
> future).
> ---
>  libavformat/mpegts.h|  1 +
>  libavformat/mpegtsenc.c | 20 ++--
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
> index 84f3098..0cdbc76 100644
> --- a/libavformat/mpegts.h
> +++ b/libavformat/mpegts.h
> @@ -60,6 +60,7 @@
>  #define STREAM_TYPE_AUDIO_AC3   0x81
>  #define STREAM_TYPE_AUDIO_DTS   0x82
>  #define STREAM_TYPE_AUDIO_TRUEHD0x83
> +#define STREAM_TYPE_AUDIO_EAC3  0x87
> 
>  typedef struct MpegTSContext MpegTSContext;
> 
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index 19032f3..cb11c31 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -99,6 +99,7 @@ typedef struct MpegTSWrite {
>  #define MPEGTS_FLAG_REEMIT_PAT_PMT  0x01
>  #define MPEGTS_FLAG_AAC_LATM0x02
>  #define MPEGTS_FLAG_PAT_PMT_AT_FRAMES   0x04
> +#define MPEGTS_FLAG_SYSTEM_B0x08
>  int flags;
>  int copyts;
>  int tables_version;
> @@ -319,7 +320,14 @@ static int mpegts_write_pmt(AVFormatContext *s, 
> MpegTSService *service)
>  stream_type = STREAM_TYPE_AUDIO_AAC_LATM;
>  break;
>  case AV_CODEC_ID_AC3:
> -stream_type = STREAM_TYPE_AUDIO_AC3;
> +stream_type = (ts->flags & MPEGTS_FLAG_SYSTEM_B)
> +  ? STREAM_TYPE_PRIVATE_DATA
> +  : STREAM_TYPE_AUDIO_AC3;
> +break;
> +case AV_CODEC_ID_EAC3:
> +stream_type = (ts->flags & MPEGTS_FLAG_SYSTEM_B)
> +  ? STREAM_TYPE_PRIVATE_DATA
> +  : STREAM_TYPE_AUDIO_EAC3;
>  break;
>  case AV_CODEC_ID_DTS:
>  stream_type = STREAM_TYPE_AUDIO_DTS;
> @@ -343,7 +351,12 @@ static int mpegts_write_pmt(AVFormatContext *s, 
> MpegTSService *service)
>  /* write optional descriptors here */
>  switch (st->codec->codec_type) {
>  case AVMEDIA_TYPE_AUDIO:
> -if (st->codec->codec_id==AV_CODEC_ID_EAC3) {
> +if (st->codec->codec_id==AV_CODEC_ID_AC3 && (ts->flags & 
> MPEGTS_FLAG_SYSTEM_B)) {
> +*q++=0x6a; // AC3 descriptor see A038 DVB SI
> +*q++=1; // 1 byte, all flags sets to 0
> +*q++=0; // omit all fields...
> +}
> +if (st->codec->codec_id==AV_CODEC_ID_EAC3 && (ts->flags & 
> MPEGTS_FLAG_SYSTEM_B)) {
>  *q++=0x7a; // EAC3 descriptor see A038 DVB SI
>  *q++=1; // 1 byte, all flags sets to 0
>  *q++=0; // omit all fields...
> @@ -1790,6 +1803,9 @@ static const AVOption options[] = {
>  { "pat_pmt_at_frames", "Reemit PAT and PMT at each video frame",
>0, AV_OPT_TYPE_CONST, { .i64 = MPEGTS_FLAG_PAT_PMT_AT_FRAMES}, 0, 
> INT_MAX,
>AV_OPT_FLAG_ENCODING_PARAM, "mpegts_flags" },
> +{ "system_b", "Conform to System B (DVB) instead of System A (ATSC)",
> +  0, AV_OPT_TYPE_CONST, { .i64 = MPEGTS_FLAG_SYSTEM_B }, 0, INT_MAX,
> +  AV_OPT_FLAG_ENCODING_PARAM, "mpegts_flags" },
>  // backward compatibility
>  { "resend_headers", "Reemit PAT/PMT before writing the next packet",
>offsetof(MpegTSWrite, reemit_pat_pmt), AV_OPT_TYPE_INT,
> -- 
> 2.6.4
> ___
> 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] Merge commit 'b9ece15a01782b4f301c0c139d1d7b20f848914c'

2015-12-23 Thread Carl Eugen Hoyos
Nicolas George  nsup.org> writes:

> 
> Le tridi 3 nivôse, an CCXXIV, Carl Eugen Hoyos a écrit :
> > yuv4mpegpipe used to accept (only) rawvideo as codec. 
> > Bug reports indicate that changing this (without any 
> > explanation) breaks usage of the muxer.
> 
> Seems to work fine here.

$ ffmpeg -f lavfi -i color -f yuv4mpegpipe -vcodec rawvideo /dev/null
ffmpeg version N-77434-gb18230e Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil  55. 11.100 / 55. 11.100
  libavcodec 57. 19.100 / 57. 19.100
  libavformat57. 20.100 / 57. 20.100
  libavdevice57.  0.100 / 57.  0.100
  libavfilter 6. 21.100 /  6. 21.100
  libswscale  4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc54.  0.100 / 54.  0.100
Input #0, lavfi, from 'color':
  Duration: N/A, start: 0.00, bitrate: N/A
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR
1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
File '/dev/null' already exists. Overwrite ? [y/N]
Not overwriting - exiting
cehoyos@lisbeth:~/test/cehoyos/FFmpeg> ./ffmpeg -f lavfi -i color -f
yuv4mpegpipe -vcodec rawvideo -y /dev/null
ffmpeg version N-77434-gb18230e Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil  55. 11.100 / 55. 11.100
  libavcodec 57. 19.100 / 57. 19.100
  libavformat57. 20.100 / 57. 20.100
  libavdevice57.  0.100 / 57.  0.100
  libavfilter 6. 21.100 /  6. 21.100
  libswscale  4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc54.  0.100 / 54.  0.100
Input #0, lavfi, from 'color':
  Duration: N/A, start: 0.00, bitrate: N/A
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR
1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
[yuv4mpegpipe @ 0x1f79e80] ERROR: Codec not supported.
Output #0, yuv4mpegpipe, to '/dev/null':
  Metadata:
encoder : Lavf57.20.100
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR
1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
  encoder : Lavc57.19.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
Could not write header for output file #0 (incorrect codec parameters ?):
Invalid data found when processing input

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


Re: [FFmpeg-devel] Merge commit 'b9ece15a01782b4f301c0c139d1d7b20f848914c'

2015-12-23 Thread Nicolas George
Le tridi 3 nivôse, an CCXXIV, Carl Eugen Hoyos a écrit :
> yuv4mpegpipe used to accept (only) rawvideo as codec. 
> Bug reports indicate that changing this (without any 
> explanation) breaks usage of the muxer.

Seems to work fine here.
"Complete command line and console output missing." ;-Þ

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] Adding frame side data about green metadata

2015-12-23 Thread Carl Eugen Hoyos
Nicolas Derouineau  vitec.com> writes:

> Please find here enclosed a patch adding frame 
> side data information about green metadata.

Sorry if I missed something:
What is green metadata?

Carl Eugen

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


Re: [FFmpeg-devel] Merge commit 'b9ece15a01782b4f301c0c139d1d7b20f848914c'

2015-12-23 Thread Carl Eugen Hoyos
Nicolas George  nsup.org> writes:

> Le tridi 3 nivôse, an CCXXIV, Carl Eugen Hoyos a écrit :
> >> Unfortunately, from user's perspective this 
> >> introduces a regression: Could somebody explain 
> >> the advantages of this commit that justify the 
> >> pain?
> > Ping.
> 
> What are you talking about?

yuv4mpegpipe used to accept (only) rawvideo as codec. 
Bug reports indicate that changing this (without any 
explanation) breaks usage of the muxer.

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


Re: [FFmpeg-devel] [PATCH] avcodec/s302menc: set supported channel layouts by codec

2015-12-23 Thread Kieran Kunhya
On 22 December 2015 at 20:09, Paul B Mahol  wrote:
> On 12/22/15, Kieran Kunhya  wrote:
>> On 20 December 2015 at 00:14, Michael Niedermayer
>>  wrote:
>>> On Sat, Dec 19, 2015 at 09:35:19PM +0100, Paul B Mahol wrote:
 Signed-off-by: Paul B Mahol 
 ---
  libavcodec/s302menc.c | 5 +
  1 file changed, 5 insertions(+)

 diff --git a/libavcodec/s302menc.c b/libavcodec/s302menc.c
 index fbaa845..3706eba 100644
 --- a/libavcodec/s302menc.c
 +++ b/libavcodec/s302menc.c
 @@ -175,4 +175,9 @@ AVCodec ff_s302m_encoder = {

 AV_SAMPLE_FMT_NONE },
  .capabilities  = AV_CODEC_CAP_VARIABLE_FRAME_SIZE |
 AV_CODEC_CAP_EXPERIMENTAL,
  .supported_samplerates = (const int[]) { 48000, 0 },
 +.channel_layouts   = (const uint64_t[]) { AV_CH_LAYOUT_STEREO,
 +  AV_CH_LAYOUT_QUAD,
 +
 AV_CH_LAYOUT_5POINT1_BACK,
 +
 AV_CH_LAYOUT_5POINT1_BACK | AV_CH_LAYOUT_STEREO_DOWNMIX,
 +  0 },
>>>
>>> assuming the list is correct, the patch LGTM
>>
>> This list is incorrect, please revert the patch.
>
> This is what decoder sets. What it should be instead?

Nothing, it should accept audio irrespective of channel map.
Decoder is also wrong too but that's separate.

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


[FFmpeg-devel] [PATCH] Adding frame side data about green metadata

2015-12-23 Thread Nicolas Derouineau
Hello,
Please find here enclosed a patch adding frame side data information about 
green metadata.

Best regards,

Nicolas DEROUINEAU





  
 
   From c2959f8482065dc400d2e09002363fc8295d5400 Mon Sep 17 00:00:00 2001
From: Nicolas DEROUINEAU 
Date: Wed, 23 Dec 2015 12:19:03 +0100
Subject: [PATCH 2/2] Adding frame side data about green metadata - second part

---
 libavcodec/h264.c | 12 
 libavcodec/h264.h |  2 ++
 libavcodec/h264_sei.c |  3 +++
 libavutil/Makefile|  2 ++
 libavutil/frame.h |  7 +++
 libavutil/greenmetadata.c | 23 +++
 libavutil/greenmetadata.h | 38 ++
 7 files changed, 87 insertions(+)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 089a86f..7b28dd2 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -29,6 +29,7 @@
 
 #include "libavutil/avassert.h"
 #include "libavutil/display.h"
+#include "libavutil/greenmetadata.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/opt.h"
 #include "libavutil/stereo3d.h"
@@ -879,6 +880,17 @@ static void decode_postinit(H264Context *h, int setup_finished)
 }
 }
 
+if ( h->sei_green_metadata_present){
+AVFrameSideData *Greenmd = av_frame_new_side_data(cur->f, AV_FRAME_DATA_GREENMD,
+ sizeof(GreenMetaData));
+
+if(Greenmd){
+av_greenmetadata_set((uint8_t *)Greenmd->data, h->sei_green_metadata);
+av_freep(&h->sei_green_metadata);
+h->sei_green_metadata_present = 0;
+}
+}
+
 if (h->sei_reguserdata_afd_present) {
 AVFrameSideData *sd = av_frame_new_side_data(cur->f, AV_FRAME_DATA_AFD,
  sizeof(uint8_t));
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 5d9aecd..e6eb7c8 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -839,8 +839,10 @@ typedef struct H264Context {
 qpel_mc_func (*qpel_avg)[16];
 
 /*Green Metadata */
+int sei_green_metadata_present;
 GreenMetaData sei_green_metadata;
 
+
 } H264Context;
 
 extern const uint8_t ff_h264_chroma_qp[7][QP_MAX_NUM + 1]; ///< One chroma qp table for each possible bit depth (8-14).
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 0411b87..1ced948 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -43,6 +43,7 @@ void ff_h264_reset_sei(H264Context *h)
 h->sei_frame_packing_present=  0;
 h->sei_display_orientation_present = 0;
 h->sei_reguserdata_afd_present  =  0;
+h->sei_green_metadata_present = 0 ;
 
 h->a53_caption_size = 0;
 av_freep(&h->a53_caption);
@@ -401,6 +402,8 @@ static int decode_GreenMetadata(H264Context *h)
(float)h->sei_green_metadata.percent_six_tap_filtering/255,
(float)h->sei_green_metadata.percent_alpha_point_deblocking_instance/255);
 
+h->sei_green_metadata_present=1;
+
 }else if( h->sei_green_metadata.green_metadata_type==1){
 h->sei_green_metadata.xsd_metric_type=get_bits(&h->gb, 8);
 h->sei_green_metadata.xsd_metric_value=get_bits(&h->gb, 16);
diff --git a/libavutil/Makefile b/libavutil/Makefile
index bf8c713..c3cae53 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -29,6 +29,7 @@ HEADERS = adler32.h \
   fifo.h\
   file.h\
   frame.h   \
+  greenmetadata.h   \
   hash.h\
   hmac.h\
   imgutils.h\
@@ -105,6 +106,7 @@ OBJS = adler32.o\
float_dsp.o  \
fixed_dsp.o  \
frame.o  \
+   greenmetadata.o  \
hash.o   \
hmac.o   \
imgutils.o   \
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 9c6061a..a6a7fa7 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -112,6 +112,13 @@ enum AVFrameSideDataType {
  * enum AVAudioServiceType defined in avcodec.h.
  */
 AV_FRAME_DATA_AUDIO_SERVICE_TYPE,
+
+/**
+ * This side data must be associated with an video frame and corresponds to
+ * enum GreenMDataT

Re: [FFmpeg-devel] can't build the ffmpeg for iOS using the newest gas-preprocessor.pl

2015-12-23 Thread zhuhb
 

aarch64 2.7.2+ build on osx should work with the options listed at:

 

http://fate.ffmpeg.org/report.cgi?time=20151221193018&slot=arm64-osx10.9-app
le-clang-n2.7

 

arm:

 

http://fate.ffmpeg.org/report.cgi?time=20151221184824&slot=arm-osx10.9-apple
-clang-n2.7

 

maybe you can figure out which differences cause the failure ?

Although I change my configuration according to the website, I can't fix the
following critical error:

Unable to identify target architecture at /usr/local/bin/gas-preprocessor.pl
line 82.

How can I fix the problem? What is the reason that the compilation/build
system can't find the target architecture in the gas-preprocessor.pl?

 

 

 

 

 

[...]

-- 

Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

 

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

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


Re: [FFmpeg-devel] Merge commit 'b9ece15a01782b4f301c0c139d1d7b20f848914c'

2015-12-23 Thread Nicolas George
Le tridi 3 nivôse, an CCXXIV, Carl Eugen Hoyos a écrit :
>> Unfortunately, from user's perspective this 
>> introduces a regression: Could somebody explain 
>> the advantages of this commit that justify the 
>> pain?
> Ping.

What are you talking about?

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] Comments about patch

2015-12-23 Thread Mats Peterson

On 12/23/2015 12:13 PM, Clément Bœsch wrote:

On Wed, Dec 23, 2015 at 12:04:15PM +0100, Mats Peterson wrote:
[...]

I don't know what you mean by "a << 24" is undefined if a msb is set. I'm
doing exactly as it was done in mov.c before.


my bad, didn't see a was unsigned, you can ignore.

[...]



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



I guess so ;) I'm changing the other stuff you were complaining at here 
though.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Comments about patch

2015-12-23 Thread Mats Peterson

On 12/23/2015 12:09 PM, Clément Bœsch wrote:

On Wed, Dec 23, 2015 at 12:04:15PM +0100, Mats Peterson wrote:
[...]

OK. Regarding being the sole author, well I'm the one who has made the
patch. I don't understand what you mean.



It was a real question; I remember Martin being mentioned in the ticket,
and Carl Eugen working on a patch. Maybe some other people were involved,
so I was just making sure credits were properly attributed if necessary.

[...]



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



Yes, I know they have been involved in the initial attempts, but the 
majority of changes after that are made by me. I'm not trying to grab 
the honor whatsoever.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Comments about patch

2015-12-23 Thread Clément Bœsch
On Wed, Dec 23, 2015 at 12:04:15PM +0100, Mats Peterson wrote:
[...]
> I don't know what you mean by "a << 24" is undefined if a msb is set. I'm
> doing exactly as it was done in mov.c before.

my bad, didn't see a was unsigned, you can ignore.

[...]

-- 
Clément B.


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


Re: [FFmpeg-devel] Comments about patch

2015-12-23 Thread Clément Bœsch
On Wed, Dec 23, 2015 at 12:04:15PM +0100, Mats Peterson wrote:
[...]
> OK. Regarding being the sole author, well I'm the one who has made the
> patch. I don't understand what you mean.
> 

It was a real question; I remember Martin being mentioned in the ticket,
and Carl Eugen working on a patch. Maybe some other people were involved,
so I was just making sure credits were properly attributed if necessary.

[...]

-- 
Clément B.


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


Re: [FFmpeg-devel] Comments about patch

2015-12-23 Thread Mats Peterson

On 12/23/2015 11:55 AM, Clément Bœsch wrote:

On Wed, Dec 23, 2015 at 11:54:28AM +0100, Mats Peterson wrote:

Clement, can you please repeat what you said. I don't know where the hell
your post went.



http://ffmpeg.org/pipermail/ffmpeg-devel/2015-December/185664.html



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



OK. Regarding being the sole author, well I'm the one who has made the 
patch. I don't understand what you mean.


Regarding using ff_alloc_extradata(), it's not done at every place in 
that file, that's why I thought it would be OK to use the "normal" 
av_malloc().


I don't know what you mean by "a << 24" is undefined if a msb is set. 
I'm doing exactly as it was done in mov.c before.


"Usually you have 0 for success", well in this case it's not about 
success, I use "1" for having a palette, "0" for not having one.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Comments about patch

2015-12-23 Thread Clément Bœsch
On Wed, Dec 23, 2015 at 11:54:28AM +0100, Mats Peterson wrote:
> Clement, can you please repeat what you said. I don't know where the hell
> your post went.
> 

http://ffmpeg.org/pipermail/ffmpeg-devel/2015-December/185664.html

-- 
Clément B.


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


[FFmpeg-devel] Comments about patch

2015-12-23 Thread Mats Peterson
Clement, can you please repeat what you said. I don't know where the 
hell your post went.


Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavformat: palettized QuickTime video in Matroska, round 4

2015-12-23 Thread Clément Bœsch
On Wed, Dec 23, 2015 at 11:25:44AM +0100, Mats Peterson wrote:
[...]
> From: Mats Peterson 

So are you the sole author of this?

> Date: Wed, 23 Dec 2015 11:19:06 +0100
> Subject: [PATCH] libavformat: palettized QuickTime video in Matroska, round 4
> 

Use "[PATCH v4]" instead of the suffix as you did, otherwise it will end
up in the final commit message. Also, correct prefix would be "lavf: ..."

> ---
>  libavformat/Makefile  |1 +
>  libavformat/matroskadec.c |   30 ++-
>  libavformat/mov.c |   92 -
>  libavformat/qtpalette.c   |  124 
> +
>  libavformat/qtpalette.h   |4 ++
>  5 files changed, 178 insertions(+), 73 deletions(-)
>  create mode 100644 libavformat/qtpalette.c
> 
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index 110e9e3..e03c73e 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -18,6 +18,7 @@ OBJS = allformats.o \
> mux.o\
> options.o\
> os_support.o \
> +   qtpalette.o  \
> riff.o   \
> sdp.o\
> url.o\
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index c574749..28bc44f 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -64,6 +64,8 @@
>  #include 
>  #endif
>  
> +#include "qtpalette.h"
> +
>  typedef enum {
>  EBML_NONE,
>  EBML_UINT,
> @@ -312,6 +314,9 @@ typedef struct MatroskaDemuxContext {
>  
>  /* WebM DASH Manifest live flag/ */
>  int is_live;
> +

> +uint32_t palette[256];

nit: AVPALETTE_COUNT

[...]
> +if (ff_get_qtpalette(codec_id, track->codec_priv.data + 16,
> +NULL, matroska->palette)) {

nit: vertical align, more below

> +bit_depth &= 0x1F;
> +/* Behave like V_MS/VFW/FOURCC; copy the palette to
> + * extradata */

> +if (! (extradata = av_malloc(AVPALETTE_SIZE)))
> +return AVERROR(ENOMEM);

Use ff_alloc_extradata() or pad your extradata with
AV_INPUT_BUFFER_PADDING_SIZE

also, no space after '!', more below

[...]
> diff --git a/libavformat/qtpalette.c b/libavformat/qtpalette.c
> new file mode 100644
> index 000..90268e1
> --- /dev/null
> +++ b/libavformat/qtpalette.c
> @@ -0,0 +1,124 @@
> +/*
> + * QuickTime palette handling
> + * Copyright (c) 2001 Fabrice Bellard
> + * Copyright (c) 2009 Baptiste Coudurier  dot com>
> + * Copyright (c) 2015 Mats Peterson
> + *
> + * 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 

> +#include 

Don't you just need stdint.h?

> +
> +#include "libavcodec/avcodec.h"

> +#include "libavformat/avio.h"

This file is already in libavformat.

> +#include "libavutil/intreadwrite.h"
> +#include "qtpalette.h"
> +
> +int ff_get_qtpalette(int codec_id, uint8_t *stsd, AVIOContext *pb,
> +uint32_t *palette)

stsd data isn't touched, so you can mark it const

[...]
> +if ((color_start <= 255) && (color_end <= 255)) {
> +uint8_t *p = stsd + 78;
> +for (i = color_start; i <= color_end; i++) {
> +/* each A, R, G, or B component is 16 bits;
> + * only use the top 8 bits */
> +if (pb) {
> +a = avio_r8(pb);
> +avio_r8(pb);
> +r = avio_r8(pb);
> +avio_r8(pb);
> +g = avio_r8(pb);
> +avio_r8(pb);
> +b = avio_r8(pb);
> +avio_r8(pb);
> +} else {

> +a = *p++; p++;
> +r = *p++; p++;
> +g = *p++; p++;
> +b = *p++; p++;

I see no read boundary checks, and it frighten me.

> +}

> +palette[i] = (a << 24 ) | (r << 16) | (g << 8) | (b);

a << 24 is undefined if a msb is set. Try git grep '#define RGBA('.

> +}
> +}
> +}
>

[FFmpeg-devel] [PATCH] libavformat: palettized QuickTime video in Matroska, round 4

2015-12-23 Thread Mats Peterson
Here is another update of my patch for palettized QuickTime video in 
Matroska.


Only read the first 86 - 16 (16 bytes are already read in 
ff_mov_read_stsd_entries()) bytes into the 'stsd' variable in 
mov_parse_stsd_video() in mov.c, since we are going to read the palette 
from the file in ff_get_qtpalette() anyway. Remove the unnecessary 
'size' parameter from mov_parse_stsd_video().


Original explanation of the patch follows:

Palettized QuickTime video in Matroska has hitherto not been recognized 
whatsoever, and the "palette" used has been completely random.


The patch for matroskadec.c fixes this issue by adding a palette side 
data packet in matroska_deliver_packet(), much in the same way as it's 
done in mov.c.


The change to mov.c consists mainly of moving the palette handling from 
the mov_parse_stsd_video() function to a new ff_get_qtpalette() function 
in the new file qtpalette.c, which is shared by both matroskadec.c and 
mov.c.


In matroskadec.c, I'm also putting the palette in 'extradata', like it's 
done for V_MS/VFW/FOURCC; this is a requirement in order for MPlayer to 
recognize the palette.


--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From f0b604a685547a038daac8f75450e6dc84c5787e Mon Sep 17 00:00:00 2001
From: Mats Peterson 
Date: Wed, 23 Dec 2015 11:19:06 +0100
Subject: [PATCH] libavformat: palettized QuickTime video in Matroska, round 4

---
 libavformat/Makefile  |1 +
 libavformat/matroskadec.c |   30 ++-
 libavformat/mov.c |   92 -
 libavformat/qtpalette.c   |  124 +
 libavformat/qtpalette.h   |4 ++
 5 files changed, 178 insertions(+), 73 deletions(-)
 create mode 100644 libavformat/qtpalette.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 110e9e3..e03c73e 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -18,6 +18,7 @@ OBJS = allformats.o \
mux.o\
options.o\
os_support.o \
+   qtpalette.o  \
riff.o   \
sdp.o\
url.o\
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index c574749..28bc44f 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -64,6 +64,8 @@
 #include 
 #endif
 
+#include "qtpalette.h"
+
 typedef enum {
 EBML_NONE,
 EBML_UINT,
@@ -312,6 +314,9 @@ typedef struct MatroskaDemuxContext {
 
 /* WebM DASH Manifest live flag/ */
 int is_live;
+
+uint32_t palette[256];
+int has_palette;
 } MatroskaDemuxContext;
 
 typedef struct MatroskaBlock {
@@ -1856,7 +1861,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
 fourcc   = st->codec->codec_tag;
 extradata_offset = FFMIN(track->codec_priv.size, 18);
 } else if (!strcmp(track->codec_id, "A_QUICKTIME")
-   && (track->codec_priv.size >= 86)
+   && (track->codec_priv.size >= 36)
&& (track->codec_priv.data)) {
 fourcc = AV_RL32(track->codec_priv.data + 4);
 codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc);
@@ -1881,6 +1886,20 @@ static int matroska_parse_tracks(AVFormatContext *s)
 av_log(matroska->ctx, AV_LOG_ERROR,
"mov FourCC not found %s.\n", buf);
 }
+if (track->codec_priv.size >= 86) {
+bit_depth = AV_RB16(track->codec_priv.data + 82);
+if (ff_get_qtpalette(codec_id, track->codec_priv.data + 16,
+NULL, matroska->palette)) {
+bit_depth &= 0x1F;
+/* Behave like V_MS/VFW/FOURCC; copy the palette to
+ * extradata */
+if (! (extradata = av_malloc(AVPALETTE_SIZE)))
+return AVERROR(ENOMEM);
+memcpy(extradata, matroska->palette, AVPALETTE_SIZE);
+extradata_size = AVPALETTE_SIZE;
+matroska->has_palette = 1;
+}
+}
 } else if (codec_id == AV_CODEC_ID_PCM_S16BE) {
 switch (track->audio.bitdepth) {
 case  8:
@@ -2326,6 +2345,15 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska,
 if (matroska->num_packets > 0) {
 memcpy(pkt, matroska->packets[0], sizeof(AVPacket));
 av_freep(&matroska->packets[0]);
+if (matroska->has_palette) {
+uint8_t *pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
+if (!pal) {
+av_log(matroska->ctx, AV_LOG_ERROR, "Cannot append palette to packet\n");
+} else {
+memcpy(pal, matroska->palette, AVPALETTE_SIZE);
+}
+matroska->has_palette = 0;
+}
 if (matroska->num_packets > 1) {
 void *newpackets;
 memmo