Mercurial > libavcodec.hg
annotate arm/mpegvideo_armv5te.c @ 12530:63edd10ad4bc libavcodec tip
Try to fix crashes introduced by r25218
r25218 made assumptions about the existence of past reference frames that
weren't necessarily true.
| author | darkshikari |
|---|---|
| date | Tue, 28 Sep 2010 09:06:22 +0000 |
| parents | 58c4d851d1c7 |
| children |
| rev | line source |
|---|---|
| 4341 | 1 /* |
| 2 * Optimization of some functions from mpegvideo.c for armv5te | |
| 3 * Copyright (c) 2007 Siarhei Siamashka <ssvb@users.sourceforge.net> | |
| 4 * | |
| 5 * This file is part of FFmpeg. | |
| 6 * | |
| 7 * FFmpeg is free software; you can redistribute it and/or | |
| 8 * modify it under the terms of the GNU Lesser General Public | |
| 9 * License as published by the Free Software Foundation; either | |
| 10 * version 2.1 of the License, or (at your option) any later version. | |
| 11 * | |
| 12 * FFmpeg is distributed in the hope that it will be useful, | |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 15 * Lesser General Public License for more details. | |
| 16 * | |
| 17 * You should have received a copy of the GNU Lesser General Public | |
| 18 * License along with FFmpeg; if not, write to the Free Software | |
| 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 */ | |
| 21 | |
| 6763 | 22 #include "libavcodec/avcodec.h" |
| 23 #include "libavcodec/dsputil.h" | |
| 24 #include "libavcodec/mpegvideo.h" | |
| 11397 | 25 #include "mpegvideo_arm.h" |
| 4341 | 26 |
| 8250 | 27 void ff_dct_unquantize_h263_armv5te(DCTELEM *block, int qmul, int qadd, int count); |
| 4341 | 28 |
| 29 #ifdef ENABLE_ARM_TESTS | |
| 30 /** | |
| 31 * h263 dequantizer supplementary function, it is performance critical and needs to | |
| 32 * have optimized implementations for each architecture. Is also used as a reference | |
| 33 * implementation in regression tests | |
| 34 */ | |
| 35 static inline void dct_unquantize_h263_helper_c(DCTELEM *block, int qmul, int qadd, int count) | |
| 36 { | |
| 37 int i, level; | |
| 38 for (i = 0; i < count; i++) { | |
| 39 level = block[i]; | |
| 40 if (level) { | |
| 41 if (level < 0) { | |
| 42 level = level * qmul - qadd; | |
| 43 } else { | |
| 44 level = level * qmul + qadd; | |
| 45 } | |
| 46 block[i] = level; | |
| 47 } | |
| 48 } | |
| 49 } | |
| 50 #endif | |
| 51 | |
| 52 static void dct_unquantize_h263_intra_armv5te(MpegEncContext *s, | |
| 53 DCTELEM *block, int n, int qscale) | |
| 54 { | |
| 5100 | 55 int level, qmul, qadd; |
| 4341 | 56 int nCoeffs; |
| 57 | |
| 58 assert(s->block_last_index[n]>=0); | |
| 59 | |
| 60 qmul = qscale << 1; | |
| 61 | |
| 62 if (!s->h263_aic) { | |
| 63 if (n < 4) | |
| 64 level = block[0] * s->y_dc_scale; | |
| 65 else | |
| 66 level = block[0] * s->c_dc_scale; | |
| 67 qadd = (qscale - 1) | 1; | |
| 68 }else{ | |
| 69 qadd = 0; | |
| 70 level = block[0]; | |
| 71 } | |
| 72 if(s->ac_pred) | |
| 73 nCoeffs=63; | |
| 74 else | |
| 75 nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; | |
| 76 | |
|
8197
06acc3ab4bdc
ARM: move dct_unquantize_h263_*_armv5te asm to separate file
mru
parents:
8031
diff
changeset
|
77 ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1); |
| 4341 | 78 block[0] = level; |
| 79 } | |
| 80 | |
| 81 static void dct_unquantize_h263_inter_armv5te(MpegEncContext *s, | |
| 82 DCTELEM *block, int n, int qscale) | |
| 83 { | |
| 5100 | 84 int qmul, qadd; |
| 4341 | 85 int nCoeffs; |
| 86 | |
| 87 assert(s->block_last_index[n]>=0); | |
| 88 | |
| 89 qadd = (qscale - 1) | 1; | |
| 90 qmul = qscale << 1; | |
| 91 | |
| 92 nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; | |
| 93 | |
|
8197
06acc3ab4bdc
ARM: move dct_unquantize_h263_*_armv5te asm to separate file
mru
parents:
8031
diff
changeset
|
94 ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1); |
| 4341 | 95 } |
| 96 | |
| 97 void MPV_common_init_armv5te(MpegEncContext *s) | |
| 98 { | |
| 99 s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_armv5te; | |
| 100 s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_armv5te; | |
| 101 } |
