[FFmpeg-devel] [PATCH 1/2] proresenc_anatoliy: use tables in proresdata.c instead of redefining them

Michael Niedermayer michaelni at gmx.at
Fri Jul 18 04:18:09 CEST 2014


On Thu, Jul 17, 2014 at 06:04:06PM -0700, Timothy Gu wrote:
> Signed-off-by: Timothy Gu <timothygu99 at gmail.com>
> ---
>  libavcodec/Makefile             |  4 ++--
>  libavcodec/proresenc_anatoliy.c | 43 ++++++++++++++---------------------------
>  2 files changed, 16 insertions(+), 31 deletions(-)

it appears this makes the code slightly slower

before patch:
233505 decicycles in coeffs, 1048576 runs, 0 skips
233491 decicycles in coeffs, 1048576 runs, 0 skips
233492 decicycles in coeffs, 1048575 runs, 1 skips

with patch:
234461 decicycles in coeffs, 1048576 runs, 0 skips
234602 decicycles in coeffs, 1048576 runs, 0 skips
234546 decicycles in coeffs, 1048576 runs, 0 skips

tested with:
diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index b8531cd..4f00b5c 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -290,10 +290,10 @@ static int encode_slice_plane(AVCodecContext *avctx, int mb_count,

     blocks_per_slice = mb_count << (2 - chroma);
     init_put_bits(&pb, buf, buf_size << 3);
-
+START_TIMER
     encode_dc_coeffs(&pb, blocks, blocks_per_slice, qmat);
     encode_ac_coeffs(avctx, &pb, blocks, blocks_per_slice, qmat);
-
+STOP_TIMER("coeffs")
     flush_put_bits(&pb);
     return put_bits_ptr(&pb) - pb.buf;
 }

and
./ffmpeg -y -i matrixbench_mpeg2.mpg -an -threads 1 -vcodec prores -f null -


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

Old school: Use the lowest level language in which you can solve the problem
            conveniently.
New school: Use the highest level language in which the latest supercomputer
            can solve the problem without the user falling asleep waiting.
-------------- 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/20140718/4ceb623f/attachment.asc>


More information about the ffmpeg-devel mailing list