| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * H.264 IDCT | ||
| 3 | * Copyright (c) 2004-2011 Michael Niedermayer <michaelni@gmx.at> | ||
| 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 | |||
| 22 | /** | ||
| 23 | * @file | ||
| 24 | * H.264 IDCT. | ||
| 25 | * @author Michael Niedermayer <michaelni@gmx.at> | ||
| 26 | */ | ||
| 27 | |||
| 28 | #include "bit_depth_template.c" | ||
| 29 | #include "libavutil/common.h" | ||
| 30 | #include "h264_parse.h" | ||
| 31 | #include "h264idct.h" | ||
| 32 | |||
| 33 | 109079178 | void FUNCC(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, int stride) | |
| 34 | { | ||
| 35 | int i; | ||
| 36 | 109079178 | pixel *dst = (pixel*)_dst; | |
| 37 | 109079178 | dctcoef *block = (dctcoef*)_block; | |
| 38 | 109079178 | stride >>= sizeof(pixel)-1; | |
| 39 | |||
| 40 | 109079178 | block[0] += 1 << 5; | |
| 41 | |||
| 42 |
2/2✓ Branch 0 taken 218158356 times.
✓ Branch 1 taken 54539589 times.
|
545395890 | for(i=0; i<4; i++){ |
| 43 | 436316712 | const SUINT z0= block[i + 4*0] + (unsigned)block[i + 4*2]; | |
| 44 | 436316712 | const SUINT z1= block[i + 4*0] - (unsigned)block[i + 4*2]; | |
| 45 | 436316712 | const SUINT z2= (block[i + 4*1]>>1) - (unsigned)block[i + 4*3]; | |
| 46 | 436316712 | const SUINT z3= block[i + 4*1] + (unsigned)(block[i + 4*3]>>1); | |
| 47 | |||
| 48 | 436316712 | block[i + 4*0]= z0 + z3; | |
| 49 | 436316712 | block[i + 4*1]= z1 + z2; | |
| 50 | 436316712 | block[i + 4*2]= z1 - z2; | |
| 51 | 436316712 | block[i + 4*3]= z0 - z3; | |
| 52 | } | ||
| 53 | |||
| 54 |
2/2✓ Branch 0 taken 218158356 times.
✓ Branch 1 taken 54539589 times.
|
545395890 | for(i=0; i<4; i++){ |
| 55 | 436316712 | const SUINT z0= block[0 + 4*i] + (SUINT)block[2 + 4*i]; | |
| 56 | 436316712 | const SUINT z1= block[0 + 4*i] - (SUINT)block[2 + 4*i]; | |
| 57 | 436316712 | const SUINT z2= (block[1 + 4*i]>>1) - (SUINT)block[3 + 4*i]; | |
| 58 | 436316712 | const SUINT z3= block[1 + 4*i] + (SUINT)(block[3 + 4*i]>>1); | |
| 59 | |||
| 60 | 436316712 | dst[i + 0*stride]= av_clip_pixel(dst[i + 0*stride] + ((int)(z0 + z3) >> 6)); | |
| 61 | 436316712 | dst[i + 1*stride]= av_clip_pixel(dst[i + 1*stride] + ((int)(z1 + z2) >> 6)); | |
| 62 | 436316712 | dst[i + 2*stride]= av_clip_pixel(dst[i + 2*stride] + ((int)(z1 - z2) >> 6)); | |
| 63 | 436316712 | dst[i + 3*stride]= av_clip_pixel(dst[i + 3*stride] + ((int)(z0 - z3) >> 6)); | |
| 64 | } | ||
| 65 | |||
| 66 | 109079178 | memset(block, 0, 16 * sizeof(dctcoef)); | |
| 67 | 109079178 | } | |
| 68 | |||
| 69 | 13597962 | void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, int16_t *_block, int stride){ | |
| 70 | int i; | ||
| 71 | 13597962 | pixel *dst = (pixel*)_dst; | |
| 72 | 13597962 | dctcoef *block = (dctcoef*)_block; | |
| 73 | 13597962 | stride >>= sizeof(pixel)-1; | |
| 74 | |||
| 75 | 13597962 | block[0] += 32; | |
| 76 | |||
| 77 |
2/2✓ Branch 0 taken 54391848 times.
✓ Branch 1 taken 6798981 times.
|
122381658 | for( i = 0; i < 8; i++ ) |
| 78 | { | ||
| 79 | 108783696 | const unsigned int a0 = block[i+0*8] + (unsigned)block[i+4*8]; | |
| 80 | 108783696 | const unsigned int a2 = block[i+0*8] - (unsigned)block[i+4*8]; | |
| 81 | 108783696 | const unsigned int a4 = (block[i+2*8]>>1) - (unsigned)block[i+6*8]; | |
| 82 | 108783696 | const unsigned int a6 = (block[i+6*8]>>1) + (unsigned)block[i+2*8]; | |
| 83 | |||
| 84 | 108783696 | const unsigned int b0 = a0 + a6; | |
| 85 | 108783696 | const unsigned int b2 = a2 + a4; | |
| 86 | 108783696 | const unsigned int b4 = a2 - a4; | |
| 87 | 108783696 | const unsigned int b6 = a0 - a6; | |
| 88 | |||
| 89 | 108783696 | const int a1 = -block[i+3*8] + (unsigned)block[i+5*8] - block[i+7*8] - (block[i+7*8]>>1); | |
| 90 | 108783696 | const int a3 = block[i+1*8] + (unsigned)block[i+7*8] - block[i+3*8] - (block[i+3*8]>>1); | |
| 91 | 108783696 | const int a5 = -block[i+1*8] + (unsigned)block[i+7*8] + block[i+5*8] + (block[i+5*8]>>1); | |
| 92 | 108783696 | const int a7 = block[i+3*8] + (unsigned)block[i+5*8] + block[i+1*8] + (block[i+1*8]>>1); | |
| 93 | |||
| 94 | 108783696 | const int b1 = (a7>>2) + (unsigned)a1; | |
| 95 | 108783696 | const int b3 = (unsigned)a3 + (a5>>2); | |
| 96 | 108783696 | const int b5 = (a3>>2) - (unsigned)a5; | |
| 97 | 108783696 | const int b7 = (unsigned)a7 - (a1>>2); | |
| 98 | |||
| 99 | 108783696 | block[i+0*8] = b0 + b7; | |
| 100 | 108783696 | block[i+7*8] = b0 - b7; | |
| 101 | 108783696 | block[i+1*8] = b2 + b5; | |
| 102 | 108783696 | block[i+6*8] = b2 - b5; | |
| 103 | 108783696 | block[i+2*8] = b4 + b3; | |
| 104 | 108783696 | block[i+5*8] = b4 - b3; | |
| 105 | 108783696 | block[i+3*8] = b6 + b1; | |
| 106 | 108783696 | block[i+4*8] = b6 - b1; | |
| 107 | } | ||
| 108 |
2/2✓ Branch 0 taken 54391848 times.
✓ Branch 1 taken 6798981 times.
|
122381658 | for( i = 0; i < 8; i++ ) |
| 109 | { | ||
| 110 | 108783696 | const unsigned a0 = block[0+i*8] + (unsigned)block[4+i*8]; | |
| 111 | 108783696 | const unsigned a2 = block[0+i*8] - (unsigned)block[4+i*8]; | |
| 112 | 108783696 | const unsigned a4 = (block[2+i*8]>>1) - (unsigned)block[6+i*8]; | |
| 113 | 108783696 | const unsigned a6 = (block[6+i*8]>>1) + (unsigned)block[2+i*8]; | |
| 114 | |||
| 115 | 108783696 | const unsigned b0 = a0 + a6; | |
| 116 | 108783696 | const unsigned b2 = a2 + a4; | |
| 117 | 108783696 | const unsigned b4 = a2 - a4; | |
| 118 | 108783696 | const unsigned b6 = a0 - a6; | |
| 119 | |||
| 120 | 108783696 | const int a1 = -(unsigned)block[3+i*8] + block[5+i*8] - block[7+i*8] - (block[7+i*8]>>1); | |
| 121 | 108783696 | const int a3 = (unsigned)block[1+i*8] + block[7+i*8] - block[3+i*8] - (block[3+i*8]>>1); | |
| 122 | 108783696 | const int a5 = -(unsigned)block[1+i*8] + block[7+i*8] + block[5+i*8] + (block[5+i*8]>>1); | |
| 123 | 108783696 | const int a7 = (unsigned)block[3+i*8] + block[5+i*8] + block[1+i*8] + (block[1+i*8]>>1); | |
| 124 | |||
| 125 | 108783696 | const unsigned b1 = (a7>>2) + (unsigned)a1; | |
| 126 | 108783696 | const unsigned b3 = (unsigned)a3 + (a5>>2); | |
| 127 | 108783696 | const unsigned b5 = (a3>>2) - (unsigned)a5; | |
| 128 | 108783696 | const unsigned b7 = (unsigned)a7 - (a1>>2); | |
| 129 | |||
| 130 | 108783696 | dst[i + 0*stride] = av_clip_pixel( dst[i + 0*stride] + ((int)(b0 + b7) >> 6) ); | |
| 131 | 108783696 | dst[i + 1*stride] = av_clip_pixel( dst[i + 1*stride] + ((int)(b2 + b5) >> 6) ); | |
| 132 | 108783696 | dst[i + 2*stride] = av_clip_pixel( dst[i + 2*stride] + ((int)(b4 + b3) >> 6) ); | |
| 133 | 108783696 | dst[i + 3*stride] = av_clip_pixel( dst[i + 3*stride] + ((int)(b6 + b1) >> 6) ); | |
| 134 | 108783696 | dst[i + 4*stride] = av_clip_pixel( dst[i + 4*stride] + ((int)(b6 - b1) >> 6) ); | |
| 135 | 108783696 | dst[i + 5*stride] = av_clip_pixel( dst[i + 5*stride] + ((int)(b4 - b3) >> 6) ); | |
| 136 | 108783696 | dst[i + 6*stride] = av_clip_pixel( dst[i + 6*stride] + ((int)(b2 - b5) >> 6) ); | |
| 137 | 108783696 | dst[i + 7*stride] = av_clip_pixel( dst[i + 7*stride] + ((int)(b0 - b7) >> 6) ); | |
| 138 | } | ||
| 139 | |||
| 140 | 13597962 | memset(block, 0, 64 * sizeof(dctcoef)); | |
| 141 | 13597962 | } | |
| 142 | |||
| 143 | // assumes all AC coefs are 0 | ||
| 144 | 58406400 | void FUNCC(ff_h264_idct_dc_add)(uint8_t *_dst, int16_t *_block, int stride){ | |
| 145 | int i, j; | ||
| 146 | 58406400 | pixel *dst = (pixel*)_dst; | |
| 147 | 58406400 | dctcoef *block = (dctcoef*)_block; | |
| 148 | 58406400 | int dc = (block[0] + 32) >> 6; | |
| 149 | 58406400 | stride /= sizeof(pixel); | |
| 150 | 58406400 | block[0] = 0; | |
| 151 |
2/2✓ Branch 0 taken 116812800 times.
✓ Branch 1 taken 29203200 times.
|
292032000 | for( j = 0; j < 4; j++ ) |
| 152 | { | ||
| 153 |
2/2✓ Branch 0 taken 467251200 times.
✓ Branch 1 taken 116812800 times.
|
1168128000 | for( i = 0; i < 4; i++ ) |
| 154 | 934502400 | dst[i] = av_clip_pixel( dst[i] + dc ); | |
| 155 | 233625600 | dst += stride; | |
| 156 | } | ||
| 157 | 58406400 | } | |
| 158 | |||
| 159 | 1254336 | void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, int16_t *_block, int stride){ | |
| 160 | int i, j; | ||
| 161 | 1254336 | pixel *dst = (pixel*)_dst; | |
| 162 | 1254336 | dctcoef *block = (dctcoef*)_block; | |
| 163 | 1254336 | int dc = (block[0] + 32) >> 6; | |
| 164 | 1254336 | block[0] = 0; | |
| 165 | 1254336 | stride /= sizeof(pixel); | |
| 166 |
2/2✓ Branch 0 taken 5017344 times.
✓ Branch 1 taken 627168 times.
|
11289024 | for( j = 0; j < 8; j++ ) |
| 167 | { | ||
| 168 |
2/2✓ Branch 0 taken 40138752 times.
✓ Branch 1 taken 5017344 times.
|
90312192 | for( i = 0; i < 8; i++ ) |
| 169 | 80277504 | dst[i] = av_clip_pixel( dst[i] + dc ); | |
| 170 | 10034688 | dst += stride; | |
| 171 | } | ||
| 172 | 1254336 | } | |
| 173 | |||
| 174 | 9778866 | void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset, | |
| 175 | int16_t *block, int stride, | ||
| 176 | const uint8_t nnzc[5 * 8]) | ||
| 177 | { | ||
| 178 | int i; | ||
| 179 |
2/2✓ Branch 0 taken 78230928 times.
✓ Branch 1 taken 4889433 times.
|
166240722 | for(i=0; i<16; i++){ |
| 180 | 156461856 | int nnz = nnzc[ scan8[i] ]; | |
| 181 |
2/2✓ Branch 0 taken 29298042 times.
✓ Branch 1 taken 48932886 times.
|
156461856 | if(nnz){ |
| 182 |
4/4✓ Branch 0 taken 13229538 times.
✓ Branch 1 taken 16068504 times.
✓ Branch 2 taken 4675006 times.
✓ Branch 3 taken 8554532 times.
|
58596084 | if(nnz==1 && ((dctcoef*)block)[i*16]) FUNCC(ff_h264_idct_dc_add)(dst + block_offset[i], block + i*16*sizeof(pixel), stride); |
| 183 | 49246072 | else FUNCC(ff_h264_idct_add )(dst + block_offset[i], block + i*16*sizeof(pixel), stride); | |
| 184 | } | ||
| 185 | } | ||
| 186 | 9778866 | } | |
| 187 | |||
| 188 | 1940614 | void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset, | |
| 189 | int16_t *block, int stride, | ||
| 190 | const uint8_t nnzc[5 * 8]) | ||
| 191 | { | ||
| 192 | int i; | ||
| 193 |
2/2✓ Branch 0 taken 15524912 times.
✓ Branch 1 taken 970307 times.
|
32990438 | for(i=0; i<16; i++){ |
| 194 |
2/2✓ Branch 0 taken 3761767 times.
✓ Branch 1 taken 11763145 times.
|
31049824 | if(nnzc[ scan8[i] ]) FUNCC(ff_h264_idct_add )(dst + block_offset[i], block + i*16*sizeof(pixel), stride); |
| 195 |
2/2✓ Branch 0 taken 5002562 times.
✓ Branch 1 taken 6760583 times.
|
23526290 | else if(((dctcoef*)block)[i*16]) FUNCC(ff_h264_idct_dc_add)(dst + block_offset[i], block + i*16*sizeof(pixel), stride); |
| 196 | } | ||
| 197 | 1940614 | } | |
| 198 | |||
| 199 | 1843686 | void FUNCC(ff_h264_idct8_add4)(uint8_t *dst, const int *block_offset, | |
| 200 | int16_t *block, int stride, | ||
| 201 | const uint8_t nnzc[5 * 8]) | ||
| 202 | { | ||
| 203 | int i; | ||
| 204 |
2/2✓ Branch 0 taken 3687372 times.
✓ Branch 1 taken 921843 times.
|
9218430 | for(i=0; i<16; i+=4){ |
| 205 | 7374744 | int nnz = nnzc[ scan8[i] ]; | |
| 206 |
2/2✓ Branch 0 taken 2334640 times.
✓ Branch 1 taken 1352732 times.
|
7374744 | if(nnz){ |
| 207 |
4/4✓ Branch 0 taken 699972 times.
✓ Branch 1 taken 1634668 times.
✓ Branch 2 taken 383298 times.
✓ Branch 3 taken 316674 times.
|
4669280 | if(nnz==1 && ((dctcoef*)block)[i*16]) FUNCC(ff_h264_idct8_dc_add)(dst + block_offset[i], block + i*16*sizeof(pixel), stride); |
| 208 | 3902684 | else FUNCC(ff_h264_idct8_add )(dst + block_offset[i], block + i*16*sizeof(pixel), stride); | |
| 209 | } | ||
| 210 | } | ||
| 211 | 1843686 | } | |
| 212 | |||
| 213 | 9047380 | void FUNCC(ff_h264_idct_add8)(uint8_t **dest, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){ | |
| 214 | int i, j; | ||
| 215 |
2/2✓ Branch 0 taken 9047380 times.
✓ Branch 1 taken 4523690 times.
|
27142140 | for(j=1; j<3; j++){ |
| 216 |
2/2✓ Branch 0 taken 36189520 times.
✓ Branch 1 taken 9047380 times.
|
90473800 | for(i=j*16; i<j*16+4; i++){ |
| 217 |
2/2✓ Branch 0 taken 8305987 times.
✓ Branch 1 taken 27883533 times.
|
72379040 | if(nnzc[ scan8[i] ]) |
| 218 | 16611974 | FUNCC(ff_h264_idct_add )(dest[j-1] + block_offset[i], block + i*16*sizeof(pixel), stride); | |
| 219 |
2/2✓ Branch 0 taken 12832958 times.
✓ Branch 1 taken 15050575 times.
|
55767066 | else if(((dctcoef*)block)[i*16]) |
| 220 | 25665916 | FUNCC(ff_h264_idct_dc_add)(dest[j-1] + block_offset[i], block + i*16*sizeof(pixel), stride); | |
| 221 | } | ||
| 222 | } | ||
| 223 | 9047380 | } | |
| 224 | |||
| 225 | 1350636 | void FUNCC(ff_h264_idct_add8_422)(uint8_t **dest, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){ | |
| 226 | int i, j; | ||
| 227 | |||
| 228 |
2/2✓ Branch 0 taken 1350636 times.
✓ Branch 1 taken 675318 times.
|
4051908 | for(j=1; j<3; j++){ |
| 229 |
2/2✓ Branch 0 taken 5402544 times.
✓ Branch 1 taken 1350636 times.
|
13506360 | for(i=j*16; i<j*16+4; i++){ |
| 230 |
2/2✓ Branch 0 taken 1820857 times.
✓ Branch 1 taken 3581687 times.
|
10805088 | if(nnzc[ scan8[i] ]) |
| 231 | 3641714 | FUNCC(ff_h264_idct_add )(dest[j-1] + block_offset[i], block + i*16*sizeof(pixel), stride); | |
| 232 |
2/2✓ Branch 0 taken 2290895 times.
✓ Branch 1 taken 1290792 times.
|
7163374 | else if(((dctcoef*)block)[i*16]) |
| 233 | 4581790 | FUNCC(ff_h264_idct_dc_add)(dest[j-1] + block_offset[i], block + i*16*sizeof(pixel), stride); | |
| 234 | } | ||
| 235 | } | ||
| 236 | |||
| 237 |
2/2✓ Branch 0 taken 1350636 times.
✓ Branch 1 taken 675318 times.
|
4051908 | for(j=1; j<3; j++){ |
| 238 |
2/2✓ Branch 0 taken 5402544 times.
✓ Branch 1 taken 1350636 times.
|
13506360 | for(i=j*16+4; i<j*16+8; i++){ |
| 239 |
2/2✓ Branch 0 taken 1845890 times.
✓ Branch 1 taken 3556654 times.
|
10805088 | if(nnzc[ scan8[i+4] ]) |
| 240 | 3691780 | FUNCC(ff_h264_idct_add )(dest[j-1] + block_offset[i+4], block + i*16*sizeof(pixel), stride); | |
| 241 |
2/2✓ Branch 0 taken 2323433 times.
✓ Branch 1 taken 1233221 times.
|
7113308 | else if(((dctcoef*)block)[i*16]) |
| 242 | 4646866 | FUNCC(ff_h264_idct_dc_add)(dest[j-1] + block_offset[i+4], block + i*16*sizeof(pixel), stride); | |
| 243 | } | ||
| 244 | } | ||
| 245 | 1350636 | } | |
| 246 | |||
| 247 | #if BIT_DEPTH == 8 || BIT_DEPTH == 9 | ||
| 248 | /** | ||
| 249 | * IDCT transforms the 16 dc values and dequantizes them. | ||
| 250 | * @param qmul quantization parameter | ||
| 251 | */ | ||
| 252 | 1185054 | void FUNCC2(ff_h264_luma_dc_dequant_idct)(int16_t *_output, int16_t *_input, int qmul) | |
| 253 | { | ||
| 254 | #define stride 16 | ||
| 255 | int i; | ||
| 256 | int temp[16]; | ||
| 257 | static const uint8_t x_offset[4]={0, 2*stride, 8*stride, 10*stride}; | ||
| 258 | 1185054 | dctcoef *input = (dctcoef*)_input; | |
| 259 | 1185054 | dctcoef *output = (dctcoef*)_output; | |
| 260 | |||
| 261 |
2/2✓ Branch 0 taken 2370108 times.
✓ Branch 1 taken 592527 times.
|
5925270 | for(i=0; i<4; i++){ |
| 262 | 4740216 | const int z0= input[4*i+0] + input[4*i+1]; | |
| 263 | 4740216 | const int z1= input[4*i+0] - input[4*i+1]; | |
| 264 | 4740216 | const int z2= input[4*i+2] - input[4*i+3]; | |
| 265 | 4740216 | const int z3= input[4*i+2] + input[4*i+3]; | |
| 266 | |||
| 267 | 4740216 | temp[4*i+0]= z0+z3; | |
| 268 | 4740216 | temp[4*i+1]= z0-z3; | |
| 269 | 4740216 | temp[4*i+2]= z1-z2; | |
| 270 | 4740216 | temp[4*i+3]= z1+z2; | |
| 271 | } | ||
| 272 | |||
| 273 |
2/2✓ Branch 0 taken 2370108 times.
✓ Branch 1 taken 592527 times.
|
5925270 | for(i=0; i<4; i++){ |
| 274 | 4740216 | const int offset= x_offset[i]; | |
| 275 | 4740216 | const SUINT z0= temp[4*0+i] + temp[4*2+i]; | |
| 276 | 4740216 | const SUINT z1= temp[4*0+i] - temp[4*2+i]; | |
| 277 | 4740216 | const SUINT z2= temp[4*1+i] - temp[4*3+i]; | |
| 278 | 4740216 | const SUINT z3= temp[4*1+i] + temp[4*3+i]; | |
| 279 | |||
| 280 | 4740216 | output[stride* 0+offset]= (int)((z0 + z3)*qmul + 128 ) >> 8; | |
| 281 | 4740216 | output[stride* 1+offset]= (int)((z1 + z2)*qmul + 128 ) >> 8; | |
| 282 | 4740216 | output[stride* 4+offset]= (int)((z1 - z2)*qmul + 128 ) >> 8; | |
| 283 | 4740216 | output[stride* 5+offset]= (int)((z0 - z3)*qmul + 128 ) >> 8; | |
| 284 | } | ||
| 285 | #undef stride | ||
| 286 | 1185054 | } | |
| 287 | |||
| 288 | 2252062 | void FUNCC2(ff_h264_chroma422_dc_dequant_idct)(int16_t *_block, int qmul) | |
| 289 | { | ||
| 290 | 2252062 | const int stride= 16*2; | |
| 291 | 2252062 | const int xStride= 16; | |
| 292 | int i; | ||
| 293 | unsigned temp[8]; | ||
| 294 | static const uint8_t x_offset[2]={0, 16}; | ||
| 295 | 2252062 | dctcoef *block = (dctcoef*)_block; | |
| 296 | |||
| 297 |
2/2✓ Branch 0 taken 4504124 times.
✓ Branch 1 taken 1126031 times.
|
11260310 | for(i=0; i<4; i++){ |
| 298 | 9008248 | temp[2*i+0] = block[stride*i + xStride*0] + (unsigned)block[stride*i + xStride*1]; | |
| 299 | 9008248 | temp[2*i+1] = block[stride*i + xStride*0] - (unsigned)block[stride*i + xStride*1]; | |
| 300 | } | ||
| 301 | |||
| 302 |
2/2✓ Branch 0 taken 2252062 times.
✓ Branch 1 taken 1126031 times.
|
6756186 | for(i=0; i<2; i++){ |
| 303 | 4504124 | const int offset= x_offset[i]; | |
| 304 | 4504124 | const SUINT z0= temp[2*0+i] + temp[2*2+i]; | |
| 305 | 4504124 | const SUINT z1= temp[2*0+i] - temp[2*2+i]; | |
| 306 | 4504124 | const SUINT z2= temp[2*1+i] - temp[2*3+i]; | |
| 307 | 4504124 | const SUINT z3= temp[2*1+i] + temp[2*3+i]; | |
| 308 | |||
| 309 | 4504124 | block[stride*0+offset]= (int)((z0 + z3)*qmul + 128) >> 8; | |
| 310 | 4504124 | block[stride*1+offset]= (int)((z1 + z2)*qmul + 128) >> 8; | |
| 311 | 4504124 | block[stride*2+offset]= (int)((z1 - z2)*qmul + 128) >> 8; | |
| 312 | 4504124 | block[stride*3+offset]= (int)((z0 - z3)*qmul + 128) >> 8; | |
| 313 | } | ||
| 314 | 2252062 | } | |
| 315 | |||
| 316 | 13159664 | void FUNCC2(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul) | |
| 317 | { | ||
| 318 | 13159664 | const int stride= 16*2; | |
| 319 | 13159664 | const int xStride= 16; | |
| 320 | SUINT a,b,c,d,e; | ||
| 321 | 13159664 | dctcoef *block = (dctcoef*)_block; | |
| 322 | |||
| 323 | 13159664 | a= block[stride*0 + xStride*0]; | |
| 324 | 13159664 | b= block[stride*0 + xStride*1]; | |
| 325 | 13159664 | c= block[stride*1 + xStride*0]; | |
| 326 | 13159664 | d= block[stride*1 + xStride*1]; | |
| 327 | |||
| 328 | 13159664 | e= a-b; | |
| 329 | 13159664 | a= a+b; | |
| 330 | 13159664 | b= c-d; | |
| 331 | 13159664 | c= c+d; | |
| 332 | |||
| 333 | 13159664 | block[stride*0 + xStride*0]= (int)((a+c)*qmul) >> 7; | |
| 334 | 13159664 | block[stride*0 + xStride*1]= (int)((e+b)*qmul) >> 7; | |
| 335 | 13159664 | block[stride*1 + xStride*0]= (int)((a-c)*qmul) >> 7; | |
| 336 | 13159664 | block[stride*1 + xStride*1]= (int)((e-b)*qmul) >> 7; | |
| 337 | 13159664 | } | |
| 338 | #endif | ||
| 339 |