[FFmpeg-devel] [PATCH] Make VP3/Theora Decoder Much Faster

Michael Niedermayer michaelni
Wed Dec 2 12:58:25 CET 2009


On Wed, Dec 02, 2009 at 12:41:25AM -0800, Jason Garrett-Glaser wrote:
> Another optimization patch attached.  Should be pretty obvious what it does.
[...]
> @@ -1366,7 +1366,7 @@
>  
>                      /* check for outranging on the [ul u l] and
>                       * [ul u ur l] predictors */
> -                    if ((transform == 13) || (transform == 15)) {
> +                    if ((transform == 15) || (transform == 13)) {
>                          if (FFABS(predicted_dc - vu) > 128)
>                              predicted_dc = vu;
>                          else if (FFABS(predicted_dc - vl) > 128)

is that faster?

besides it could be simplified to
(transform&~2) == 13


> @@ -1641,42 +1641,45 @@
>          for (y = 0; y < height; y++) {
>  
>              for (x = 0; x < width; x++) {
> -                /* do not perform left edge filter for left columns frags */
> -                if ((x > 0) &&
> -                    (s->all_fragments[fragment].coding_method != MODE_COPY)) {
> -                    s->dsp.vp3_h_loop_filter(
> -                        plane_data + s->all_fragments[fragment].first_pixel,
> -                        stride, bounding_values);
> -                }
> +                /* This code basically just deblocks on the edges of coded blocks.
> +                 * However, it has to be much more complicated because of the
> +                 * braindamaged deblock ordering used in VP3/Theora. Order matters
> +                 * because some pixels get filtered twice. */
> +                if( s->all_fragments[fragment].coding_method != MODE_COPY )
> +                {
> +                    /* do not perform left edge filter for left columns frags */
> +                    if (x > 0) {
> +                        s->dsp.vp3_h_loop_filter(
> +                            plane_data + s->all_fragments[fragment].first_pixel,
> +                            stride, bounding_values);
> +                    }
>  
> -                /* do not perform top edge filter for top row fragments */
> -                if ((y > 0) &&
> -                    (s->all_fragments[fragment].coding_method != MODE_COPY)) {
> -                    s->dsp.vp3_v_loop_filter(
> -                        plane_data + s->all_fragments[fragment].first_pixel,
> -                        stride, bounding_values);
> -                }
> +                    /* do not perform top edge filter for top row fragments */
> +                    if (y > 0) {
> +                        s->dsp.vp3_v_loop_filter(
> +                            plane_data + s->all_fragments[fragment].first_pixel,
> +                            stride, bounding_values);
> +                    }
>  
> -                /* do not perform right edge filter for right column
> -                 * fragments or if right fragment neighbor is also coded
> -                 * in this frame (it will be filtered in next iteration) */
> -                if ((x < width - 1) &&
> -                    (s->all_fragments[fragment].coding_method != MODE_COPY) &&
> -                    (s->all_fragments[fragment + 1].coding_method == MODE_COPY)) {
> -                    s->dsp.vp3_h_loop_filter(
> -                        plane_data + s->all_fragments[fragment + 1].first_pixel,
> -                        stride, bounding_values);
> -                }
> +                    /* do not perform right edge filter for right column
> +                     * fragments or if right fragment neighbor is also coded
> +                     * in this frame (it will be filtered in next iteration) */
> +                    if ((x < width - 1) &&
> +                        (s->all_fragments[fragment + 1].coding_method == MODE_COPY)) {
> +                        s->dsp.vp3_h_loop_filter(
> +                            plane_data + s->all_fragments[fragment + 1].first_pixel,
> +                            stride, bounding_values);
> +                    }

no complaint from me as i dont have to review it but this would be
more readable without the reindention

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

Avoid a single point of failure, be that a person or equipment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091202/80755205/attachment.pgp>



More information about the ffmpeg-devel mailing list