[FFmpeg-devel] [PATCH] Optimize QTRLE encoding

Paul B Mahol onemda at gmail.com
Tue Feb 12 16:49:29 CET 2013


On 2/12/13, Malcolm Bechard <malcolm.bechard at gmail.com> wrote:
> Attached is the base64 encoded patch file.
> The goal is to remove this loop which causes a 1->127 loop for every pixel
>
> for (j = 1; j <= limit; j++) {
>     if (s->length_table[i + j] + temp_cost < total_bulk_cost) {
>         /* We have found a better bulk copy ... */
>         total_bulk_cost = s->length_table[i + j] + temp_cost;
>         bulkcount = j;
>     }
>     temp_cost += s->pixel_size;
> }
>
> Output video files should be identical to the old algorithm in both size
> and binary content.
>
> Performance gains may not be as strong on gcc since I was comparing (old
> code) gcc vs. (new code) VS2010 in my initial comparisons. I expect 2-4x
> speedups with gcc.
>
> Feedback is appreciated since this is my first patch.
>

It goes from 1.20 to 0.55 with clang here with this unrealistic sample:

ffmpeg -v 0 -y -f lavfi -i testsrc -vcodec qtrle -frames 200 -f null -


More information about the ffmpeg-devel mailing list