Re: [FFmpeg-devel] [PATCH 3/3] lavc/wmadec: replace pow by faster functions

2016-01-22 Thread Ganesh Ajjanagadde
On Fri, Jan 22, 2016 at 4:45 PM, Paul B Mahol  wrote:
> On 1/22/16, Ganesh Ajjanagadde  wrote:
>> On Sat, Jan 16, 2016 at 12:31 AM, Ganesh Ajjanagadde
>>  wrote:
>>> Further speedups possible by getting rid of exp2f...
>>>
>>> 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 da54182..1a84323 100644
>>> --- a/libavcodec/wmadec.c
>>> +++ b/libavcodec/wmadec.c
>>> @@ -35,6 +35,7 @@
>>>
>>>  #include "libavutil/attributes.h"
>>>  #include "libavutil/internal.h"
>>> +#include "libavutil/libm.h"
>>>
>>>  #include "avcodec.h"
>>>  #include "internal.h"
>>> @@ -164,7 +165,7 @@ static av_cold void
>>> wma_lsp_to_curve_init(WMACodecContext *s, int frame_len)
>>>  /* tables for x^-0.25 computation */
>>>  for (i = 0; i < 256; i++) {
>>>  e = i - 126;
>>> -s->lsp_pow_e_table[i] = pow(2.0, e * -0.25);
>>> +s->lsp_pow_e_table[i] = exp2f(e * -0.25);
>>>  }
>>>
>>>  /* NOTE: these two tables are needed to avoid two operations in
>>> @@ -173,7 +174,7 @@ static av_cold void
>>> wma_lsp_to_curve_init(WMACodecContext *s, int frame_len)
>>>  for (i = (1 << LSP_POW_BITS) - 1; i >= 0; i--) {
>>>  m  = (1 << LSP_POW_BITS) + i;
>>>  a  = (float) m * (0.5 / (1 << LSP_POW_BITS));
>>> -a  = pow(a, -0.25);
>>> +a  = 1/sqrt(sqrt(a));
>>>  s->lsp_pow_m_table1[i] = 2 * a - b;
>>>  s->lsp_pow_m_table2[i] = b - a;
>>>  b  = a;
>>> --
>>> 2.7.0
>>>
>>
>> ping, note that second can be made sqrtf(sqrtf(x)) at some error which
>> I deliberately avoided here.
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
> ok, if fate passes.

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


Re: [FFmpeg-devel] [PATCH 3/3] lavc/wmadec: replace pow by faster functions

2016-01-22 Thread Paul B Mahol
On 1/22/16, Ganesh Ajjanagadde  wrote:
> On Sat, Jan 16, 2016 at 12:31 AM, Ganesh Ajjanagadde
>  wrote:
>> Further speedups possible by getting rid of exp2f...
>>
>> 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 da54182..1a84323 100644
>> --- a/libavcodec/wmadec.c
>> +++ b/libavcodec/wmadec.c
>> @@ -35,6 +35,7 @@
>>
>>  #include "libavutil/attributes.h"
>>  #include "libavutil/internal.h"
>> +#include "libavutil/libm.h"
>>
>>  #include "avcodec.h"
>>  #include "internal.h"
>> @@ -164,7 +165,7 @@ static av_cold void
>> wma_lsp_to_curve_init(WMACodecContext *s, int frame_len)
>>  /* tables for x^-0.25 computation */
>>  for (i = 0; i < 256; i++) {
>>  e = i - 126;
>> -s->lsp_pow_e_table[i] = pow(2.0, e * -0.25);
>> +s->lsp_pow_e_table[i] = exp2f(e * -0.25);
>>  }
>>
>>  /* NOTE: these two tables are needed to avoid two operations in
>> @@ -173,7 +174,7 @@ static av_cold void
>> wma_lsp_to_curve_init(WMACodecContext *s, int frame_len)
>>  for (i = (1 << LSP_POW_BITS) - 1; i >= 0; i--) {
>>  m  = (1 << LSP_POW_BITS) + i;
>>  a  = (float) m * (0.5 / (1 << LSP_POW_BITS));
>> -a  = pow(a, -0.25);
>> +a  = 1/sqrt(sqrt(a));
>>  s->lsp_pow_m_table1[i] = 2 * a - b;
>>  s->lsp_pow_m_table2[i] = b - a;
>>  b  = a;
>> --
>> 2.7.0
>>
>
> ping, note that second can be made sqrtf(sqrtf(x)) at some error which
> I deliberately avoided here.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

ok, if fate passes.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/3] lavc/wmadec: replace pow by faster functions

2016-01-21 Thread Ganesh Ajjanagadde
On Sat, Jan 16, 2016 at 12:31 AM, Ganesh Ajjanagadde
 wrote:
> Further speedups possible by getting rid of exp2f...
>
> 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 da54182..1a84323 100644
> --- a/libavcodec/wmadec.c
> +++ b/libavcodec/wmadec.c
> @@ -35,6 +35,7 @@
>
>  #include "libavutil/attributes.h"
>  #include "libavutil/internal.h"
> +#include "libavutil/libm.h"
>
>  #include "avcodec.h"
>  #include "internal.h"
> @@ -164,7 +165,7 @@ static av_cold void wma_lsp_to_curve_init(WMACodecContext 
> *s, int frame_len)
>  /* tables for x^-0.25 computation */
>  for (i = 0; i < 256; i++) {
>  e = i - 126;
> -s->lsp_pow_e_table[i] = pow(2.0, e * -0.25);
> +s->lsp_pow_e_table[i] = exp2f(e * -0.25);
>  }
>
>  /* NOTE: these two tables are needed to avoid two operations in
> @@ -173,7 +174,7 @@ static av_cold void wma_lsp_to_curve_init(WMACodecContext 
> *s, int frame_len)
>  for (i = (1 << LSP_POW_BITS) - 1; i >= 0; i--) {
>  m  = (1 << LSP_POW_BITS) + i;
>  a  = (float) m * (0.5 / (1 << LSP_POW_BITS));
> -a  = pow(a, -0.25);
> +a  = 1/sqrt(sqrt(a));
>  s->lsp_pow_m_table1[i] = 2 * a - b;
>  s->lsp_pow_m_table2[i] = b - a;
>  b  = a;
> --
> 2.7.0
>

ping, note that second can be made sqrtf(sqrtf(x)) at some error which
I deliberately avoided here.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 3/3] lavc/wmadec: replace pow by faster functions

2016-01-15 Thread Ganesh Ajjanagadde
Further speedups possible by getting rid of exp2f...

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 da54182..1a84323 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -35,6 +35,7 @@
 
 #include "libavutil/attributes.h"
 #include "libavutil/internal.h"
+#include "libavutil/libm.h"
 
 #include "avcodec.h"
 #include "internal.h"
@@ -164,7 +165,7 @@ static av_cold void wma_lsp_to_curve_init(WMACodecContext 
*s, int frame_len)
 /* tables for x^-0.25 computation */
 for (i = 0; i < 256; i++) {
 e = i - 126;
-s->lsp_pow_e_table[i] = pow(2.0, e * -0.25);
+s->lsp_pow_e_table[i] = exp2f(e * -0.25);
 }
 
 /* NOTE: these two tables are needed to avoid two operations in
@@ -173,7 +174,7 @@ static av_cold void wma_lsp_to_curve_init(WMACodecContext 
*s, int frame_len)
 for (i = (1 << LSP_POW_BITS) - 1; i >= 0; i--) {
 m  = (1 << LSP_POW_BITS) + i;
 a  = (float) m * (0.5 / (1 << LSP_POW_BITS));
-a  = pow(a, -0.25);
+a  = 1/sqrt(sqrt(a));
 s->lsp_pow_m_table1[i] = 2 * a - b;
 s->lsp_pow_m_table2[i] = b - a;
 b  = a;
-- 
2.7.0

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