diff libavcodec/arm/mpegvideo_armv5te.c @ 2:897f711a7157

rearrange to work with autoconf
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Tue, 25 Sep 2012 15:55:33 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libavcodec/arm/mpegvideo_armv5te.c	Tue Sep 25 15:55:33 2012 +0200
     1.3 @@ -0,0 +1,101 @@
     1.4 +/*
     1.5 + * Optimization of some functions from mpegvideo.c for armv5te
     1.6 + * Copyright (c) 2007 Siarhei Siamashka <ssvb@users.sourceforge.net>
     1.7 + *
     1.8 + * This file is part of FFmpeg.
     1.9 + *
    1.10 + * FFmpeg is free software; you can redistribute it and/or
    1.11 + * modify it under the terms of the GNU Lesser General Public
    1.12 + * License as published by the Free Software Foundation; either
    1.13 + * version 2.1 of the License, or (at your option) any later version.
    1.14 + *
    1.15 + * FFmpeg is distributed in the hope that it will be useful,
    1.16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.18 + * Lesser General Public License for more details.
    1.19 + *
    1.20 + * You should have received a copy of the GNU Lesser General Public
    1.21 + * License along with FFmpeg; if not, write to the Free Software
    1.22 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
    1.23 + */
    1.24 +
    1.25 +#include "libavcodec/avcodec.h"
    1.26 +#include "libavcodec/dsputil.h"
    1.27 +#include "libavcodec/mpegvideo.h"
    1.28 +#include "mpegvideo_arm.h"
    1.29 +
    1.30 +void ff_dct_unquantize_h263_armv5te(DCTELEM *block, int qmul, int qadd, int count);
    1.31 +
    1.32 +#ifdef ENABLE_ARM_TESTS
    1.33 +/**
    1.34 + * h263 dequantizer supplementary function, it is performance critical and needs to
    1.35 + * have optimized implementations for each architecture. Is also used as a reference
    1.36 + * implementation in regression tests
    1.37 + */
    1.38 +static inline void dct_unquantize_h263_helper_c(DCTELEM *block, int qmul, int qadd, int count)
    1.39 +{
    1.40 +    int i, level;
    1.41 +    for (i = 0; i < count; i++) {
    1.42 +        level = block[i];
    1.43 +        if (level) {
    1.44 +            if (level < 0) {
    1.45 +                level = level * qmul - qadd;
    1.46 +            } else {
    1.47 +                level = level * qmul + qadd;
    1.48 +            }
    1.49 +            block[i] = level;
    1.50 +        }
    1.51 +    }
    1.52 +}
    1.53 +#endif
    1.54 +
    1.55 +static void dct_unquantize_h263_intra_armv5te(MpegEncContext *s,
    1.56 +                                  DCTELEM *block, int n, int qscale)
    1.57 +{
    1.58 +    int level, qmul, qadd;
    1.59 +    int nCoeffs;
    1.60 +
    1.61 +    assert(s->block_last_index[n]>=0);
    1.62 +
    1.63 +    qmul = qscale << 1;
    1.64 +
    1.65 +    if (!s->h263_aic) {
    1.66 +        if (n < 4)
    1.67 +            level = block[0] * s->y_dc_scale;
    1.68 +        else
    1.69 +            level = block[0] * s->c_dc_scale;
    1.70 +        qadd = (qscale - 1) | 1;
    1.71 +    }else{
    1.72 +        qadd = 0;
    1.73 +        level = block[0];
    1.74 +    }
    1.75 +    if(s->ac_pred)
    1.76 +        nCoeffs=63;
    1.77 +    else
    1.78 +        nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
    1.79 +
    1.80 +    ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1);
    1.81 +    block[0] = level;
    1.82 +}
    1.83 +
    1.84 +static void dct_unquantize_h263_inter_armv5te(MpegEncContext *s,
    1.85 +                                  DCTELEM *block, int n, int qscale)
    1.86 +{
    1.87 +    int qmul, qadd;
    1.88 +    int nCoeffs;
    1.89 +
    1.90 +    assert(s->block_last_index[n]>=0);
    1.91 +
    1.92 +    qadd = (qscale - 1) | 1;
    1.93 +    qmul = qscale << 1;
    1.94 +
    1.95 +    nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
    1.96 +
    1.97 +    ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1);
    1.98 +}
    1.99 +
   1.100 +void MPV_common_init_armv5te(MpegEncContext *s)
   1.101 +{
   1.102 +    s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_armv5te;
   1.103 +    s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_armv5te;
   1.104 +}