[FFmpeg-devel] [PATCH] avodec/hevcdsp: optimize pixel comparison in sao_edge_filter

Michael Niedermayer michaelni at gmx.at
Mon Feb 16 21:45:28 CET 2015


On Mon, Feb 16, 2015 at 05:06:20PM -0300, James Almer wrote:
> GCC 4.9.2 on a Core i5-4200U @ 1.60GHz, Linux x86_64
> 
> Before
> 715487 decicycles in sao_edge_filter_8, 262144 runs, 0 skips
> 
> After
> 672104 decicycles in sao_edge_filter_8, 262144 runs, 0 skips
> 
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> Not like the C versions of these functions matter to a CPU like the above, but 
> this could very well mean a couple extra fps for pre-SSSE3 CPUs with 8bit hevc 
> content.
> 
> Thanks to Zhaoxiu Zeng for inspiring this :P
> 
>  libavcodec/hevcdsp_template.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c
> index 9ce7bf2..aeb142c 100644
> --- a/libavcodec/hevcdsp_template.c
> +++ b/libavcodec/hevcdsp_template.c
> @@ -325,7 +325,7 @@ static void FUNC(sao_band_filter_0)(uint8_t *_dst, uint8_t *_src,
>      }
>  }
>  
> -#define CMP(a, b) ((a) > (b) ? 1 : ((a) == (b) ? 0 : -1))
> +#define CMP(a, b) ((a > b) - (a < b))

LGTM

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

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150216/654023c7/attachment.asc>


More information about the ffmpeg-devel mailing list