| 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 | 17952350 | 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 | 17952350 | const pixel *src = (const pixel *)_src; | |
| 34 | 17952350 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 35 | |||
| 36 |
2/2✓ Branch 0 taken 108504428 times.
✓ Branch 1 taken 8976175 times.
|
234961206 | for (int y = 0; y < height; y++) { |
| 37 |
2/2✓ Branch 0 taken 2049376904 times.
✓ Branch 1 taken 108504428 times.
|
4315762664 | for (int x = 0; x < width; x++) |
| 38 | 4098753808 | dst[x] = src[x] << (14 - BIT_DEPTH); | |
| 39 | 217008856 | src += src_stride; | |
| 40 | 217008856 | dst += MAX_PB_SIZE; | |
| 41 | } | ||
| 42 | 17952350 | } | |
| 43 | |||
| 44 | 10519580 | 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 | 10519580 | const pixel *src = (const pixel *)_src; | |
| 49 | 10519580 | pixel *dst = (pixel *)_dst; | |
| 50 | 10519580 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 51 | 10519580 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 52 | |||
| 53 |
2/2✓ Branch 0 taken 51796128 times.
✓ Branch 1 taken 5259790 times.
|
114111836 | for (int y = 0; y < height; y++) { |
| 54 | 103592256 | memcpy(dst, src, width * sizeof(pixel)); | |
| 55 | 103592256 | src += src_stride; | |
| 56 | 103592256 | dst += dst_stride; | |
| 57 | } | ||
| 58 | 10519580 | } | |
| 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 | 2625840 | 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 | 2625840 | const pixel *src = (const pixel*)_src; | |
| 101 | 2625840 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 102 | 2625840 | const int8_t *filter = hf; | |
| 103 | |||
| 104 |
2/2✓ Branch 0 taken 21325210 times.
✓ Branch 1 taken 1312920 times.
|
45276260 | for (int y = 0; y < height; y++) { |
| 105 |
2/2✓ Branch 0 taken 628047804 times.
✓ Branch 1 taken 21325210 times.
|
1298746028 | for (int x = 0; x < width; x++) |
| 106 | 1256095608 | dst[x] = LUMA_FILTER(src, 1) >> (BIT_DEPTH - 8); | |
| 107 | 42650420 | src += src_stride; | |
| 108 | 42650420 | dst += MAX_PB_SIZE; | |
| 109 | } | ||
| 110 | 2625840 | } | |
| 111 | |||
| 112 | 2546416 | 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 | 2546416 | const pixel *src = (pixel*)_src; | |
| 116 | 2546416 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 117 | 2546416 | const int8_t *filter = vf; | |
| 118 | |||
| 119 |
2/2✓ Branch 0 taken 18827874 times.
✓ Branch 1 taken 1273208 times.
|
40202164 | for (int y = 0; y < height; y++) { |
| 120 |
2/2✓ Branch 0 taken 510070076 times.
✓ Branch 1 taken 18827874 times.
|
1057795900 | for (int x = 0; x < width; x++) |
| 121 | 1020140152 | dst[x] = LUMA_FILTER(src, src_stride) >> (BIT_DEPTH - 8); | |
| 122 | 37655748 | src += src_stride; | |
| 123 | 37655748 | dst += MAX_PB_SIZE; | |
| 124 | } | ||
| 125 | 2546416 | } | |
| 126 | |||
| 127 | 11914062 | 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 | 11914062 | int16_t *tmp = tmp_array; | |
| 132 | 11914062 | const pixel *src = (const pixel*)_src; | |
| 133 | 11914062 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 134 | 11914062 | const int8_t *filter = hf; | |
| 135 | |||
| 136 | 11914062 | src -= LUMA_EXTRA_BEFORE * src_stride; | |
| 137 |
2/2✓ Branch 0 taken 107953523 times.
✓ Branch 1 taken 5957031 times.
|
227821108 | for (int y = 0; y < height + LUMA_EXTRA; y++) { |
| 138 |
2/2✓ Branch 0 taken 1984296674 times.
✓ Branch 1 taken 107953523 times.
|
4184500394 | for (int x = 0; x < width; x++) |
| 139 | 3968593348 | tmp[x] = LUMA_FILTER(src, 1) >> (BIT_DEPTH - 8); | |
| 140 | 215907046 | src += src_stride; | |
| 141 | 215907046 | tmp += MAX_PB_SIZE; | |
| 142 | } | ||
| 143 | |||
| 144 | 11914062 | tmp = tmp_array + LUMA_EXTRA_BEFORE * MAX_PB_SIZE; | |
| 145 | 11914062 | filter = vf; | |
| 146 |
2/2✓ Branch 0 taken 66254306 times.
✓ Branch 1 taken 5957031 times.
|
144422674 | for (int y = 0; y < height; y++) { |
| 147 |
2/2✓ Branch 0 taken 1524578268 times.
✓ Branch 1 taken 66254306 times.
|
3181665148 | for (int x = 0; x < width; x++) |
| 148 | 3049156536 | dst[x] = LUMA_FILTER(tmp, MAX_PB_SIZE) >> 6; | |
| 149 | 132508612 | tmp += MAX_PB_SIZE; | |
| 150 | 132508612 | dst += MAX_PB_SIZE; | |
| 151 | } | ||
| 152 | 11914062 | } | |
| 153 | |||
| 154 | 2064958 | 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 | 2064958 | const pixel *src = (const pixel*)_src; | |
| 159 | 2064958 | pixel *dst = (pixel *)_dst; | |
| 160 | 2064958 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 161 | 2064958 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 162 | 2064958 | const int8_t *filter = hf; | |
| 163 | 2064958 | const int shift = 14 - BIT_DEPTH; | |
| 164 | #if BIT_DEPTH < 14 | ||
| 165 | 2064958 | const int offset = 1 << (shift - 1); | |
| 166 | #else | ||
| 167 | const int offset = 0; | ||
| 168 | #endif | ||
| 169 | |||
| 170 |
2/2✓ Branch 0 taken 15182618 times.
✓ Branch 1 taken 1032479 times.
|
32430194 | for (int y = 0; y < height; y++) { |
| 171 |
2/2✓ Branch 0 taken 328562684 times.
✓ Branch 1 taken 15182618 times.
|
687490604 | for (int x = 0; x < width; x++) { |
| 172 | 657125368 | const int val = LUMA_FILTER(src, 1) >> (BIT_DEPTH - 8); | |
| 173 | 657125368 | dst[x] = av_clip_pixel((val + offset) >> shift); | |
| 174 | } | ||
| 175 | 30365236 | src += src_stride; | |
| 176 | 30365236 | dst += dst_stride; | |
| 177 | } | ||
| 178 | 2064958 | } | |
| 179 | |||
| 180 | 1941458 | 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 | 1941458 | const pixel *src = (const pixel*)_src; | |
| 186 | 1941458 | pixel *dst = (pixel *)_dst; | |
| 187 | 1941458 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 188 | 1941458 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 189 | 1941458 | const int8_t *filter = vf; | |
| 190 | 1941458 | const int shift = 14 - BIT_DEPTH; | |
| 191 | #if BIT_DEPTH < 14 | ||
| 192 | 1941458 | const int offset = 1 << (shift - 1); | |
| 193 | #else | ||
| 194 | const int offset = 0; | ||
| 195 | #endif | ||
| 196 | |||
| 197 |
2/2✓ Branch 0 taken 14761298 times.
✓ Branch 1 taken 970729 times.
|
31464054 | for (int y = 0; y < height; y++) { |
| 198 |
2/2✓ Branch 0 taken 337009420 times.
✓ Branch 1 taken 14761298 times.
|
703541436 | for (int x = 0; x < width; x++) { |
| 199 | 674018840 | const int val = LUMA_FILTER(src, src_stride) >> (BIT_DEPTH - 8); | |
| 200 | 674018840 | dst[x] = av_clip_pixel((val + offset) >> shift); | |
| 201 | } | ||
| 202 | 29522596 | src += src_stride; | |
| 203 | 29522596 | dst += dst_stride; | |
| 204 | } | ||
| 205 | 1941458 | } | |
| 206 | |||
| 207 | 6025902 | 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 | 6025902 | int16_t *tmp = tmp_array; | |
| 213 | 6025902 | const pixel *src = (const pixel*)_src; | |
| 214 | 6025902 | pixel *dst = (pixel *)_dst; | |
| 215 | 6025902 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 216 | 6025902 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 217 | 6025902 | const int8_t *filter = hf; | |
| 218 | 6025902 | const int shift = 14 - BIT_DEPTH; | |
| 219 | #if BIT_DEPTH < 14 | ||
| 220 | 6025902 | const int offset = 1 << (shift - 1); | |
| 221 | #else | ||
| 222 | const int offset = 0; | ||
| 223 | #endif | ||
| 224 | |||
| 225 | 6025902 | src -= LUMA_EXTRA_BEFORE * src_stride; | |
| 226 |
2/2✓ Branch 0 taken 65134507 times.
✓ Branch 1 taken 3012951 times.
|
136294916 | for (int y = 0; y < height + LUMA_EXTRA; y++) { |
| 227 |
2/2✓ Branch 0 taken 1218903334 times.
✓ Branch 1 taken 65134507 times.
|
2568075682 | for (int x = 0; x < width; x++) |
| 228 | 2437806668 | tmp[x] = LUMA_FILTER(src, 1) >> (BIT_DEPTH - 8); | |
| 229 | 130269014 | src += src_stride; | |
| 230 | 130269014 | tmp += MAX_PB_SIZE; | |
| 231 | } | ||
| 232 | |||
| 233 | 6025902 | tmp = tmp_array + LUMA_EXTRA_BEFORE * MAX_PB_SIZE; | |
| 234 | 6025902 | filter = vf; | |
| 235 | |||
| 236 |
2/2✓ Branch 0 taken 44043850 times.
✓ Branch 1 taken 3012951 times.
|
94113602 | for (int y = 0; y < height; y++) { |
| 237 |
2/2✓ Branch 0 taken 917379132 times.
✓ Branch 1 taken 44043850 times.
|
1922845964 | for (int x = 0; x < width; x++) { |
| 238 | 1834758264 | const int val = LUMA_FILTER(tmp, MAX_PB_SIZE) >> 6; | |
| 239 | 1834758264 | dst[x] = av_clip_pixel((val + offset) >> shift); | |
| 240 | } | ||
| 241 | 88087700 | tmp += MAX_PB_SIZE; | |
| 242 | 88087700 | dst += dst_stride; | |
| 243 | } | ||
| 244 | |||
| 245 | 6025902 | } | |
| 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 | 3544608 | 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 | 3544608 | const pixel *src = (const pixel *)_src; | |
| 346 | 3544608 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 347 | 3544608 | const int8_t *filter = hf; | |
| 348 | |||
| 349 |
2/2✓ Branch 0 taken 19020036 times.
✓ Branch 1 taken 1772304 times.
|
41584680 | for (int y = 0; y < height; y++) { |
| 350 |
2/2✓ Branch 0 taken 316208168 times.
✓ Branch 1 taken 19020036 times.
|
670456408 | for (int x = 0; x < width; x++) |
| 351 | 632416336 | dst[x] = CHROMA_FILTER(src, 1) >> (BIT_DEPTH - 8); | |
| 352 | 38040072 | src += src_stride; | |
| 353 | 38040072 | dst += MAX_PB_SIZE; | |
| 354 | } | ||
| 355 | 3544608 | } | |
| 356 | |||
| 357 | 3329176 | 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 | 3329176 | const pixel *src = (const pixel *)_src; | |
| 361 | 3329176 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 362 | 3329176 | const int8_t *filter = vf; | |
| 363 | |||
| 364 |
2/2✓ Branch 0 taken 16700324 times.
✓ Branch 1 taken 1664588 times.
|
36729824 | for (int y = 0; y < height; y++) { |
| 365 |
2/2✓ Branch 0 taken 270681256 times.
✓ Branch 1 taken 16700324 times.
|
574763160 | for (int x = 0; x < width; x++) |
| 366 | 541362512 | dst[x] = CHROMA_FILTER(src, src_stride) >> (BIT_DEPTH - 8); | |
| 367 | 33400648 | src += src_stride; | |
| 368 | 33400648 | dst += MAX_PB_SIZE; | |
| 369 | } | ||
| 370 | 3329176 | } | |
| 371 | |||
| 372 | 16426108 | 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 | 16426108 | int16_t *tmp = tmp_array; | |
| 377 | 16426108 | const pixel *src = (const pixel *)_src; | |
| 378 | 16426108 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 379 | 16426108 | const int8_t *filter = hf; | |
| 380 | |||
| 381 | 16426108 | src -= CHROMA_EXTRA_BEFORE * src_stride; | |
| 382 | |||
| 383 |
2/2✓ Branch 0 taken 101669826 times.
✓ Branch 1 taken 8213054 times.
|
219765760 | for (int y = 0; y < height + CHROMA_EXTRA; y++) { |
| 384 |
2/2✓ Branch 0 taken 1306799780 times.
✓ Branch 1 taken 101669826 times.
|
2816939212 | for (int x = 0; x < width; x++) |
| 385 | 2613599560 | tmp[x] = CHROMA_FILTER(src, 1) >> (BIT_DEPTH - 8); | |
| 386 | 203339652 | src += src_stride; | |
| 387 | 203339652 | tmp += MAX_PB_SIZE; | |
| 388 | } | ||
| 389 | |||
| 390 | 16426108 | tmp = tmp_array + CHROMA_EXTRA_BEFORE * MAX_PB_SIZE; | |
| 391 | 16426108 | filter = vf; | |
| 392 | |||
| 393 |
2/2✓ Branch 0 taken 77030664 times.
✓ Branch 1 taken 8213054 times.
|
170487436 | for (int y = 0; y < height; y++) { |
| 394 |
2/2✓ Branch 0 taken 1085362472 times.
✓ Branch 1 taken 77030664 times.
|
2324786272 | for (int x = 0; x < width; x++) |
| 395 | 2170724944 | dst[x] = CHROMA_FILTER(tmp, MAX_PB_SIZE) >> 6; | |
| 396 | 154061328 | tmp += MAX_PB_SIZE; | |
| 397 | 154061328 | dst += MAX_PB_SIZE; | |
| 398 | } | ||
| 399 | 16426108 | } | |
| 400 | |||
| 401 | 3596788 | 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 | 3596788 | const pixel *src = (const pixel *)_src; | |
| 406 | 3596788 | pixel *dst = (pixel *)_dst; | |
| 407 | 3596788 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 408 | 3596788 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 409 | 3596788 | const int8_t *filter = hf; | |
| 410 | 3596788 | const int shift = 14 - BIT_DEPTH; | |
| 411 | #if BIT_DEPTH < 14 | ||
| 412 | 3596788 | const int offset = 1 << (shift - 1); | |
| 413 | #else | ||
| 414 | const int offset = 0; | ||
| 415 | #endif | ||
| 416 | |||
| 417 |
2/2✓ Branch 0 taken 13024384 times.
✓ Branch 1 taken 1798394 times.
|
29645556 | for (int y = 0; y < height; y++) { |
| 418 |
2/2✓ Branch 0 taken 141580136 times.
✓ Branch 1 taken 13024384 times.
|
309209040 | for (int x = 0; x < width; x++) |
| 419 | 283160272 | dst[x] = av_clip_pixel(((CHROMA_FILTER(src, 1) >> (BIT_DEPTH - 8)) + offset) >> shift); | |
| 420 | 26048768 | src += src_stride; | |
| 421 | 26048768 | dst += dst_stride; | |
| 422 | } | ||
| 423 | 3596788 | } | |
| 424 | |||
| 425 | 3198856 | 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 | 3198856 | const pixel *src = (const pixel *)_src; | |
| 430 | 3198856 | pixel *dst = (pixel *)_dst; | |
| 431 | 3198856 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 432 | 3198856 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 433 | 3198856 | const int8_t *filter = vf; | |
| 434 | 3198856 | const int shift = 14 - BIT_DEPTH; | |
| 435 | #if BIT_DEPTH < 14 | ||
| 436 | 3198856 | const int offset = 1 << (shift - 1); | |
| 437 | #else | ||
| 438 | const int offset = 0; | ||
| 439 | #endif | ||
| 440 | |||
| 441 |
2/2✓ Branch 0 taken 12008996 times.
✓ Branch 1 taken 1599428 times.
|
27216848 | for (int y = 0; y < height; y++) { |
| 442 |
2/2✓ Branch 0 taken 138180424 times.
✓ Branch 1 taken 12008996 times.
|
300378840 | for (int x = 0; x < width; x++) |
| 443 | 276360848 | dst[x] = av_clip_pixel(((CHROMA_FILTER(src, src_stride) >> (BIT_DEPTH - 8)) + offset) >> shift); | |
| 444 | 24017992 | src += src_stride; | |
| 445 | 24017992 | dst += dst_stride; | |
| 446 | } | ||
| 447 | 3198856 | } | |
| 448 | |||
| 449 | 17902036 | 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 | 17902036 | int16_t *tmp = tmp_array; | |
| 455 | 17902036 | const pixel *src = (const pixel *)_src; | |
| 456 | 17902036 | pixel *dst = (pixel *)_dst; | |
| 457 | 17902036 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
| 458 | 17902036 | const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); | |
| 459 | 17902036 | const int8_t *filter = hf; | |
| 460 | 17902036 | const int shift = 14 - BIT_DEPTH; | |
| 461 | #if BIT_DEPTH < 14 | ||
| 462 | 17902036 | const int offset = 1 << (shift - 1); | |
| 463 | #else | ||
| 464 | const int offset = 0; | ||
| 465 | #endif | ||
| 466 | |||
| 467 | 17902036 | src -= CHROMA_EXTRA_BEFORE * src_stride; | |
| 468 | |||
| 469 |
2/2✓ Branch 0 taken 89328962 times.
✓ Branch 1 taken 8951018 times.
|
196559960 | for (int y = 0; y < height + CHROMA_EXTRA; y++) { |
| 470 |
2/2✓ Branch 0 taken 818875896 times.
✓ Branch 1 taken 89328962 times.
|
1816409716 | for (int x = 0; x < width; x++) |
| 471 | 1637751792 | tmp[x] = CHROMA_FILTER(src, 1) >> (BIT_DEPTH - 8); | |
| 472 | 178657924 | src += src_stride; | |
| 473 | 178657924 | tmp += MAX_PB_SIZE; | |
| 474 | } | ||
| 475 | |||
| 476 | 17902036 | tmp = tmp_array + CHROMA_EXTRA_BEFORE * MAX_PB_SIZE; | |
| 477 | 17902036 | filter = vf; | |
| 478 | |||
| 479 |
2/2✓ Branch 0 taken 62475908 times.
✓ Branch 1 taken 8951018 times.
|
142853852 | for (int y = 0; y < height; y++) { |
| 480 |
2/2✓ Branch 0 taken 636027768 times.
✓ Branch 1 taken 62475908 times.
|
1397007352 | for (int x = 0; x < width; x++) |
| 481 | 1272055536 | dst[x] = av_clip_pixel(((CHROMA_FILTER(tmp, MAX_PB_SIZE) >> 6) + offset) >> shift); | |
| 482 | 124951816 | tmp += MAX_PB_SIZE; | |
| 483 | 124951816 | dst += dst_stride; | |
| 484 | } | ||
| 485 | 17902036 | } | |
| 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 |