1 /*
2 * Alpha optimized DSP utils
3 * Copyright (c) 2002 Falk Hueffner <falk@debian.org>
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
25
27 uint64_t qscale, uint64_t qadd)
28 {
29 uint64_t qmul = qscale << 1;
30 uint64_t correction =
WORD_VEC(qmul * 255 >> 8);
31 int i;
32
34
35 for(i = 0; i <= n_coeffs; block += 4, i += 4) {
36 uint64_t levels, negmask, zeros, add, sub;
37
39 if (levels == 0)
40 continue;
41
42 #ifdef __alpha_max__
43 /* I don't think the speed difference justifies runtime
44 detection. */
45 negmask =
maxsw4(levels, -1);
/* negative -> ffff (-1) */
46 negmask =
minsw4(negmask, 0);
/* positive -> 0000 (0) */
47 #else
49 negmask &= (negmask >> 1) | (1 << 7);
50 negmask =
zap(-1, negmask);
51 #endif
52
54 zeros &= zeros >> 1;
55 /* zeros |= zeros << 1 is not needed since qadd <= 255, so
56 zapping the lower byte suffices. */
57
58 levels *= qmul;
59 levels -= correction & (negmask << 16);
60
61 add = qadd & ~negmask;
62 sub = qadd & negmask;
63 /* Set qadd to 0 for levels == 0. */
64 add =
zap(add, zeros);
65 levels += add;
66 levels -= sub;
67
69 }
70 }
71
74 {
75 int n_coeffs;
76 uint64_t qadd;
77 int16_t block0 = block[0];
78
80 if (n < 4)
82 else
84 qadd = (qscale - 1) | 1;
85 } else {
86 qadd = 0;
87 }
88
90 n_coeffs = 63;
91 else
93
95
96 block[0] = block0;
97 }
98
101 {
104 }
105
107 {
110 }
static void dct_unquantize_h263_inter_axp(MpegEncContext *s, int16_t *block, int n, int qscale)
int h263_aic
Advanced INTRA Coding (AIC)
void(* dct_unquantize_h263_intra)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
Macro definitions for various function/variable attributes.
void(* dct_unquantize_h263_inter)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
av_cold void ff_mpv_common_init_axp(MpegEncContext *s)
int block_last_index[12]
last non zero coefficient in block
static void dct_unquantize_h263_intra_axp(MpegEncContext *s, int16_t *block, int n, int qscale)
static void dct_unquantize_h263_axp(int16_t *block, int n_coeffs, uint64_t qscale, uint64_t qadd)
static uint64_t WORD_VEC(uint64_t x)
ScanTable inter_scantable
if inter == intra then intra should be used to reduce the cache usage