Re: [FFmpeg-devel] [PATCH 04/11] avcodec/zmbvenc: use log2 instead of log()/M_LN2

2015-10-29 Thread Ganesh Ajjanagadde
On Thu, Oct 29, 2015 at 9:25 AM, Michael Niedermayer
 wrote:
> On Thu, Oct 29, 2015 at 12:20:02AM -0400, Ganesh Ajjanagadde wrote:
>> This is likely more precise and conveys the intent better.
>>
>> Signed-off-by: Ganesh Ajjanagadde 
>> ---
>>  libavcodec/zmbvenc.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/zmbvenc.c b/libavcodec/zmbvenc.c
>> index df06e37..e832bed 100644
>> --- a/libavcodec/zmbvenc.c
>> +++ b/libavcodec/zmbvenc.c
>> @@ -277,7 +277,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
>>  int lvl = 9;
>>
>>  for(i=1; i<256; i++)
>> -score_tab[i]= -i * log(i/(double)(ZMBV_BLOCK*ZMBV_BLOCK)) * 
>> (256/M_LN2);
>> +score_tab[i]= -i * log2(i/(double)(ZMBV_BLOCK*ZMBV_BLOCK)) * 256;
>
> Interrestingly this changes the output from
> ffmpeg -i matrixbench_mpeg2.mpg -vcodec zmbv -frames 30  -an -f framecrc -
> for a few frames

not too surprising, there are bit changes for many inputs when one
moves from log/ to log2 etc. See e.g my reply to wm4's original
comments.

>
> the code change looks good though

pushed, thanks.

>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Rewriting code that is poorly written but fully understood is good.
> Rewriting code that one doesnt understand is a sign that one is less smart
> then the original author, trying to rewrite it will not make it better.
>
> ___
> 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 04/11] avcodec/zmbvenc: use log2 instead of log()/M_LN2

2015-10-29 Thread Michael Niedermayer
On Thu, Oct 29, 2015 at 12:20:02AM -0400, Ganesh Ajjanagadde wrote:
> This is likely more precise and conveys the intent better.
> 
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavcodec/zmbvenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/zmbvenc.c b/libavcodec/zmbvenc.c
> index df06e37..e832bed 100644
> --- a/libavcodec/zmbvenc.c
> +++ b/libavcodec/zmbvenc.c
> @@ -277,7 +277,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
>  int lvl = 9;
>  
>  for(i=1; i<256; i++)
> -score_tab[i]= -i * log(i/(double)(ZMBV_BLOCK*ZMBV_BLOCK)) * 
> (256/M_LN2);
> +score_tab[i]= -i * log2(i/(double)(ZMBV_BLOCK*ZMBV_BLOCK)) * 256;

Interrestingly this changes the output from
ffmpeg -i matrixbench_mpeg2.mpg -vcodec zmbv -frames 30  -an -f framecrc -
for a few frames

the code change looks good though

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

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.


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


[FFmpeg-devel] [PATCH 04/11] avcodec/zmbvenc: use log2 instead of log()/M_LN2

2015-10-28 Thread Ganesh Ajjanagadde
This is likely more precise and conveys the intent better.

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

diff --git a/libavcodec/zmbvenc.c b/libavcodec/zmbvenc.c
index df06e37..e832bed 100644
--- a/libavcodec/zmbvenc.c
+++ b/libavcodec/zmbvenc.c
@@ -277,7 +277,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
 int lvl = 9;
 
 for(i=1; i<256; i++)
-score_tab[i]= -i * log(i/(double)(ZMBV_BLOCK*ZMBV_BLOCK)) * 
(256/M_LN2);
+score_tab[i]= -i * log2(i/(double)(ZMBV_BLOCK*ZMBV_BLOCK)) * 256;
 
 c->avctx = avctx;
 
-- 
2.6.2

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