| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * inter prediction template for HEVC/VVC | ||
| 3 | * | ||
| 4 | * Copyright (C) 2022 Nuo Mi | ||
| 5 | * Copyright (C) 2024 Wu Jianhua | ||
| 6 | * | ||
| 7 | * This file is part of FFmpeg. | ||
| 8 | * | ||
| 9 | * FFmpeg is free software; you can redistribute it and/or | ||
| 10 | * modify it under the terms of the GNU Lesser General Public | ||
| 11 | * License as published by the Free Software Foundation; either | ||
| 12 | * version 2.1 of the License, or (at your option) any later version. | ||
| 13 | * | ||
| 14 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 17 | * Lesser General Public License for more details. | ||
| 18 | * | ||
| 19 | * You should have received a copy of the GNU Lesser General Public | ||
| 20 | * License along with FFmpeg; if not, write to the Free Software | ||
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 22 | */ | ||
| 23 | |||
| 24 | #define CHROMA_EXTRA_BEFORE 1 | ||
| 25 | #define CHROMA_EXTRA 3 | ||
| 26 | #define LUMA_EXTRA_BEFORE 3 | ||
| 27 | #define LUMA_EXTRA 7 | ||
| 28 | |||
| 29 | 17952968 | static void FUNC(put_pixels)(int16_t *dst, | |
| 30 | const uint8_t *_src, const ptrdiff_t _src_stride, | ||
| 31 | const int height, const int8_t *hf, const int8_t *vf, const int width) | ||
| 32 | { | ||
| 33 | 17952968 | const pixel *src = (const pixel *)_src; | |
| 34 | 17952968 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 35 | |||
| 36 |
2/2✓ Branch 0 taken 108509836 times.
✓ Branch 1 taken 8976484 times.
|
234972640 | for (int y = 0; y < height; y++) { |
| 37 |
2/2✓ Branch 0 taken 2049495944 times.
✓ Branch 1 taken 108509836 times.
|
4316011560 | for (int x = 0; x < width; x++) |
| 38 | 4098991888 | dst[x] = src[x] << (14 - BIT_DEPTH); | |
| 39 | 217019672 | src += src_stride; | |
| 40 | 217019672 | dst += MAX_PB_SIZE; | |
| 41 | } | ||
| 42 | 17952968 | } | |
| 43 | |||
| 44 | 10673926 | static void FUNC(put_uni_pixels)(uint8_t *_dst, const ptrdiff_t _dst_stride, | |
| 45 | const uint8_t *_src, const ptrdiff_t _src_stride, const int height, | ||
| 46 | const int8_t *hf, const int8_t *vf, const int width) | ||
| 47 | { | ||
| 48 | 10673926 | const pixel *src = (const pixel *)_src; | |
| 49 | 10673926 | pixel *dst = (pixel *)_dst; | |
| 50 | 10673926 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 51 | 10673926 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 52 | |||
| 53 |
2/2✓ Branch 0 taken 52993672 times.
✓ Branch 1 taken 5336963 times.
|
116661270 | for (int y = 0; y < height; y++) { |
| 54 | 105987344 | memcpy(dst, src, width * sizeof(pixel)); | |
| 55 | 105987344 | src += src_stride; | |
| 56 | 105987344 | dst += dst_stride; | |
| 57 | } | ||
| 58 | 10673926 | } | |
| 59 | |||
| 60 | 426874 | static void FUNC(put_uni_w_pixels)(uint8_t *_dst, const ptrdiff_t _dst_stride, | |
| 61 | const uint8_t *_src, const ptrdiff_t _src_stride, const int height, | ||
| 62 | const int denom, const int wx, const int _ox, const int8_t *hf, const int8_t *vf, | ||
| 63 | const int width) | ||
| 64 | { | ||
| 65 | 426874 | const pixel *src = (const pixel *)_src; | |
| 66 | 426874 | pixel *dst = (pixel *)_dst; | |
| 67 | 426874 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 68 | 426874 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 69 | 426874 | const int shift = denom + 14 - BIT_DEPTH; | |
| 70 | #if BIT_DEPTH < 14 | ||
| 71 | 426874 | const int offset = 1 << (shift - 1); | |
| 72 | #else | ||
| 73 | const int offset = 0; | ||
| 74 | #endif | ||
| 75 | 426874 | const int ox = _ox * (1 << (BIT_DEPTH - 8)); | |
| 76 | |||
| 77 |
2/2✓ Branch 0 taken 2559388 times.
✓ Branch 1 taken 213437 times.
|
5545650 | for (int y = 0; y < height; y++) { |
| 78 |
2/2✓ Branch 0 taken 70909312 times.
✓ Branch 1 taken 2559388 times.
|
146937400 | for (int x = 0; x < width; x++) { |
| 79 | 141818624 | const int v = (src[x] << (14 - BIT_DEPTH)); | |
| 80 | 141818624 | dst[x] = av_clip_pixel(((v * wx + offset) >> shift) + ox); | |
| 81 | } | ||
| 82 | 5118776 | src += src_stride; | |
| 83 | 5118776 | dst += dst_stride; | |
| 84 | } | ||
| 85 | 426874 | } | |
| 86 | |||
| 87 | #define LUMA_FILTER(src, stride) \ | ||
| 88 | (filter[0] * src[x - 3 * stride] + \ | ||
| 89 | filter[1] * src[x - 2 * stride] + \ | ||
| 90 | filter[2] * src[x - stride] + \ | ||
| 91 | filter[3] * src[x ] + \ | ||
| 92 | filter[4] * src[x + stride] + \ | ||
| 93 | filter[5] * src[x + 2 * stride] + \ | ||
| 94 | filter[6] * src[x + 3 * stride] + \ | ||
| 95 | filter[7] * src[x + 4 * stride]) | ||
| 96 | |||
| 97 | 2625848 | static void FUNC(put_luma_h)(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, | |
| 98 | const int height, const int8_t *hf, const int8_t *vf, const int width) | ||
| 99 | { | ||
| 100 | 2625848 | const pixel *src = (const pixel*)_src; | |
| 101 | 2625848 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 102 | 2625848 | const int8_t *filter = hf; | |
| 103 | |||
| 104 |
2/2✓ Branch 0 taken 21325314 times.
✓ Branch 1 taken 1312924 times.
|
45276476 | for (int y = 0; y < height; y++) { |
| 105 |
2/2✓ Branch 0 taken 628050940 times.
✓ Branch 1 taken 21325314 times.
|
1298752508 | for (int x = 0; x < width; x++) |
| 106 | 1256101880 | dst[x] = LUMA_FILTER(src, 1) >> (BIT_DEPTH - 8); | |
| 107 | 42650628 | src += src_stride; | |
| 108 | 42650628 | dst += MAX_PB_SIZE; | |
| 109 | } | ||
| 110 | 2625848 | } | |
| 111 | |||
| 112 | 2546478 | static void FUNC(put_luma_v)(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, | |
| 113 | const int height, const int8_t *hf, const int8_t *vf, const int width) | ||
| 114 | { | ||
| 115 | 2546478 | const pixel *src = (pixel*)_src; | |
| 116 | 2546478 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 117 | 2546478 | const int8_t *filter = vf; | |
| 118 | |||
| 119 |
2/2✓ Branch 0 taken 18828738 times.
✓ Branch 1 taken 1273239 times.
|
40203954 | for (int y = 0; y < height; y++) { |
| 120 |
2/2✓ Branch 0 taken 510095676 times.
✓ Branch 1 taken 18828738 times.
|
1057848828 | for (int x = 0; x < width; x++) |
| 121 | 1020191352 | dst[x] = LUMA_FILTER(src, src_stride) >> (BIT_DEPTH - 8); | |
| 122 | 37657476 | src += src_stride; | |
| 123 | 37657476 | dst += MAX_PB_SIZE; | |
| 124 | } | ||
| 125 | 2546478 | } | |
| 126 | |||
| 127 | 11914140 | static void FUNC(put_luma_hv)(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, | |
| 128 | const int height, const int8_t *hf, const int8_t *vf, const int width) | ||
| 129 | { | ||
| 130 | int16_t tmp_array[(MAX_PB_SIZE + LUMA_EXTRA) * MAX_PB_SIZE]; | ||
| 131 | 11914140 | int16_t *tmp = tmp_array; | |
| 132 | 11914140 | const pixel *src = (const pixel*)_src; | |
| 133 | 11914140 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 134 | 11914140 | const int8_t *filter = hf; | |
| 135 | |||
| 136 | 11914140 | src -= LUMA_EXTRA_BEFORE * src_stride; | |
| 137 |
2/2✓ Branch 0 taken 107954964 times.
✓ Branch 1 taken 5957070 times.
|
227824068 | for (int y = 0; y < height + LUMA_EXTRA; y++) { |
| 138 |
2/2✓ Branch 0 taken 1984340946 times.
✓ Branch 1 taken 107954964 times.
|
4184591820 | for (int x = 0; x < width; x++) |
| 139 | 3968681892 | tmp[x] = LUMA_FILTER(src, 1) >> (BIT_DEPTH - 8); | |
| 140 | 215909928 | src += src_stride; | |
| 141 | 215909928 | tmp += MAX_PB_SIZE; | |
| 142 | } | ||
| 143 | |||
| 144 | 11914140 | tmp = tmp_array + LUMA_EXTRA_BEFORE * MAX_PB_SIZE; | |
| 145 | 11914140 | filter = vf; | |
| 146 |
2/2✓ Branch 0 taken 66255474 times.
✓ Branch 1 taken 5957070 times.
|
144425088 | for (int y = 0; y < height; y++) { |
| 147 |
2/2✓ Branch 0 taken 1524614364 times.
✓ Branch 1 taken 66255474 times.
|
3181739676 | for (int x = 0; x < width; x++) |
| 148 | 3049228728 | dst[x] = LUMA_FILTER(tmp, MAX_PB_SIZE) >> 6; | |
| 149 | 132510948 | tmp += MAX_PB_SIZE; | |
| 150 | 132510948 | dst += MAX_PB_SIZE; | |
| 151 | } | ||
| 152 | 11914140 | } | |
| 153 | |||
| 154 | 2167926 | static void FUNC(put_uni_luma_h)(uint8_t *_dst, const ptrdiff_t _dst_stride, | |
| 155 | const uint8_t *_src, const ptrdiff_t _src_stride, | ||
| 156 | const int height, const int8_t *hf, const int8_t *vf, const int width) | ||
| 157 | { | ||
| 158 | 2167926 | const pixel *src = (const pixel*)_src; | |
| 159 | 2167926 | pixel *dst = (pixel *)_dst; | |
| 160 | 2167926 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 161 | 2167926 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 162 | 2167926 | const int8_t *filter = hf; | |
| 163 | 2167926 | const int shift = 14 - BIT_DEPTH; | |
| 164 | #if BIT_DEPTH < 14 | ||
| 165 | 2167926 | const int offset = 1 << (shift - 1); | |
| 166 | #else | ||
| 167 | const int offset = 0; | ||
| 168 | #endif | ||
| 169 | |||
| 170 |
2/2✓ Branch 0 taken 16284706 times.
✓ Branch 1 taken 1083963 times.
|
34737338 | for (int y = 0; y < height; y++) { |
| 171 |
2/2✓ Branch 0 taken 365668220 times.
✓ Branch 1 taken 16284706 times.
|
763905852 | for (int x = 0; x < width; x++) { |
| 172 | 731336440 | const int val = LUMA_FILTER(src, 1) >> (BIT_DEPTH - 8); | |
| 173 | 731336440 | dst[x] = av_clip_pixel((val + offset) >> shift); | |
| 174 | } | ||
| 175 | 32569412 | src += src_stride; | |
| 176 | 32569412 | dst += dst_stride; | |
| 177 | } | ||
| 178 | 2167926 | } | |
| 179 | |||
| 180 | 2025738 | static void FUNC(put_uni_luma_v)(uint8_t *_dst, const ptrdiff_t _dst_stride, | |
| 181 | const uint8_t *_src, const ptrdiff_t _src_stride, | ||
| 182 | const int height, const int8_t *hf, const int8_t *vf, const int width) | ||
| 183 | { | ||
| 184 | |||
| 185 | 2025738 | const pixel *src = (const pixel*)_src; | |
| 186 | 2025738 | pixel *dst = (pixel *)_dst; | |
| 187 | 2025738 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 188 | 2025738 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 189 | 2025738 | const int8_t *filter = vf; | |
| 190 | 2025738 | const int shift = 14 - BIT_DEPTH; | |
| 191 | #if BIT_DEPTH < 14 | ||
| 192 | 2025738 | const int offset = 1 << (shift - 1); | |
| 193 | #else | ||
| 194 | const int offset = 0; | ||
| 195 | #endif | ||
| 196 | |||
| 197 |
2/2✓ Branch 0 taken 15837810 times.
✓ Branch 1 taken 1012869 times.
|
33701358 | for (int y = 0; y < height; y++) { |
| 198 |
2/2✓ Branch 0 taken 380133068 times.
✓ Branch 1 taken 15837810 times.
|
791941756 | for (int x = 0; x < width; x++) { |
| 199 | 760266136 | const int val = LUMA_FILTER(src, src_stride) >> (BIT_DEPTH - 8); | |
| 200 | 760266136 | dst[x] = av_clip_pixel((val + offset) >> shift); | |
| 201 | } | ||
| 202 | 31675620 | src += src_stride; | |
| 203 | 31675620 | dst += dst_stride; | |
| 204 | } | ||
| 205 | 2025738 | } | |
| 206 | |||
| 207 | 6267416 | static void FUNC(put_uni_luma_hv)(uint8_t *_dst, const ptrdiff_t _dst_stride, | |
| 208 | const uint8_t *_src, const ptrdiff_t _src_stride, | ||
| 209 | const int height, const int8_t *hf, const int8_t *vf, const int width) | ||
| 210 | { | ||
| 211 | int16_t tmp_array[(MAX_PB_SIZE + LUMA_EXTRA) * MAX_PB_SIZE]; | ||
| 212 | 6267416 | int16_t *tmp = tmp_array; | |
| 213 | 6267416 | const pixel *src = (const pixel*)_src; | |
| 214 | 6267416 | pixel *dst = (pixel *)_dst; | |
| 215 | 6267416 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 216 | 6267416 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 217 | 6267416 | const int8_t *filter = hf; | |
| 218 | 6267416 | const int shift = 14 - BIT_DEPTH; | |
| 219 | #if BIT_DEPTH < 14 | ||
| 220 | 6267416 | const int offset = 1 << (shift - 1); | |
| 221 | #else | ||
| 222 | const int offset = 0; | ||
| 223 | #endif | ||
| 224 | |||
| 225 | 6267416 | src -= LUMA_EXTRA_BEFORE * src_stride; | |
| 226 |
2/2✓ Branch 0 taken 68747094 times.
✓ Branch 1 taken 3133708 times.
|
143761604 | for (int y = 0; y < height + LUMA_EXTRA; y++) { |
| 227 |
2/2✓ Branch 0 taken 1336675414 times.
✓ Branch 1 taken 68747094 times.
|
2810845016 | for (int x = 0; x < width; x++) |
| 228 | 2673350828 | tmp[x] = LUMA_FILTER(src, 1) >> (BIT_DEPTH - 8); | |
| 229 | 137494188 | src += src_stride; | |
| 230 | 137494188 | tmp += MAX_PB_SIZE; | |
| 231 | } | ||
| 232 | |||
| 233 | 6267416 | tmp = tmp_array + LUMA_EXTRA_BEFORE * MAX_PB_SIZE; | |
| 234 | 6267416 | filter = vf; | |
| 235 | |||
| 236 |
2/2✓ Branch 0 taken 46811138 times.
✓ Branch 1 taken 3133708 times.
|
99889692 | for (int y = 0; y < height; y++) { |
| 237 |
2/2✓ Branch 0 taken 1015601276 times.
✓ Branch 1 taken 46811138 times.
|
2124824828 | for (int x = 0; x < width; x++) { |
| 238 | 2031202552 | const int val = LUMA_FILTER(tmp, MAX_PB_SIZE) >> 6; | |
| 239 | 2031202552 | dst[x] = av_clip_pixel((val + offset) >> shift); | |
| 240 | } | ||
| 241 | 93622276 | tmp += MAX_PB_SIZE; | |
| 242 | 93622276 | dst += dst_stride; | |
| 243 | } | ||
| 244 | |||
| 245 | 6267416 | } | |
| 246 | |||
| 247 | 61566 | static void FUNC(put_uni_luma_w_h)(uint8_t *_dst, const ptrdiff_t _dst_stride, | |
| 248 | const uint8_t *_src, const ptrdiff_t _src_stride, int height, | ||
| 249 | const int denom, const int wx, const int _ox, const int8_t *hf, const int8_t *vf, | ||
| 250 | const int width) | ||
| 251 | { | ||
| 252 | 61566 | const pixel *src = (const pixel*)_src; | |
| 253 | 61566 | pixel *dst = (pixel *)_dst; | |
| 254 | 61566 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 255 | 61566 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 256 | 61566 | const int8_t *filter = hf; | |
| 257 | 61566 | const int ox = _ox * (1 << (BIT_DEPTH - 8)); | |
| 258 | 61566 | const int shift = denom + 14 - BIT_DEPTH; | |
| 259 | #if BIT_DEPTH < 14 | ||
| 260 | 61566 | const int offset = 1 << (shift - 1); | |
| 261 | #else | ||
| 262 | const int offset = 0; | ||
| 263 | #endif | ||
| 264 | |||
| 265 |
2/2✓ Branch 0 taken 476160 times.
✓ Branch 1 taken 30783 times.
|
1013886 | for (int y = 0; y < height; y++) { |
| 266 |
2/2✓ Branch 0 taken 14154256 times.
✓ Branch 1 taken 476160 times.
|
29260832 | for (int x = 0; x < width; x++) |
| 267 | 28308512 | dst[x] = av_clip_pixel((((LUMA_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx + offset) >> shift) + ox); | |
| 268 | 952320 | src += src_stride; | |
| 269 | 952320 | dst += dst_stride; | |
| 270 | } | ||
| 271 | 61566 | } | |
| 272 | |||
| 273 | 55336 | static void FUNC(put_uni_luma_w_v)(uint8_t *_dst, const ptrdiff_t _dst_stride, | |
| 274 | const uint8_t *_src, const ptrdiff_t _src_stride, const int height, | ||
| 275 | const int denom, const int wx, const int _ox, const int8_t *hf, const int8_t *vf, | ||
| 276 | const int width) | ||
| 277 | { | ||
| 278 | 55336 | const pixel *src = (const pixel*)_src; | |
| 279 | 55336 | pixel *dst = (pixel *)_dst; | |
| 280 | 55336 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 281 | 55336 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 282 | 55336 | const int8_t *filter = vf; | |
| 283 | 55336 | const int ox = _ox * (1 << (BIT_DEPTH - 8)); | |
| 284 | 55336 | const int shift = denom + 14 - BIT_DEPTH; | |
| 285 | #if BIT_DEPTH < 14 | ||
| 286 | 55336 | const int offset = 1 << (shift - 1); | |
| 287 | #else | ||
| 288 | const int offset = 0; | ||
| 289 | #endif | ||
| 290 | |||
| 291 |
2/2✓ Branch 0 taken 373308 times.
✓ Branch 1 taken 27668 times.
|
801952 | for (int y = 0; y < height; y++) { |
| 292 |
2/2✓ Branch 0 taken 9843088 times.
✓ Branch 1 taken 373308 times.
|
20432792 | for (int x = 0; x < width; x++) |
| 293 | 19686176 | dst[x] = av_clip_pixel((((LUMA_FILTER(src, src_stride) >> (BIT_DEPTH - 8)) * wx + offset) >> shift) + ox); | |
| 294 | 746616 | src += src_stride; | |
| 295 | 746616 | dst += dst_stride; | |
| 296 | } | ||
| 297 | 55336 | } | |
| 298 | |||
| 299 | 179202 | static void FUNC(put_uni_luma_w_hv)(uint8_t *_dst, const ptrdiff_t _dst_stride, | |
| 300 | const uint8_t *_src, const ptrdiff_t _src_stride, const int height, const int denom, | ||
| 301 | const int wx, const int _ox, const int8_t *hf, const int8_t *vf, const int width) | ||
| 302 | { | ||
| 303 | int16_t tmp_array[(MAX_PB_SIZE + LUMA_EXTRA) * MAX_PB_SIZE]; | ||
| 304 | 179202 | int16_t *tmp = tmp_array; | |
| 305 | 179202 | const pixel *src = (const pixel*)_src; | |
| 306 | 179202 | pixel *dst = (pixel *)_dst; | |
| 307 | 179202 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 308 | 179202 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 309 | 179202 | const int8_t *filter = hf; | |
| 310 | 179202 | const int ox = _ox * (1 << (BIT_DEPTH - 8)); | |
| 311 | 179202 | const int shift = denom + 14 - BIT_DEPTH; | |
| 312 | #if BIT_DEPTH < 14 | ||
| 313 | 179202 | const int offset = 1 << (shift - 1); | |
| 314 | #else | ||
| 315 | const int offset = 0; | ||
| 316 | #endif | ||
| 317 | |||
| 318 | 179202 | src -= LUMA_EXTRA_BEFORE * src_stride; | |
| 319 |
2/2✓ Branch 0 taken 1834415 times.
✓ Branch 1 taken 89601 times.
|
3848032 | for (int y = 0; y < height + LUMA_EXTRA; y++) { |
| 320 |
2/2✓ Branch 0 taken 40946140 times.
✓ Branch 1 taken 1834415 times.
|
85561110 | for (int x = 0; x < width; x++) |
| 321 | 81892280 | tmp[x] = LUMA_FILTER(src, 1) >> (BIT_DEPTH - 8); | |
| 322 | 3668830 | src += src_stride; | |
| 323 | 3668830 | tmp += MAX_PB_SIZE; | |
| 324 | } | ||
| 325 | |||
| 326 | 179202 | tmp = tmp_array + LUMA_EXTRA_BEFORE * MAX_PB_SIZE; | |
| 327 | 179202 | filter = vf; | |
| 328 |
2/2✓ Branch 0 taken 1207208 times.
✓ Branch 1 taken 89601 times.
|
2593618 | for (int y = 0; y < height; y++) { |
| 329 |
2/2✓ Branch 0 taken 32797104 times.
✓ Branch 1 taken 1207208 times.
|
68008624 | for (int x = 0; x < width; x++) |
| 330 | 65594208 | dst[x] = av_clip_pixel((((LUMA_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx + offset) >> shift) + ox); | |
| 331 | 2414416 | tmp += MAX_PB_SIZE; | |
| 332 | 2414416 | dst += dst_stride; | |
| 333 | } | ||
| 334 | 179202 | } | |
| 335 | |||
| 336 | #define CHROMA_FILTER(src, stride) \ | ||
| 337 | (filter[0] * src[x - stride] + \ | ||
| 338 | filter[1] * src[x] + \ | ||
| 339 | filter[2] * src[x + stride] + \ | ||
| 340 | filter[3] * src[x + 2 * stride]) | ||
| 341 | |||
| 342 | 3544616 | static void FUNC(put_chroma_h)(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, | |
| 343 | const int height, const int8_t *hf, const int8_t *vf, const int width) | ||
| 344 | { | ||
| 345 | 3544616 | const pixel *src = (const pixel *)_src; | |
| 346 | 3544616 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 347 | 3544616 | const int8_t *filter = hf; | |
| 348 | |||
| 349 |
2/2✓ Branch 0 taken 19020076 times.
✓ Branch 1 taken 1772308 times.
|
41584768 | for (int y = 0; y < height; y++) { |
| 350 |
2/2✓ Branch 0 taken 316208712 times.
✓ Branch 1 taken 19020076 times.
|
670457576 | for (int x = 0; x < width; x++) |
| 351 | 632417424 | dst[x] = CHROMA_FILTER(src, 1) >> (BIT_DEPTH - 8); | |
| 352 | 38040152 | src += src_stride; | |
| 353 | 38040152 | dst += MAX_PB_SIZE; | |
| 354 | } | ||
| 355 | 3544616 | } | |
| 356 | |||
| 357 | 3329300 | static void FUNC(put_chroma_v)(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, | |
| 358 | const int height, const int8_t *hf, const int8_t *vf, const int width) | ||
| 359 | { | ||
| 360 | 3329300 | const pixel *src = (const pixel *)_src; | |
| 361 | 3329300 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 362 | 3329300 | const int8_t *filter = vf; | |
| 363 | |||
| 364 |
2/2✓ Branch 0 taken 16701188 times.
✓ Branch 1 taken 1664650 times.
|
36731676 | for (int y = 0; y < height; y++) { |
| 365 |
2/2✓ Branch 0 taken 270694056 times.
✓ Branch 1 taken 16701188 times.
|
574790488 | for (int x = 0; x < width; x++) |
| 366 | 541388112 | dst[x] = CHROMA_FILTER(src, src_stride) >> (BIT_DEPTH - 8); | |
| 367 | 33402376 | src += src_stride; | |
| 368 | 33402376 | dst += MAX_PB_SIZE; | |
| 369 | } | ||
| 370 | 3329300 | } | |
| 371 | |||
| 372 | 16426272 | static void FUNC(put_chroma_hv)(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, | |
| 373 | const int height, const int8_t *hf, const int8_t *vf, const int width) | ||
| 374 | { | ||
| 375 | int16_t tmp_array[(MAX_PB_SIZE + CHROMA_EXTRA) * MAX_PB_SIZE]; | ||
| 376 | 16426272 | int16_t *tmp = tmp_array; | |
| 377 | 16426272 | const pixel *src = (const pixel *)_src; | |
| 378 | 16426272 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 379 | 16426272 | const int8_t *filter = hf; | |
| 380 | |||
| 381 | 16426272 | src -= CHROMA_EXTRA_BEFORE * src_stride; | |
| 382 | |||
| 383 |
2/2✓ Branch 0 taken 101671304 times.
✓ Branch 1 taken 8213136 times.
|
219768880 | for (int y = 0; y < height + CHROMA_EXTRA; y++) { |
| 384 |
2/2✓ Branch 0 taken 1306822548 times.
✓ Branch 1 taken 101671304 times.
|
2816987704 | for (int x = 0; x < width; x++) |
| 385 | 2613645096 | tmp[x] = CHROMA_FILTER(src, 1) >> (BIT_DEPTH - 8); | |
| 386 | 203342608 | src += src_stride; | |
| 387 | 203342608 | tmp += MAX_PB_SIZE; | |
| 388 | } | ||
| 389 | |||
| 390 | 16426272 | tmp = tmp_array + CHROMA_EXTRA_BEFORE * MAX_PB_SIZE; | |
| 391 | 16426272 | filter = vf; | |
| 392 | |||
| 393 |
2/2✓ Branch 0 taken 77031896 times.
✓ Branch 1 taken 8213136 times.
|
170490064 | for (int y = 0; y < height; y++) { |
| 394 |
2/2✓ Branch 0 taken 1085381544 times.
✓ Branch 1 taken 77031896 times.
|
2324826880 | for (int x = 0; x < width; x++) |
| 395 | 2170763088 | dst[x] = CHROMA_FILTER(tmp, MAX_PB_SIZE) >> 6; | |
| 396 | 154063792 | tmp += MAX_PB_SIZE; | |
| 397 | 154063792 | dst += MAX_PB_SIZE; | |
| 398 | } | ||
| 399 | 16426272 | } | |
| 400 | |||
| 401 | 3733572 | static void FUNC(put_uni_chroma_h)(uint8_t *_dst, const ptrdiff_t _dst_stride, | |
| 402 | const uint8_t *_src, const ptrdiff_t _src_stride, | ||
| 403 | const int height, const int8_t *hf, const int8_t *vf, const int width) | ||
| 404 | { | ||
| 405 | 3733572 | const pixel *src = (const pixel *)_src; | |
| 406 | 3733572 | pixel *dst = (pixel *)_dst; | |
| 407 | 3733572 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 408 | 3733572 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 409 | 3733572 | const int8_t *filter = hf; | |
| 410 | 3733572 | const int shift = 14 - BIT_DEPTH; | |
| 411 | #if BIT_DEPTH < 14 | ||
| 412 | 3733572 | const int offset = 1 << (shift - 1); | |
| 413 | #else | ||
| 414 | const int offset = 0; | ||
| 415 | #endif | ||
| 416 | |||
| 417 |
2/2✓ Branch 0 taken 13736456 times.
✓ Branch 1 taken 1866786 times.
|
31206484 | for (int y = 0; y < height; y++) { |
| 418 |
2/2✓ Branch 0 taken 153314504 times.
✓ Branch 1 taken 13736456 times.
|
334101920 | for (int x = 0; x < width; x++) |
| 419 | 306629008 | dst[x] = av_clip_pixel(((CHROMA_FILTER(src, 1) >> (BIT_DEPTH - 8)) + offset) >> shift); | |
| 420 | 27472912 | src += src_stride; | |
| 421 | 27472912 | dst += dst_stride; | |
| 422 | } | ||
| 423 | 3733572 | } | |
| 424 | |||
| 425 | 3311580 | static void FUNC(put_uni_chroma_v)(uint8_t *_dst, const ptrdiff_t _dst_stride, | |
| 426 | const uint8_t *_src, const ptrdiff_t _src_stride, | ||
| 427 | const int height, const int8_t *hf, const int8_t *vf, const int width) | ||
| 428 | { | ||
| 429 | 3311580 | const pixel *src = (const pixel *)_src; | |
| 430 | 3311580 | pixel *dst = (pixel *)_dst; | |
| 431 | 3311580 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 432 | 3311580 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 433 | 3311580 | const int8_t *filter = vf; | |
| 434 | 3311580 | const int shift = 14 - BIT_DEPTH; | |
| 435 | #if BIT_DEPTH < 14 | ||
| 436 | 3311580 | const int offset = 1 << (shift - 1); | |
| 437 | #else | ||
| 438 | const int offset = 0; | ||
| 439 | #endif | ||
| 440 | |||
| 441 |
2/2✓ Branch 0 taken 12701660 times.
✓ Branch 1 taken 1655790 times.
|
28714900 | for (int y = 0; y < height; y++) { |
| 442 |
2/2✓ Branch 0 taken 151325672 times.
✓ Branch 1 taken 12701660 times.
|
328054664 | for (int x = 0; x < width; x++) |
| 443 | 302651344 | dst[x] = av_clip_pixel(((CHROMA_FILTER(src, src_stride) >> (BIT_DEPTH - 8)) + offset) >> shift); | |
| 444 | 25403320 | src += src_stride; | |
| 445 | 25403320 | dst += dst_stride; | |
| 446 | } | ||
| 447 | 3311580 | } | |
| 448 | |||
| 449 | 18576392 | static void FUNC(put_uni_chroma_hv)(uint8_t *_dst, const ptrdiff_t _dst_stride, | |
| 450 | const uint8_t *_src, const ptrdiff_t _src_stride, | ||
| 451 | const int height, const int8_t *hf, const int8_t *vf, const int width) | ||
| 452 | { | ||
| 453 | int16_t tmp_array[(MAX_PB_SIZE + CHROMA_EXTRA) * MAX_PB_SIZE]; | ||
| 454 | 18576392 | int16_t *tmp = tmp_array; | |
| 455 | 18576392 | const pixel *src = (const pixel *)_src; | |
| 456 | 18576392 | pixel *dst = (pixel *)_dst; | |
| 457 | 18576392 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 458 | 18576392 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 459 | 18576392 | const int8_t *filter = hf; | |
| 460 | 18576392 | const int shift = 14 - BIT_DEPTH; | |
| 461 | #if BIT_DEPTH < 14 | ||
| 462 | 18576392 | const int offset = 1 << (shift - 1); | |
| 463 | #else | ||
| 464 | const int offset = 0; | ||
| 465 | #endif | ||
| 466 | |||
| 467 | 18576392 | src -= CHROMA_EXTRA_BEFORE * src_stride; | |
| 468 | |||
| 469 |
2/2✓ Branch 0 taken 94246008 times.
✓ Branch 1 taken 9288196 times.
|
207068408 | for (int y = 0; y < height + CHROMA_EXTRA; y++) { |
| 470 |
2/2✓ Branch 0 taken 900955360 times.
✓ Branch 1 taken 94246008 times.
|
1990402736 | for (int x = 0; x < width; x++) |
| 471 | 1801910720 | tmp[x] = CHROMA_FILTER(src, 1) >> (BIT_DEPTH - 8); | |
| 472 | 188492016 | src += src_stride; | |
| 473 | 188492016 | tmp += MAX_PB_SIZE; | |
| 474 | } | ||
| 475 | |||
| 476 | 18576392 | tmp = tmp_array + CHROMA_EXTRA_BEFORE * MAX_PB_SIZE; | |
| 477 | 18576392 | filter = vf; | |
| 478 | |||
| 479 |
2/2✓ Branch 0 taken 66381420 times.
✓ Branch 1 taken 9288196 times.
|
151339232 | for (int y = 0; y < height; y++) { |
| 480 |
2/2✓ Branch 0 taken 706272952 times.
✓ Branch 1 taken 66381420 times.
|
1545308744 | for (int x = 0; x < width; x++) |
| 481 | 1412545904 | dst[x] = av_clip_pixel(((CHROMA_FILTER(tmp, MAX_PB_SIZE) >> 6) + offset) >> shift); | |
| 482 | 132762840 | tmp += MAX_PB_SIZE; | |
| 483 | 132762840 | dst += dst_stride; | |
| 484 | } | ||
| 485 | 18576392 | } | |
| 486 | |||
| 487 | 78496 | static void FUNC(put_uni_chroma_w_h)(uint8_t *_dst, ptrdiff_t _dst_stride, | |
| 488 | const uint8_t *_src, ptrdiff_t _src_stride, int height, int denom, int wx, int ox, | ||
| 489 | const int8_t *hf, const int8_t *vf, int width) | ||
| 490 | { | ||
| 491 | 78496 | const pixel *src = (const pixel *)_src; | |
| 492 | 78496 | pixel *dst = (pixel *)_dst; | |
| 493 | 78496 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 494 | 78496 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 495 | 78496 | const int8_t *filter = hf; | |
| 496 | 78496 | const int shift = denom + 14 - BIT_DEPTH; | |
| 497 | #if BIT_DEPTH < 14 | ||
| 498 | 78496 | const int offset = 1 << (shift - 1); | |
| 499 | #else | ||
| 500 | const int offset = 0; | ||
| 501 | #endif | ||
| 502 | |||
| 503 | 78496 | ox = ox * (1 << (BIT_DEPTH - 8)); | |
| 504 |
2/2✓ Branch 0 taken 406016 times.
✓ Branch 1 taken 39248 times.
|
890528 | for (int y = 0; y < height; y++) { |
| 505 |
2/2✓ Branch 0 taken 7349904 times.
✓ Branch 1 taken 406016 times.
|
15511840 | for (int x = 0; x < width; x++) { |
| 506 | 14699808 | dst[x] = av_clip_pixel((((CHROMA_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx + offset) >> shift) + ox); | |
| 507 | } | ||
| 508 | 812032 | dst += dst_stride; | |
| 509 | 812032 | src += src_stride; | |
| 510 | } | ||
| 511 | 78496 | } | |
| 512 | |||
| 513 | 62212 | static void FUNC(put_uni_chroma_w_v)(uint8_t *_dst, const ptrdiff_t _dst_stride, | |
| 514 | const uint8_t *_src, const ptrdiff_t _src_stride, const int height, | ||
| 515 | const int denom, const int wx, const int _ox, const int8_t *hf, const int8_t *vf, | ||
| 516 | const int width) | ||
| 517 | { | ||
| 518 | 62212 | const pixel *src = (const pixel *)_src; | |
| 519 | 62212 | pixel *dst = (pixel *)_dst; | |
| 520 | 62212 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 521 | 62212 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 522 | 62212 | const int8_t *filter = vf; | |
| 523 | 62212 | const int shift = denom + 14 - BIT_DEPTH; | |
| 524 | 62212 | const int ox = _ox * (1 << (BIT_DEPTH - 8)); | |
| 525 | #if BIT_DEPTH < 14 | ||
| 526 | 62212 | int offset = 1 << (shift - 1); | |
| 527 | #else | ||
| 528 | int offset = 0; | ||
| 529 | #endif | ||
| 530 | |||
| 531 |
2/2✓ Branch 0 taken 282592 times.
✓ Branch 1 taken 31106 times.
|
627396 | for (int y = 0; y < height; y++) { |
| 532 |
2/2✓ Branch 0 taken 4947744 times.
✓ Branch 1 taken 282592 times.
|
10460672 | for (int x = 0; x < width; x++) { |
| 533 | 9895488 | dst[x] = av_clip_pixel((((CHROMA_FILTER(src, src_stride) >> (BIT_DEPTH - 8)) * wx + offset) >> shift) + ox); | |
| 534 | } | ||
| 535 | 565184 | dst += dst_stride; | |
| 536 | 565184 | src += src_stride; | |
| 537 | } | ||
| 538 | 62212 | } | |
| 539 | |||
| 540 | 363340 | static void FUNC(put_uni_chroma_w_hv)(uint8_t *_dst, ptrdiff_t _dst_stride, | |
| 541 | const uint8_t *_src, ptrdiff_t _src_stride, int height, int denom, int wx, int ox, | ||
| 542 | const int8_t *hf, const int8_t *vf, int width) | ||
| 543 | { | ||
| 544 | int16_t tmp_array[(MAX_PB_SIZE + CHROMA_EXTRA) * MAX_PB_SIZE]; | ||
| 545 | 363340 | int16_t *tmp = tmp_array; | |
| 546 | 363340 | const pixel *src = (const pixel *)_src; | |
| 547 | 363340 | pixel *dst = (pixel *)_dst; | |
| 548 | 363340 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 549 | 363340 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 550 | 363340 | const int8_t *filter = hf; | |
| 551 | 363340 | const int shift = denom + 14 - BIT_DEPTH; | |
| 552 | #if BIT_DEPTH < 14 | ||
| 553 | 363340 | const int offset = 1 << (shift - 1); | |
| 554 | #else | ||
| 555 | const int offset = 0; | ||
| 556 | #endif | ||
| 557 | |||
| 558 | 363340 | src -= CHROMA_EXTRA_BEFORE * src_stride; | |
| 559 | |||
| 560 |
2/2✓ Branch 0 taken 2027410 times.
✓ Branch 1 taken 181670 times.
|
4418160 | for (int y = 0; y < height + CHROMA_EXTRA; y++) { |
| 561 |
2/2✓ Branch 0 taken 24908784 times.
✓ Branch 1 taken 2027410 times.
|
53872388 | for (int x = 0; x < width; x++) |
| 562 | 49817568 | tmp[x] = CHROMA_FILTER(src, 1) >> (BIT_DEPTH - 8); | |
| 563 | 4054820 | src += src_stride; | |
| 564 | 4054820 | tmp += MAX_PB_SIZE; | |
| 565 | } | ||
| 566 | |||
| 567 | 363340 | tmp = tmp_array + CHROMA_EXTRA_BEFORE * MAX_PB_SIZE; | |
| 568 | 363340 | filter = vf; | |
| 569 | |||
| 570 | 363340 | ox = ox * (1 << (BIT_DEPTH - 8)); | |
| 571 |
2/2✓ Branch 0 taken 1482400 times.
✓ Branch 1 taken 181670 times.
|
3328140 | for (int y = 0; y < height; y++) { |
| 572 |
2/2✓ Branch 0 taken 20620272 times.
✓ Branch 1 taken 1482400 times.
|
44205344 | for (int x = 0; x < width; x++) |
| 573 | 41240544 | dst[x] = av_clip_pixel((((CHROMA_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx + offset) >> shift) + ox); | |
| 574 | 2964800 | tmp += MAX_PB_SIZE; | |
| 575 | 2964800 | dst += dst_stride; | |
| 576 | } | ||
| 577 | 363340 | } | |
| 578 |