diff mbox series

[FFmpeg-devel,24/25] avcodec/fraps: Use unchecked bitstream reader

Message ID 20200926102804.228089-24-andreas.rheinhardt@gmail.com
State Accepted
Commit bc6838deb99ecd649ed483ed1ce657c70830b0af
Headers show
Series [FFmpeg-devel,01/25] avcodec/photocd: Simplify parsing Huffman tables a bit | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 26, 2020, 10:28 a.m. UTC
The fraps decoder already checked for overreads manually (and errored
out in this scenario), yet it still enabled implicit checks, leading to
worse performance and more code size.

This commit disables the implicit bitstream reader checks. For the
sample [1] this improves performance from 195105896 to 155851561
decicycles for Clang 10 and from 222801887 to 168270467 decicycles when
compiled with GCC 9.3. These values are the average of 10 runs each
looping ten times over the input.

[1]: samples.ffmpeg.org/ffmpeg-bugs/trac/ticket2593/fraps_flv1_decoding_errors.avi

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/fraps.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Paul B Mahol Sept. 26, 2020, 10:45 a.m. UTC | #1
On Sat, Sep 26, 2020 at 12:28:03PM +0200, Andreas Rheinhardt wrote:
> The fraps decoder already checked for overreads manually (and errored
> out in this scenario), yet it still enabled implicit checks, leading to
> worse performance and more code size.
> 
> This commit disables the implicit bitstream reader checks. For the
> sample [1] this improves performance from 195105896 to 155851561
> decicycles for Clang 10 and from 222801887 to 168270467 decicycles when
> compiled with GCC 9.3. These values are the average of 10 runs each
> looping ten times over the input.
> 
> [1]: samples.ffmpeg.org/ffmpeg-bugs/trac/ticket2593/fraps_flv1_decoding_errors.avi

probably ok

> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/fraps.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c
> index 7a7673f73f..00fd63ffec 100644
> --- a/libavcodec/fraps.c
> +++ b/libavcodec/fraps.c
> @@ -31,6 +31,7 @@
>   * Version 2 files support by Konstantin Shishkov
>   */
>  
> +#define UNCHECKED_BITSTREAM_READER 1
>  #include "avcodec.h"
>  #include "get_bits.h"
>  #include "huffman.h"
> -- 
> 2.25.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c
index 7a7673f73f..00fd63ffec 100644
--- a/libavcodec/fraps.c
+++ b/libavcodec/fraps.c
@@ -31,6 +31,7 @@ 
  * Version 2 files support by Konstantin Shishkov
  */
 
+#define UNCHECKED_BITSTREAM_READER 1
 #include "avcodec.h"
 #include "get_bits.h"
 #include "huffman.h"