annotate arm/mpegvideo_armv5te.c @ 9024:2bf694251330 libavcodec

Add ff_h263_find_resync_marker() to find the bit position of the next resync_marker, if any. patch by Gwenole Beauchesne gbeauchesne splitted-desktopcom based on suggested implementation by me
author michael
date Tue, 24 Feb 2009 16:12:47 +0000
parents 9281a8a9387a
children 58c4d851d1c7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4341
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
1 /*
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
2 * Optimization of some functions from mpegvideo.c for armv5te
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
3 * Copyright (c) 2007 Siarhei Siamashka <ssvb@users.sourceforge.net>
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
4 *
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
5 * This file is part of FFmpeg.
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
6 *
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
11 *
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
15 * Lesser General Public License for more details.
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
16 *
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
20 */
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
21
6763
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 6761
diff changeset
22 #include "libavcodec/avcodec.h"
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 6761
diff changeset
23 #include "libavcodec/dsputil.h"
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 6761
diff changeset
24 #include "libavcodec/mpegvideo.h"
4341
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
25
8250
cf4d575b1982 Delete unnecessary 'extern' keywords.
diego
parents: 8197
diff changeset
26 void ff_dct_unquantize_h263_armv5te(DCTELEM *block, int qmul, int qadd, int count);
4341
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
27
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
28 #ifdef ENABLE_ARM_TESTS
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
29 /**
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
30 * h263 dequantizer supplementary function, it is performance critical and needs to
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
31 * have optimized implementations for each architecture. Is also used as a reference
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
32 * implementation in regression tests
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
33 */
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
34 static inline void dct_unquantize_h263_helper_c(DCTELEM *block, int qmul, int qadd, int count)
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
35 {
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
36 int i, level;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
37 for (i = 0; i < count; i++) {
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
38 level = block[i];
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
39 if (level) {
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
40 if (level < 0) {
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
41 level = level * qmul - qadd;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
42 } else {
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
43 level = level * qmul + qadd;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
44 }
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
45 block[i] = level;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
46 }
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
47 }
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
48 }
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
49 #endif
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
50
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
51 static void dct_unquantize_h263_intra_armv5te(MpegEncContext *s,
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
52 DCTELEM *block, int n, int qscale)
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
53 {
5100
daff9ebd2e0b Remove unused variables.
diego
parents: 5010
diff changeset
54 int level, qmul, qadd;
4341
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
55 int nCoeffs;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
56
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
57 assert(s->block_last_index[n]>=0);
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
58
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
59 qmul = qscale << 1;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
60
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
61 if (!s->h263_aic) {
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
62 if (n < 4)
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
63 level = block[0] * s->y_dc_scale;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
64 else
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
65 level = block[0] * s->c_dc_scale;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
66 qadd = (qscale - 1) | 1;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
67 }else{
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
68 qadd = 0;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
69 level = block[0];
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
70 }
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
71 if(s->ac_pred)
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
72 nCoeffs=63;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
73 else
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
74 nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
75
8197
06acc3ab4bdc ARM: move dct_unquantize_h263_*_armv5te asm to separate file
mru
parents: 8031
diff changeset
76 ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1);
4341
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
77 block[0] = level;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
78 }
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
79
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
80 static void dct_unquantize_h263_inter_armv5te(MpegEncContext *s,
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
81 DCTELEM *block, int n, int qscale)
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
82 {
5100
daff9ebd2e0b Remove unused variables.
diego
parents: 5010
diff changeset
83 int qmul, qadd;
4341
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
84 int nCoeffs;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
85
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
86 assert(s->block_last_index[n]>=0);
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
87
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
88 qadd = (qscale - 1) | 1;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
89 qmul = qscale << 1;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
90
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
91 nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
92
8197
06acc3ab4bdc ARM: move dct_unquantize_h263_*_armv5te asm to separate file
mru
parents: 8031
diff changeset
93 ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1);
4341
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
94 }
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
95
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
96 void MPV_common_init_armv5te(MpegEncContext *s)
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
97 {
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
98 s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_armv5te;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
99 s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_armv5te;
5053e6b3ea45 add missing bit from commit r7423
gpoirier
parents:
diff changeset
100 }