/src/ffmpeg/libavcodec/h26x/h2656_sao_template.c
Line | Count | Source |
1 | | /* |
2 | | * HEVC/VVC SAO template |
3 | | * |
4 | | * Copyright (C) 2024 Nuo Mi |
5 | | * Copyright (C) 2012 - 2013 Guillaume Martres |
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 | | static void FUNC(sao_band_filter)(uint8_t *_dst, const uint8_t *_src, |
25 | | ptrdiff_t stride_dst, ptrdiff_t stride_src, |
26 | | const int16_t *sao_offset_val, int sao_left_class, |
27 | | int width, int height) |
28 | 7.00M | { |
29 | 7.00M | pixel *dst = (pixel *)_dst; |
30 | 7.00M | const pixel *src = (const pixel *)_src; |
31 | 7.00M | int offset_table[32] = { 0 }; |
32 | 7.00M | int k, y, x; |
33 | 7.00M | int shift = BIT_DEPTH - 5; |
34 | | |
35 | 7.00M | stride_dst /= sizeof(pixel); |
36 | 7.00M | stride_src /= sizeof(pixel); |
37 | | |
38 | 35.0M | for (k = 0; k < 4; k++) |
39 | 28.0M | offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; |
40 | 252M | for (y = 0; y < height; y++) { |
41 | 10.0G | for (x = 0; x < width; x++) |
42 | 9.78G | dst[x] = av_clip_pixel(src[x] + offset_table[(src[x] >> shift) & 31]); |
43 | 245M | dst += stride_dst; |
44 | 245M | src += stride_src; |
45 | 245M | } |
46 | 7.00M | } Line | Count | Source | 28 | 623k | { | 29 | 623k | pixel *dst = (pixel *)_dst; | 30 | 623k | const pixel *src = (const pixel *)_src; | 31 | 623k | int offset_table[32] = { 0 }; | 32 | 623k | int k, y, x; | 33 | 623k | int shift = BIT_DEPTH - 5; | 34 | | | 35 | 623k | stride_dst /= sizeof(pixel); | 36 | 623k | stride_src /= sizeof(pixel); | 37 | | | 38 | 3.11M | for (k = 0; k < 4; k++) | 39 | 2.49M | offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; | 40 | 35.1M | for (y = 0; y < height; y++) { | 41 | 1.51G | for (x = 0; x < width; x++) | 42 | 1.48G | dst[x] = av_clip_pixel(src[x] + offset_table[(src[x] >> shift) & 31]); | 43 | 34.5M | dst += stride_dst; | 44 | 34.5M | src += stride_src; | 45 | 34.5M | } | 46 | 623k | } |
Line | Count | Source | 28 | 750k | { | 29 | 750k | pixel *dst = (pixel *)_dst; | 30 | 750k | const pixel *src = (const pixel *)_src; | 31 | 750k | int offset_table[32] = { 0 }; | 32 | 750k | int k, y, x; | 33 | 750k | int shift = BIT_DEPTH - 5; | 34 | | | 35 | 750k | stride_dst /= sizeof(pixel); | 36 | 750k | stride_src /= sizeof(pixel); | 37 | | | 38 | 3.75M | for (k = 0; k < 4; k++) | 39 | 3.00M | offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; | 40 | 36.9M | for (y = 0; y < height; y++) { | 41 | 1.50G | for (x = 0; x < width; x++) | 42 | 1.46G | dst[x] = av_clip_pixel(src[x] + offset_table[(src[x] >> shift) & 31]); | 43 | 36.2M | dst += stride_dst; | 44 | 36.2M | src += stride_src; | 45 | 36.2M | } | 46 | 750k | } |
Line | Count | Source | 28 | 958k | { | 29 | 958k | pixel *dst = (pixel *)_dst; | 30 | 958k | const pixel *src = (const pixel *)_src; | 31 | 958k | int offset_table[32] = { 0 }; | 32 | 958k | int k, y, x; | 33 | 958k | int shift = BIT_DEPTH - 5; | 34 | | | 35 | 958k | stride_dst /= sizeof(pixel); | 36 | 958k | stride_src /= sizeof(pixel); | 37 | | | 38 | 4.79M | for (k = 0; k < 4; k++) | 39 | 3.83M | offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; | 40 | 32.7M | for (y = 0; y < height; y++) { | 41 | 1.46G | for (x = 0; x < width; x++) | 42 | 1.43G | dst[x] = av_clip_pixel(src[x] + offset_table[(src[x] >> shift) & 31]); | 43 | 31.8M | dst += stride_dst; | 44 | 31.8M | src += stride_src; | 45 | 31.8M | } | 46 | 958k | } |
Line | Count | Source | 28 | 1.48M | { | 29 | 1.48M | pixel *dst = (pixel *)_dst; | 30 | 1.48M | const pixel *src = (const pixel *)_src; | 31 | 1.48M | int offset_table[32] = { 0 }; | 32 | 1.48M | int k, y, x; | 33 | 1.48M | int shift = BIT_DEPTH - 5; | 34 | | | 35 | 1.48M | stride_dst /= sizeof(pixel); | 36 | 1.48M | stride_src /= sizeof(pixel); | 37 | | | 38 | 7.41M | for (k = 0; k < 4; k++) | 39 | 5.93M | offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; | 40 | 38.9M | for (y = 0; y < height; y++) { | 41 | 1.28G | for (x = 0; x < width; x++) | 42 | 1.25G | dst[x] = av_clip_pixel(src[x] + offset_table[(src[x] >> shift) & 31]); | 43 | 37.5M | dst += stride_dst; | 44 | 37.5M | src += stride_src; | 45 | 37.5M | } | 46 | 1.48M | } |
Line | Count | Source | 28 | 958k | { | 29 | 958k | pixel *dst = (pixel *)_dst; | 30 | 958k | const pixel *src = (const pixel *)_src; | 31 | 958k | int offset_table[32] = { 0 }; | 32 | 958k | int k, y, x; | 33 | 958k | int shift = BIT_DEPTH - 5; | 34 | | | 35 | 958k | stride_dst /= sizeof(pixel); | 36 | 958k | stride_src /= sizeof(pixel); | 37 | | | 38 | 4.79M | for (k = 0; k < 4; k++) | 39 | 3.83M | offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; | 40 | 32.7M | for (y = 0; y < height; y++) { | 41 | 1.46G | for (x = 0; x < width; x++) | 42 | 1.43G | dst[x] = av_clip_pixel(src[x] + offset_table[(src[x] >> shift) & 31]); | 43 | 31.8M | dst += stride_dst; | 44 | 31.8M | src += stride_src; | 45 | 31.8M | } | 46 | 958k | } |
Line | Count | Source | 28 | 750k | { | 29 | 750k | pixel *dst = (pixel *)_dst; | 30 | 750k | const pixel *src = (const pixel *)_src; | 31 | 750k | int offset_table[32] = { 0 }; | 32 | 750k | int k, y, x; | 33 | 750k | int shift = BIT_DEPTH - 5; | 34 | | | 35 | 750k | stride_dst /= sizeof(pixel); | 36 | 750k | stride_src /= sizeof(pixel); | 37 | | | 38 | 3.75M | for (k = 0; k < 4; k++) | 39 | 3.00M | offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; | 40 | 36.9M | for (y = 0; y < height; y++) { | 41 | 1.50G | for (x = 0; x < width; x++) | 42 | 1.46G | dst[x] = av_clip_pixel(src[x] + offset_table[(src[x] >> shift) & 31]); | 43 | 36.2M | dst += stride_dst; | 44 | 36.2M | src += stride_src; | 45 | 36.2M | } | 46 | 750k | } |
Line | Count | Source | 28 | 1.48M | { | 29 | 1.48M | pixel *dst = (pixel *)_dst; | 30 | 1.48M | const pixel *src = (const pixel *)_src; | 31 | 1.48M | int offset_table[32] = { 0 }; | 32 | 1.48M | int k, y, x; | 33 | 1.48M | int shift = BIT_DEPTH - 5; | 34 | | | 35 | 1.48M | stride_dst /= sizeof(pixel); | 36 | 1.48M | stride_src /= sizeof(pixel); | 37 | | | 38 | 7.41M | for (k = 0; k < 4; k++) | 39 | 5.93M | offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; | 40 | 38.9M | for (y = 0; y < height; y++) { | 41 | 1.28G | for (x = 0; x < width; x++) | 42 | 1.25G | dst[x] = av_clip_pixel(src[x] + offset_table[(src[x] >> shift) & 31]); | 43 | 37.5M | dst += stride_dst; | 44 | 37.5M | src += stride_src; | 45 | 37.5M | } | 46 | 1.48M | } |
|
47 | | |
48 | 3.92G | #define CMP(a, b) (((a) > (b)) - ((a) < (b))) |
49 | | |
50 | | static void FUNC(sao_edge_filter)(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst, const int16_t *sao_offset_val, |
51 | 1.31M | int eo, int width, int height) { |
52 | | |
53 | 1.31M | static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; |
54 | 1.31M | static const int8_t pos[4][2][2] = { |
55 | 1.31M | { { -1, 0 }, { 1, 0 } }, // horizontal |
56 | 1.31M | { { 0, -1 }, { 0, 1 } }, // vertical |
57 | 1.31M | { { -1, -1 }, { 1, 1 } }, // 45 degree |
58 | 1.31M | { { 1, -1 }, { -1, 1 } }, // 135 degree |
59 | 1.31M | }; |
60 | 1.31M | pixel *dst = (pixel *)_dst; |
61 | 1.31M | const pixel *src = (const pixel *)_src; |
62 | 1.31M | int a_stride, b_stride; |
63 | 1.31M | int x, y; |
64 | 1.31M | ptrdiff_t stride_src = (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / sizeof(pixel); |
65 | 1.31M | stride_dst /= sizeof(pixel); |
66 | | |
67 | 1.31M | a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; |
68 | 1.31M | b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; |
69 | 47.9M | for (y = 0; y < height; y++) { |
70 | 2.00G | for (x = 0; x < width; x++) { |
71 | 1.96G | int diff0 = CMP(src[x], src[x + a_stride]); |
72 | 1.96G | int diff1 = CMP(src[x], src[x + b_stride]); |
73 | 1.96G | int offset_val = edge_idx[2 + diff0 + diff1]; |
74 | 1.96G | dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); |
75 | 1.96G | } |
76 | 46.6M | src += stride_src; |
77 | 46.6M | dst += stride_dst; |
78 | 46.6M | } |
79 | 1.31M | } Line | Count | Source | 51 | 145k | int eo, int width, int height) { | 52 | | | 53 | 145k | static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; | 54 | 145k | static const int8_t pos[4][2][2] = { | 55 | 145k | { { -1, 0 }, { 1, 0 } }, // horizontal | 56 | 145k | { { 0, -1 }, { 0, 1 } }, // vertical | 57 | 145k | { { -1, -1 }, { 1, 1 } }, // 45 degree | 58 | 145k | { { 1, -1 }, { -1, 1 } }, // 135 degree | 59 | 145k | }; | 60 | 145k | pixel *dst = (pixel *)_dst; | 61 | 145k | const pixel *src = (const pixel *)_src; | 62 | 145k | int a_stride, b_stride; | 63 | 145k | int x, y; | 64 | 145k | ptrdiff_t stride_src = (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / sizeof(pixel); | 65 | 145k | stride_dst /= sizeof(pixel); | 66 | | | 67 | 145k | a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; | 68 | 145k | b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; | 69 | 7.94M | for (y = 0; y < height; y++) { | 70 | 341M | for (x = 0; x < width; x++) { | 71 | 333M | int diff0 = CMP(src[x], src[x + a_stride]); | 72 | 333M | int diff1 = CMP(src[x], src[x + b_stride]); | 73 | 333M | int offset_val = edge_idx[2 + diff0 + diff1]; | 74 | 333M | dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); | 75 | 333M | } | 76 | 7.79M | src += stride_src; | 77 | 7.79M | dst += stride_dst; | 78 | 7.79M | } | 79 | 145k | } |
Line | Count | Source | 51 | 159k | int eo, int width, int height) { | 52 | | | 53 | 159k | static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; | 54 | 159k | static const int8_t pos[4][2][2] = { | 55 | 159k | { { -1, 0 }, { 1, 0 } }, // horizontal | 56 | 159k | { { 0, -1 }, { 0, 1 } }, // vertical | 57 | 159k | { { -1, -1 }, { 1, 1 } }, // 45 degree | 58 | 159k | { { 1, -1 }, { -1, 1 } }, // 135 degree | 59 | 159k | }; | 60 | 159k | pixel *dst = (pixel *)_dst; | 61 | 159k | const pixel *src = (const pixel *)_src; | 62 | 159k | int a_stride, b_stride; | 63 | 159k | int x, y; | 64 | 159k | ptrdiff_t stride_src = (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / sizeof(pixel); | 65 | 159k | stride_dst /= sizeof(pixel); | 66 | | | 67 | 159k | a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; | 68 | 159k | b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; | 69 | 7.16M | for (y = 0; y < height; y++) { | 70 | 307M | for (x = 0; x < width; x++) { | 71 | 300M | int diff0 = CMP(src[x], src[x + a_stride]); | 72 | 300M | int diff1 = CMP(src[x], src[x + b_stride]); | 73 | 300M | int offset_val = edge_idx[2 + diff0 + diff1]; | 74 | 300M | dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); | 75 | 300M | } | 76 | 7.00M | src += stride_src; | 77 | 7.00M | dst += stride_dst; | 78 | 7.00M | } | 79 | 159k | } |
Line | Count | Source | 51 | 214k | int eo, int width, int height) { | 52 | | | 53 | 214k | static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; | 54 | 214k | static const int8_t pos[4][2][2] = { | 55 | 214k | { { -1, 0 }, { 1, 0 } }, // horizontal | 56 | 214k | { { 0, -1 }, { 0, 1 } }, // vertical | 57 | 214k | { { -1, -1 }, { 1, 1 } }, // 45 degree | 58 | 214k | { { 1, -1 }, { -1, 1 } }, // 135 degree | 59 | 214k | }; | 60 | 214k | pixel *dst = (pixel *)_dst; | 61 | 214k | const pixel *src = (const pixel *)_src; | 62 | 214k | int a_stride, b_stride; | 63 | 214k | int x, y; | 64 | 214k | ptrdiff_t stride_src = (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / sizeof(pixel); | 65 | 214k | stride_dst /= sizeof(pixel); | 66 | | | 67 | 214k | a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; | 68 | 214k | b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; | 69 | 6.75M | for (y = 0; y < height; y++) { | 70 | 295M | for (x = 0; x < width; x++) { | 71 | 288M | int diff0 = CMP(src[x], src[x + a_stride]); | 72 | 288M | int diff1 = CMP(src[x], src[x + b_stride]); | 73 | 288M | int offset_val = edge_idx[2 + diff0 + diff1]; | 74 | 288M | dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); | 75 | 288M | } | 76 | 6.54M | src += stride_src; | 77 | 6.54M | dst += stride_dst; | 78 | 6.54M | } | 79 | 214k | } |
Line | Count | Source | 51 | 210k | int eo, int width, int height) { | 52 | | | 53 | 210k | static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; | 54 | 210k | static const int8_t pos[4][2][2] = { | 55 | 210k | { { -1, 0 }, { 1, 0 } }, // horizontal | 56 | 210k | { { 0, -1 }, { 0, 1 } }, // vertical | 57 | 210k | { { -1, -1 }, { 1, 1 } }, // 45 degree | 58 | 210k | { { 1, -1 }, { -1, 1 } }, // 135 degree | 59 | 210k | }; | 60 | 210k | pixel *dst = (pixel *)_dst; | 61 | 210k | const pixel *src = (const pixel *)_src; | 62 | 210k | int a_stride, b_stride; | 63 | 210k | int x, y; | 64 | 210k | ptrdiff_t stride_src = (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / sizeof(pixel); | 65 | 210k | stride_dst /= sizeof(pixel); | 66 | | | 67 | 210k | a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; | 68 | 210k | b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; | 69 | 6.07M | for (y = 0; y < height; y++) { | 70 | 230M | for (x = 0; x < width; x++) { | 71 | 224M | int diff0 = CMP(src[x], src[x + a_stride]); | 72 | 224M | int diff1 = CMP(src[x], src[x + b_stride]); | 73 | 224M | int offset_val = edge_idx[2 + diff0 + diff1]; | 74 | 224M | dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); | 75 | 224M | } | 76 | 5.86M | src += stride_src; | 77 | 5.86M | dst += stride_dst; | 78 | 5.86M | } | 79 | 210k | } |
Line | Count | Source | 51 | 214k | int eo, int width, int height) { | 52 | | | 53 | 214k | static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; | 54 | 214k | static const int8_t pos[4][2][2] = { | 55 | 214k | { { -1, 0 }, { 1, 0 } }, // horizontal | 56 | 214k | { { 0, -1 }, { 0, 1 } }, // vertical | 57 | 214k | { { -1, -1 }, { 1, 1 } }, // 45 degree | 58 | 214k | { { 1, -1 }, { -1, 1 } }, // 135 degree | 59 | 214k | }; | 60 | 214k | pixel *dst = (pixel *)_dst; | 61 | 214k | const pixel *src = (const pixel *)_src; | 62 | 214k | int a_stride, b_stride; | 63 | 214k | int x, y; | 64 | 214k | ptrdiff_t stride_src = (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / sizeof(pixel); | 65 | 214k | stride_dst /= sizeof(pixel); | 66 | | | 67 | 214k | a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; | 68 | 214k | b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; | 69 | 6.75M | for (y = 0; y < height; y++) { | 70 | 295M | for (x = 0; x < width; x++) { | 71 | 288M | int diff0 = CMP(src[x], src[x + a_stride]); | 72 | 288M | int diff1 = CMP(src[x], src[x + b_stride]); | 73 | 288M | int offset_val = edge_idx[2 + diff0 + diff1]; | 74 | 288M | dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); | 75 | 288M | } | 76 | 6.54M | src += stride_src; | 77 | 6.54M | dst += stride_dst; | 78 | 6.54M | } | 79 | 214k | } |
Line | Count | Source | 51 | 159k | int eo, int width, int height) { | 52 | | | 53 | 159k | static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; | 54 | 159k | static const int8_t pos[4][2][2] = { | 55 | 159k | { { -1, 0 }, { 1, 0 } }, // horizontal | 56 | 159k | { { 0, -1 }, { 0, 1 } }, // vertical | 57 | 159k | { { -1, -1 }, { 1, 1 } }, // 45 degree | 58 | 159k | { { 1, -1 }, { -1, 1 } }, // 135 degree | 59 | 159k | }; | 60 | 159k | pixel *dst = (pixel *)_dst; | 61 | 159k | const pixel *src = (const pixel *)_src; | 62 | 159k | int a_stride, b_stride; | 63 | 159k | int x, y; | 64 | 159k | ptrdiff_t stride_src = (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / sizeof(pixel); | 65 | 159k | stride_dst /= sizeof(pixel); | 66 | | | 67 | 159k | a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; | 68 | 159k | b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; | 69 | 7.16M | for (y = 0; y < height; y++) { | 70 | 307M | for (x = 0; x < width; x++) { | 71 | 300M | int diff0 = CMP(src[x], src[x + a_stride]); | 72 | 300M | int diff1 = CMP(src[x], src[x + b_stride]); | 73 | 300M | int offset_val = edge_idx[2 + diff0 + diff1]; | 74 | 300M | dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); | 75 | 300M | } | 76 | 7.00M | src += stride_src; | 77 | 7.00M | dst += stride_dst; | 78 | 7.00M | } | 79 | 159k | } |
Line | Count | Source | 51 | 210k | int eo, int width, int height) { | 52 | | | 53 | 210k | static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; | 54 | 210k | static const int8_t pos[4][2][2] = { | 55 | 210k | { { -1, 0 }, { 1, 0 } }, // horizontal | 56 | 210k | { { 0, -1 }, { 0, 1 } }, // vertical | 57 | 210k | { { -1, -1 }, { 1, 1 } }, // 45 degree | 58 | 210k | { { 1, -1 }, { -1, 1 } }, // 135 degree | 59 | 210k | }; | 60 | 210k | pixel *dst = (pixel *)_dst; | 61 | 210k | const pixel *src = (const pixel *)_src; | 62 | 210k | int a_stride, b_stride; | 63 | 210k | int x, y; | 64 | 210k | ptrdiff_t stride_src = (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / sizeof(pixel); | 65 | 210k | stride_dst /= sizeof(pixel); | 66 | | | 67 | 210k | a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; | 68 | 210k | b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; | 69 | 6.07M | for (y = 0; y < height; y++) { | 70 | 230M | for (x = 0; x < width; x++) { | 71 | 224M | int diff0 = CMP(src[x], src[x + a_stride]); | 72 | 224M | int diff1 = CMP(src[x], src[x + b_stride]); | 73 | 224M | int offset_val = edge_idx[2 + diff0 + diff1]; | 74 | 224M | dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); | 75 | 224M | } | 76 | 5.86M | src += stride_src; | 77 | 5.86M | dst += stride_dst; | 78 | 5.86M | } | 79 | 210k | } |
|
80 | | |
81 | | static void FUNC(sao_edge_restore_0)(uint8_t *_dst, const uint8_t *_src, |
82 | | ptrdiff_t stride_dst, ptrdiff_t stride_src, const SAOParams *sao, |
83 | | const int *borders, int _width, int _height, |
84 | | int c_idx, const uint8_t *vert_edge, |
85 | | const uint8_t *horiz_edge, const uint8_t *diag_edge) |
86 | 525k | { |
87 | 525k | int x, y; |
88 | 525k | pixel *dst = (pixel *)_dst; |
89 | 525k | const pixel *src = (const pixel *)_src; |
90 | 525k | const int16_t *sao_offset_val = sao->offset_val[c_idx]; |
91 | 525k | int sao_eo_class = sao->eo_class[c_idx]; |
92 | 525k | int init_x = 0, width = _width, height = _height; |
93 | | |
94 | 525k | stride_dst /= sizeof(pixel); |
95 | 525k | stride_src /= sizeof(pixel); |
96 | | |
97 | 525k | if (sao_eo_class != SAO_EO_VERT) { |
98 | 415k | if (borders[0]) { |
99 | 37.4k | int offset_val = sao_offset_val[0]; |
100 | 1.86M | for (y = 0; y < height; y++) { |
101 | 1.82M | dst[y * stride_dst] = av_clip_pixel(src[y * stride_src] + offset_val); |
102 | 1.82M | } |
103 | 37.4k | init_x = 1; |
104 | 37.4k | } |
105 | 415k | if (borders[2]) { |
106 | 25.1k | int offset_val = sao_offset_val[0]; |
107 | 25.1k | int offset = width - 1; |
108 | 1.09M | for (x = 0; x < height; x++) { |
109 | 1.07M | dst[x * stride_dst + offset] = av_clip_pixel(src[x * stride_src + offset] + offset_val); |
110 | 1.07M | } |
111 | 25.1k | width--; |
112 | 25.1k | } |
113 | 415k | } |
114 | 525k | if (sao_eo_class != SAO_EO_HORIZ) { |
115 | 402k | if (borders[1]) { |
116 | 70.3k | int offset_val = sao_offset_val[0]; |
117 | 2.94M | for (x = init_x; x < width; x++) |
118 | 2.87M | dst[x] = av_clip_pixel(src[x] + offset_val); |
119 | 70.3k | } |
120 | 402k | if (borders[3]) { |
121 | 37.2k | int offset_val = sao_offset_val[0]; |
122 | 37.2k | ptrdiff_t y_stride_dst = stride_dst * (height - 1); |
123 | 37.2k | ptrdiff_t y_stride_src = stride_src * (height - 1); |
124 | 1.41M | for (x = init_x; x < width; x++) |
125 | 1.37M | dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + offset_val); |
126 | 37.2k | height--; |
127 | 37.2k | } |
128 | 402k | } |
129 | 525k | } dsp.c:sao_edge_restore_0_9 Line | Count | Source | 86 | 112k | { | 87 | 112k | int x, y; | 88 | 112k | pixel *dst = (pixel *)_dst; | 89 | 112k | const pixel *src = (const pixel *)_src; | 90 | 112k | const int16_t *sao_offset_val = sao->offset_val[c_idx]; | 91 | 112k | int sao_eo_class = sao->eo_class[c_idx]; | 92 | 112k | int init_x = 0, width = _width, height = _height; | 93 | | | 94 | 112k | stride_dst /= sizeof(pixel); | 95 | 112k | stride_src /= sizeof(pixel); | 96 | | | 97 | 112k | if (sao_eo_class != SAO_EO_VERT) { | 98 | 86.6k | if (borders[0]) { | 99 | 8.88k | int offset_val = sao_offset_val[0]; | 100 | 502k | for (y = 0; y < height; y++) { | 101 | 493k | dst[y * stride_dst] = av_clip_pixel(src[y * stride_src] + offset_val); | 102 | 493k | } | 103 | 8.88k | init_x = 1; | 104 | 8.88k | } | 105 | 86.6k | if (borders[2]) { | 106 | 5.38k | int offset_val = sao_offset_val[0]; | 107 | 5.38k | int offset = width - 1; | 108 | 261k | for (x = 0; x < height; x++) { | 109 | 256k | dst[x * stride_dst + offset] = av_clip_pixel(src[x * stride_src + offset] + offset_val); | 110 | 256k | } | 111 | 5.38k | width--; | 112 | 5.38k | } | 113 | 86.6k | } | 114 | 112k | if (sao_eo_class != SAO_EO_HORIZ) { | 115 | 86.5k | if (borders[1]) { | 116 | 15.4k | int offset_val = sao_offset_val[0]; | 117 | 735k | for (x = init_x; x < width; x++) | 118 | 719k | dst[x] = av_clip_pixel(src[x] + offset_val); | 119 | 15.4k | } | 120 | 86.5k | if (borders[3]) { | 121 | 7.71k | int offset_val = sao_offset_val[0]; | 122 | 7.71k | ptrdiff_t y_stride_dst = stride_dst * (height - 1); | 123 | 7.71k | ptrdiff_t y_stride_src = stride_src * (height - 1); | 124 | 311k | for (x = init_x; x < width; x++) | 125 | 303k | dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + offset_val); | 126 | 7.71k | height--; | 127 | 7.71k | } | 128 | 86.5k | } | 129 | 112k | } |
dsp.c:sao_edge_restore_0_10 Line | Count | Source | 86 | 86.5k | { | 87 | 86.5k | int x, y; | 88 | 86.5k | pixel *dst = (pixel *)_dst; | 89 | 86.5k | const pixel *src = (const pixel *)_src; | 90 | 86.5k | const int16_t *sao_offset_val = sao->offset_val[c_idx]; | 91 | 86.5k | int sao_eo_class = sao->eo_class[c_idx]; | 92 | 86.5k | int init_x = 0, width = _width, height = _height; | 93 | | | 94 | 86.5k | stride_dst /= sizeof(pixel); | 95 | 86.5k | stride_src /= sizeof(pixel); | 96 | | | 97 | 86.5k | if (sao_eo_class != SAO_EO_VERT) { | 98 | 65.7k | if (borders[0]) { | 99 | 5.68k | int offset_val = sao_offset_val[0]; | 100 | 314k | for (y = 0; y < height; y++) { | 101 | 308k | dst[y * stride_dst] = av_clip_pixel(src[y * stride_src] + offset_val); | 102 | 308k | } | 103 | 5.68k | init_x = 1; | 104 | 5.68k | } | 105 | 65.7k | if (borders[2]) { | 106 | 3.39k | int offset_val = sao_offset_val[0]; | 107 | 3.39k | int offset = width - 1; | 108 | 165k | for (x = 0; x < height; x++) { | 109 | 162k | dst[x * stride_dst + offset] = av_clip_pixel(src[x * stride_src + offset] + offset_val); | 110 | 162k | } | 111 | 3.39k | width--; | 112 | 3.39k | } | 113 | 65.7k | } | 114 | 86.5k | if (sao_eo_class != SAO_EO_HORIZ) { | 115 | 63.7k | if (borders[1]) { | 116 | 11.3k | int offset_val = sao_offset_val[0]; | 117 | 461k | for (x = init_x; x < width; x++) | 118 | 450k | dst[x] = av_clip_pixel(src[x] + offset_val); | 119 | 11.3k | } | 120 | 63.7k | if (borders[3]) { | 121 | 5.31k | int offset_val = sao_offset_val[0]; | 122 | 5.31k | ptrdiff_t y_stride_dst = stride_dst * (height - 1); | 123 | 5.31k | ptrdiff_t y_stride_src = stride_src * (height - 1); | 124 | 192k | for (x = init_x; x < width; x++) | 125 | 187k | dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + offset_val); | 126 | 5.31k | height--; | 127 | 5.31k | } | 128 | 63.7k | } | 129 | 86.5k | } |
dsp.c:sao_edge_restore_0_12 Line | Count | Source | 86 | 60.1k | { | 87 | 60.1k | int x, y; | 88 | 60.1k | pixel *dst = (pixel *)_dst; | 89 | 60.1k | const pixel *src = (const pixel *)_src; | 90 | 60.1k | const int16_t *sao_offset_val = sao->offset_val[c_idx]; | 91 | 60.1k | int sao_eo_class = sao->eo_class[c_idx]; | 92 | 60.1k | int init_x = 0, width = _width, height = _height; | 93 | | | 94 | 60.1k | stride_dst /= sizeof(pixel); | 95 | 60.1k | stride_src /= sizeof(pixel); | 96 | | | 97 | 60.1k | if (sao_eo_class != SAO_EO_VERT) { | 98 | 47.3k | if (borders[0]) { | 99 | 3.93k | int offset_val = sao_offset_val[0]; | 100 | 194k | for (y = 0; y < height; y++) { | 101 | 190k | dst[y * stride_dst] = av_clip_pixel(src[y * stride_src] + offset_val); | 102 | 190k | } | 103 | 3.93k | init_x = 1; | 104 | 3.93k | } | 105 | 47.3k | if (borders[2]) { | 106 | 2.90k | int offset_val = sao_offset_val[0]; | 107 | 2.90k | int offset = width - 1; | 108 | 145k | for (x = 0; x < height; x++) { | 109 | 142k | dst[x * stride_dst + offset] = av_clip_pixel(src[x * stride_src + offset] + offset_val); | 110 | 142k | } | 111 | 2.90k | width--; | 112 | 2.90k | } | 113 | 47.3k | } | 114 | 60.1k | if (sao_eo_class != SAO_EO_HORIZ) { | 115 | 43.8k | if (borders[1]) { | 116 | 7.43k | int offset_val = sao_offset_val[0]; | 117 | 356k | for (x = init_x; x < width; x++) | 118 | 348k | dst[x] = av_clip_pixel(src[x] + offset_val); | 119 | 7.43k | } | 120 | 43.8k | if (borders[3]) { | 121 | 3.77k | int offset_val = sao_offset_val[0]; | 122 | 3.77k | ptrdiff_t y_stride_dst = stride_dst * (height - 1); | 123 | 3.77k | ptrdiff_t y_stride_src = stride_src * (height - 1); | 124 | 188k | for (x = init_x; x < width; x++) | 125 | 184k | dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + offset_val); | 126 | 3.77k | height--; | 127 | 3.77k | } | 128 | 43.8k | } | 129 | 60.1k | } |
dsp.c:sao_edge_restore_0_8 Line | Count | Source | 86 | 119k | { | 87 | 119k | int x, y; | 88 | 119k | pixel *dst = (pixel *)_dst; | 89 | 119k | const pixel *src = (const pixel *)_src; | 90 | 119k | const int16_t *sao_offset_val = sao->offset_val[c_idx]; | 91 | 119k | int sao_eo_class = sao->eo_class[c_idx]; | 92 | 119k | int init_x = 0, width = _width, height = _height; | 93 | | | 94 | 119k | stride_dst /= sizeof(pixel); | 95 | 119k | stride_src /= sizeof(pixel); | 96 | | | 97 | 119k | if (sao_eo_class != SAO_EO_VERT) { | 98 | 102k | if (borders[0]) { | 99 | 9.33k | int offset_val = sao_offset_val[0]; | 100 | 344k | for (y = 0; y < height; y++) { | 101 | 335k | dst[y * stride_dst] = av_clip_pixel(src[y * stride_src] + offset_val); | 102 | 335k | } | 103 | 9.33k | init_x = 1; | 104 | 9.33k | } | 105 | 102k | if (borders[2]) { | 106 | 7.12k | int offset_val = sao_offset_val[0]; | 107 | 7.12k | int offset = width - 1; | 108 | 216k | for (x = 0; x < height; x++) { | 109 | 209k | dst[x * stride_dst + offset] = av_clip_pixel(src[x * stride_src + offset] + offset_val); | 110 | 209k | } | 111 | 7.12k | width--; | 112 | 7.12k | } | 113 | 102k | } | 114 | 119k | if (sao_eo_class != SAO_EO_HORIZ) { | 115 | 100k | if (borders[1]) { | 116 | 17.2k | int offset_val = sao_offset_val[0]; | 117 | 569k | for (x = init_x; x < width; x++) | 118 | 552k | dst[x] = av_clip_pixel(src[x] + offset_val); | 119 | 17.2k | } | 120 | 100k | if (borders[3]) { | 121 | 11.3k | int offset_val = sao_offset_val[0]; | 122 | 11.3k | ptrdiff_t y_stride_dst = stride_dst * (height - 1); | 123 | 11.3k | ptrdiff_t y_stride_src = stride_src * (height - 1); | 124 | 338k | for (x = init_x; x < width; x++) | 125 | 327k | dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + offset_val); | 126 | 11.3k | height--; | 127 | 11.3k | } | 128 | 100k | } | 129 | 119k | } |
dsp.c:sao_edge_restore_0_12 Line | Count | Source | 86 | 60.1k | { | 87 | 60.1k | int x, y; | 88 | 60.1k | pixel *dst = (pixel *)_dst; | 89 | 60.1k | const pixel *src = (const pixel *)_src; | 90 | 60.1k | const int16_t *sao_offset_val = sao->offset_val[c_idx]; | 91 | 60.1k | int sao_eo_class = sao->eo_class[c_idx]; | 92 | 60.1k | int init_x = 0, width = _width, height = _height; | 93 | | | 94 | 60.1k | stride_dst /= sizeof(pixel); | 95 | 60.1k | stride_src /= sizeof(pixel); | 96 | | | 97 | 60.1k | if (sao_eo_class != SAO_EO_VERT) { | 98 | 47.3k | if (borders[0]) { | 99 | 3.93k | int offset_val = sao_offset_val[0]; | 100 | 194k | for (y = 0; y < height; y++) { | 101 | 190k | dst[y * stride_dst] = av_clip_pixel(src[y * stride_src] + offset_val); | 102 | 190k | } | 103 | 3.93k | init_x = 1; | 104 | 3.93k | } | 105 | 47.3k | if (borders[2]) { | 106 | 2.90k | int offset_val = sao_offset_val[0]; | 107 | 2.90k | int offset = width - 1; | 108 | 145k | for (x = 0; x < height; x++) { | 109 | 142k | dst[x * stride_dst + offset] = av_clip_pixel(src[x * stride_src + offset] + offset_val); | 110 | 142k | } | 111 | 2.90k | width--; | 112 | 2.90k | } | 113 | 47.3k | } | 114 | 60.1k | if (sao_eo_class != SAO_EO_HORIZ) { | 115 | 43.8k | if (borders[1]) { | 116 | 7.43k | int offset_val = sao_offset_val[0]; | 117 | 356k | for (x = init_x; x < width; x++) | 118 | 348k | dst[x] = av_clip_pixel(src[x] + offset_val); | 119 | 7.43k | } | 120 | 43.8k | if (borders[3]) { | 121 | 3.77k | int offset_val = sao_offset_val[0]; | 122 | 3.77k | ptrdiff_t y_stride_dst = stride_dst * (height - 1); | 123 | 3.77k | ptrdiff_t y_stride_src = stride_src * (height - 1); | 124 | 188k | for (x = init_x; x < width; x++) | 125 | 184k | dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + offset_val); | 126 | 3.77k | height--; | 127 | 3.77k | } | 128 | 43.8k | } | 129 | 60.1k | } |
dsp.c:sao_edge_restore_0_10 Line | Count | Source | 86 | 86.5k | { | 87 | 86.5k | int x, y; | 88 | 86.5k | pixel *dst = (pixel *)_dst; | 89 | 86.5k | const pixel *src = (const pixel *)_src; | 90 | 86.5k | const int16_t *sao_offset_val = sao->offset_val[c_idx]; | 91 | 86.5k | int sao_eo_class = sao->eo_class[c_idx]; | 92 | 86.5k | int init_x = 0, width = _width, height = _height; | 93 | | | 94 | 86.5k | stride_dst /= sizeof(pixel); | 95 | 86.5k | stride_src /= sizeof(pixel); | 96 | | | 97 | 86.5k | if (sao_eo_class != SAO_EO_VERT) { | 98 | 65.7k | if (borders[0]) { | 99 | 5.68k | int offset_val = sao_offset_val[0]; | 100 | 314k | for (y = 0; y < height; y++) { | 101 | 308k | dst[y * stride_dst] = av_clip_pixel(src[y * stride_src] + offset_val); | 102 | 308k | } | 103 | 5.68k | init_x = 1; | 104 | 5.68k | } | 105 | 65.7k | if (borders[2]) { | 106 | 3.39k | int offset_val = sao_offset_val[0]; | 107 | 3.39k | int offset = width - 1; | 108 | 165k | for (x = 0; x < height; x++) { | 109 | 162k | dst[x * stride_dst + offset] = av_clip_pixel(src[x * stride_src + offset] + offset_val); | 110 | 162k | } | 111 | 3.39k | width--; | 112 | 3.39k | } | 113 | 65.7k | } | 114 | 86.5k | if (sao_eo_class != SAO_EO_HORIZ) { | 115 | 63.7k | if (borders[1]) { | 116 | 11.3k | int offset_val = sao_offset_val[0]; | 117 | 461k | for (x = init_x; x < width; x++) | 118 | 450k | dst[x] = av_clip_pixel(src[x] + offset_val); | 119 | 11.3k | } | 120 | 63.7k | if (borders[3]) { | 121 | 5.31k | int offset_val = sao_offset_val[0]; | 122 | 5.31k | ptrdiff_t y_stride_dst = stride_dst * (height - 1); | 123 | 5.31k | ptrdiff_t y_stride_src = stride_src * (height - 1); | 124 | 192k | for (x = init_x; x < width; x++) | 125 | 187k | dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + offset_val); | 126 | 5.31k | height--; | 127 | 5.31k | } | 128 | 63.7k | } | 129 | 86.5k | } |
|
130 | | |
131 | | static void FUNC(sao_edge_restore_1)(uint8_t *_dst, const uint8_t *_src, |
132 | | ptrdiff_t stride_dst, ptrdiff_t stride_src, const SAOParams *sao, |
133 | | const int *borders, int _width, int _height, |
134 | | int c_idx, const uint8_t *vert_edge, |
135 | | const uint8_t *horiz_edge, const uint8_t *diag_edge) |
136 | 577k | { |
137 | 577k | int x, y; |
138 | 577k | pixel *dst = (pixel *)_dst; |
139 | 577k | const pixel *src = (const pixel *)_src; |
140 | 577k | const int16_t *sao_offset_val = sao->offset_val[c_idx]; |
141 | 577k | int sao_eo_class = sao->eo_class[c_idx]; |
142 | 577k | int init_x = 0, init_y = 0, width = _width, height = _height; |
143 | | |
144 | 577k | stride_dst /= sizeof(pixel); |
145 | 577k | stride_src /= sizeof(pixel); |
146 | | |
147 | 577k | if (sao_eo_class != SAO_EO_VERT) { |
148 | 464k | if (borders[0]) { |
149 | 88.4k | int offset_val = sao_offset_val[0]; |
150 | 2.30M | for (y = 0; y < height; y++) { |
151 | 2.21M | dst[y * stride_dst] = av_clip_pixel(src[y * stride_src] + offset_val); |
152 | 2.21M | } |
153 | 88.4k | init_x = 1; |
154 | 88.4k | } |
155 | 464k | if (borders[2]) { |
156 | 65.0k | int offset_val = sao_offset_val[0]; |
157 | 65.0k | int offset = width - 1; |
158 | 1.40M | for (x = 0; x < height; x++) { |
159 | 1.33M | dst[x * stride_dst + offset] = av_clip_pixel(src[x * stride_src + offset] + offset_val); |
160 | 1.33M | } |
161 | 65.0k | width--; |
162 | 65.0k | } |
163 | 464k | } |
164 | 577k | if (sao_eo_class != SAO_EO_HORIZ) { |
165 | 426k | if (borders[1]) { |
166 | 114k | int offset_val = sao_offset_val[0]; |
167 | 2.13M | for (x = init_x; x < width; x++) |
168 | 2.02M | dst[x] = av_clip_pixel(src[x] + offset_val); |
169 | 114k | init_y = 1; |
170 | 114k | } |
171 | 426k | if (borders[3]) { |
172 | 105k | int offset_val = sao_offset_val[0]; |
173 | 105k | ptrdiff_t y_stride_dst = stride_dst * (height - 1); |
174 | 105k | ptrdiff_t y_stride_src = stride_src * (height - 1); |
175 | 2.47M | for (x = init_x; x < width; x++) |
176 | 2.36M | dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + offset_val); |
177 | 105k | height--; |
178 | 105k | } |
179 | 426k | } |
180 | | |
181 | 577k | { |
182 | 577k | int save_upper_left = !diag_edge[0] && sao_eo_class == SAO_EO_135D && !borders[0] && !borders[1]; |
183 | 577k | int save_upper_right = !diag_edge[1] && sao_eo_class == SAO_EO_45D && !borders[1] && !borders[2]; |
184 | 577k | int save_lower_right = !diag_edge[2] && sao_eo_class == SAO_EO_135D && !borders[2] && !borders[3]; |
185 | 577k | int save_lower_left = !diag_edge[3] && sao_eo_class == SAO_EO_45D && !borders[0] && !borders[3]; |
186 | | |
187 | | // Restore pixels that can't be modified |
188 | 577k | if(vert_edge[0] && sao_eo_class != SAO_EO_VERT) { |
189 | 298k | for(y = init_y+save_upper_left; y< height-save_lower_left; y++) |
190 | 292k | dst[y*stride_dst] = src[y*stride_src]; |
191 | 6.23k | } |
192 | 577k | if(vert_edge[1] && sao_eo_class != SAO_EO_VERT) { |
193 | 262k | for(y = init_y+save_upper_right; y< height-save_lower_right; y++) |
194 | 256k | dst[y*stride_dst+width-1] = src[y*stride_src+width-1]; |
195 | 5.93k | } |
196 | | |
197 | 577k | if(horiz_edge[0] && sao_eo_class != SAO_EO_HORIZ) { |
198 | 593k | for(x = init_x+save_upper_left; x < width-save_upper_right; x++) |
199 | 573k | dst[x] = src[x]; |
200 | 19.5k | } |
201 | 577k | if(horiz_edge[1] && sao_eo_class != SAO_EO_HORIZ) { |
202 | 458k | for(x = init_x+save_lower_left; x < width-save_lower_right; x++) |
203 | 442k | dst[(height-1)*stride_dst+x] = src[(height-1)*stride_src+x]; |
204 | 15.7k | } |
205 | 577k | if(diag_edge[0] && sao_eo_class == SAO_EO_135D) |
206 | 9.48k | dst[0] = src[0]; |
207 | 577k | if(diag_edge[1] && sao_eo_class == SAO_EO_45D) |
208 | 4.45k | dst[width-1] = src[width-1]; |
209 | 577k | if(diag_edge[2] && sao_eo_class == SAO_EO_135D) |
210 | 4.94k | dst[stride_dst*(height-1)+width-1] = src[stride_src*(height-1)+width-1]; |
211 | 577k | if(diag_edge[3] && sao_eo_class == SAO_EO_45D) |
212 | 4.07k | dst[stride_dst*(height-1)] = src[stride_src*(height-1)]; |
213 | | |
214 | 577k | } |
215 | 577k | } dsp.c:sao_edge_restore_1_9 Line | Count | Source | 136 | 32.3k | { | 137 | 32.3k | int x, y; | 138 | 32.3k | pixel *dst = (pixel *)_dst; | 139 | 32.3k | const pixel *src = (const pixel *)_src; | 140 | 32.3k | const int16_t *sao_offset_val = sao->offset_val[c_idx]; | 141 | 32.3k | int sao_eo_class = sao->eo_class[c_idx]; | 142 | 32.3k | int init_x = 0, init_y = 0, width = _width, height = _height; | 143 | | | 144 | 32.3k | stride_dst /= sizeof(pixel); | 145 | 32.3k | stride_src /= sizeof(pixel); | 146 | | | 147 | 32.3k | if (sao_eo_class != SAO_EO_VERT) { | 148 | 24.7k | if (borders[0]) { | 149 | 3.90k | int offset_val = sao_offset_val[0]; | 150 | 178k | for (y = 0; y < height; y++) { | 151 | 174k | dst[y * stride_dst] = av_clip_pixel(src[y * stride_src] + offset_val); | 152 | 174k | } | 153 | 3.90k | init_x = 1; | 154 | 3.90k | } | 155 | 24.7k | if (borders[2]) { | 156 | 2.19k | int offset_val = sao_offset_val[0]; | 157 | 2.19k | int offset = width - 1; | 158 | 91.8k | for (x = 0; x < height; x++) { | 159 | 89.6k | dst[x * stride_dst + offset] = av_clip_pixel(src[x * stride_src + offset] + offset_val); | 160 | 89.6k | } | 161 | 2.19k | width--; | 162 | 2.19k | } | 163 | 24.7k | } | 164 | 32.3k | if (sao_eo_class != SAO_EO_HORIZ) { | 165 | 25.9k | if (borders[1]) { | 166 | 5.11k | int offset_val = sao_offset_val[0]; | 167 | 192k | for (x = init_x; x < width; x++) | 168 | 187k | dst[x] = av_clip_pixel(src[x] + offset_val); | 169 | 5.11k | init_y = 1; | 170 | 5.11k | } | 171 | 25.9k | if (borders[3]) { | 172 | 4.68k | int offset_val = sao_offset_val[0]; | 173 | 4.68k | ptrdiff_t y_stride_dst = stride_dst * (height - 1); | 174 | 4.68k | ptrdiff_t y_stride_src = stride_src * (height - 1); | 175 | 174k | for (x = init_x; x < width; x++) | 176 | 170k | dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + offset_val); | 177 | 4.68k | height--; | 178 | 4.68k | } | 179 | 25.9k | } | 180 | | | 181 | 32.3k | { | 182 | 32.3k | int save_upper_left = !diag_edge[0] && sao_eo_class == SAO_EO_135D && !borders[0] && !borders[1]; | 183 | 32.3k | int save_upper_right = !diag_edge[1] && sao_eo_class == SAO_EO_45D && !borders[1] && !borders[2]; | 184 | 32.3k | int save_lower_right = !diag_edge[2] && sao_eo_class == SAO_EO_135D && !borders[2] && !borders[3]; | 185 | 32.3k | int save_lower_left = !diag_edge[3] && sao_eo_class == SAO_EO_45D && !borders[0] && !borders[3]; | 186 | | | 187 | | // Restore pixels that can't be modified | 188 | 32.3k | if(vert_edge[0] && sao_eo_class != SAO_EO_VERT) { | 189 | 23.8k | for(y = init_y+save_upper_left; y< height-save_lower_left; y++) | 190 | 22.8k | dst[y*stride_dst] = src[y*stride_src]; | 191 | 942 | } | 192 | 32.3k | if(vert_edge[1] && sao_eo_class != SAO_EO_VERT) { | 193 | 18.0k | for(y = init_y+save_upper_right; y< height-save_lower_right; y++) | 194 | 17.2k | dst[y*stride_dst+width-1] = src[y*stride_src+width-1]; | 195 | 879 | } | 196 | | | 197 | 32.3k | if(horiz_edge[0] && sao_eo_class != SAO_EO_HORIZ) { | 198 | 59.8k | for(x = init_x+save_upper_left; x < width-save_upper_right; x++) | 199 | 57.6k | dst[x] = src[x]; | 200 | 2.23k | } | 201 | 32.3k | if(horiz_edge[1] && sao_eo_class != SAO_EO_HORIZ) { | 202 | 61.0k | for(x = init_x+save_lower_left; x < width-save_lower_right; x++) | 203 | 58.8k | dst[(height-1)*stride_dst+x] = src[(height-1)*stride_src+x]; | 204 | 2.16k | } | 205 | 32.3k | if(diag_edge[0] && sao_eo_class == SAO_EO_135D) | 206 | 772 | dst[0] = src[0]; | 207 | 32.3k | if(diag_edge[1] && sao_eo_class == SAO_EO_45D) | 208 | 1.11k | dst[width-1] = src[width-1]; | 209 | 32.3k | if(diag_edge[2] && sao_eo_class == SAO_EO_135D) | 210 | 1.25k | dst[stride_dst*(height-1)+width-1] = src[stride_src*(height-1)+width-1]; | 211 | 32.3k | if(diag_edge[3] && sao_eo_class == SAO_EO_45D) | 212 | 872 | dst[stride_dst*(height-1)] = src[stride_src*(height-1)]; | 213 | | | 214 | 32.3k | } | 215 | 32.3k | } |
dsp.c:sao_edge_restore_1_10 Line | Count | Source | 136 | 72.7k | { | 137 | 72.7k | int x, y; | 138 | 72.7k | pixel *dst = (pixel *)_dst; | 139 | 72.7k | const pixel *src = (const pixel *)_src; | 140 | 72.7k | const int16_t *sao_offset_val = sao->offset_val[c_idx]; | 141 | 72.7k | int sao_eo_class = sao->eo_class[c_idx]; | 142 | 72.7k | int init_x = 0, init_y = 0, width = _width, height = _height; | 143 | | | 144 | 72.7k | stride_dst /= sizeof(pixel); | 145 | 72.7k | stride_src /= sizeof(pixel); | 146 | | | 147 | 72.7k | if (sao_eo_class != SAO_EO_VERT) { | 148 | 51.3k | if (borders[0]) { | 149 | 23.0k | int offset_val = sao_offset_val[0]; | 150 | 518k | for (y = 0; y < height; y++) { | 151 | 494k | dst[y * stride_dst] = av_clip_pixel(src[y * stride_src] + offset_val); | 152 | 494k | } | 153 | 23.0k | init_x = 1; | 154 | 23.0k | } | 155 | 51.3k | if (borders[2]) { | 156 | 17.1k | int offset_val = sao_offset_val[0]; | 157 | 17.1k | int offset = width - 1; | 158 | 303k | for (x = 0; x < height; x++) { | 159 | 286k | dst[x * stride_dst + offset] = av_clip_pixel(src[x * stride_src + offset] + offset_val); | 160 | 286k | } | 161 | 17.1k | width--; | 162 | 17.1k | } | 163 | 51.3k | } | 164 | 72.7k | if (sao_eo_class != SAO_EO_HORIZ) { | 165 | 58.0k | if (borders[1]) { | 166 | 29.2k | int offset_val = sao_offset_val[0]; | 167 | 431k | for (x = init_x; x < width; x++) | 168 | 402k | dst[x] = av_clip_pixel(src[x] + offset_val); | 169 | 29.2k | init_y = 1; | 170 | 29.2k | } | 171 | 58.0k | if (borders[3]) { | 172 | 29.7k | int offset_val = sao_offset_val[0]; | 173 | 29.7k | ptrdiff_t y_stride_dst = stride_dst * (height - 1); | 174 | 29.7k | ptrdiff_t y_stride_src = stride_src * (height - 1); | 175 | 523k | for (x = init_x; x < width; x++) | 176 | 493k | dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + offset_val); | 177 | 29.7k | height--; | 178 | 29.7k | } | 179 | 58.0k | } | 180 | | | 181 | 72.7k | { | 182 | 72.7k | int save_upper_left = !diag_edge[0] && sao_eo_class == SAO_EO_135D && !borders[0] && !borders[1]; | 183 | 72.7k | int save_upper_right = !diag_edge[1] && sao_eo_class == SAO_EO_45D && !borders[1] && !borders[2]; | 184 | 72.7k | int save_lower_right = !diag_edge[2] && sao_eo_class == SAO_EO_135D && !borders[2] && !borders[3]; | 185 | 72.7k | int save_lower_left = !diag_edge[3] && sao_eo_class == SAO_EO_45D && !borders[0] && !borders[3]; | 186 | | | 187 | | // Restore pixels that can't be modified | 188 | 72.7k | if(vert_edge[0] && sao_eo_class != SAO_EO_VERT) { | 189 | 80.3k | for(y = init_y+save_upper_left; y< height-save_lower_left; y++) | 190 | 78.8k | dst[y*stride_dst] = src[y*stride_src]; | 191 | 1.48k | } | 192 | 72.7k | if(vert_edge[1] && sao_eo_class != SAO_EO_VERT) { | 193 | 26.7k | for(y = init_y+save_upper_right; y< height-save_lower_right; y++) | 194 | 25.9k | dst[y*stride_dst+width-1] = src[y*stride_src+width-1]; | 195 | 715 | } | 196 | | | 197 | 72.7k | if(horiz_edge[0] && sao_eo_class != SAO_EO_HORIZ) { | 198 | 119k | for(x = init_x+save_upper_left; x < width-save_upper_right; x++) | 199 | 116k | dst[x] = src[x]; | 200 | 3.10k | } | 201 | 72.7k | if(horiz_edge[1] && sao_eo_class != SAO_EO_HORIZ) { | 202 | 123k | for(x = init_x+save_lower_left; x < width-save_lower_right; x++) | 203 | 119k | dst[(height-1)*stride_dst+x] = src[(height-1)*stride_src+x]; | 204 | 3.38k | } | 205 | 72.7k | if(diag_edge[0] && sao_eo_class == SAO_EO_135D) | 206 | 1.54k | dst[0] = src[0]; | 207 | 72.7k | if(diag_edge[1] && sao_eo_class == SAO_EO_45D) | 208 | 359 | dst[width-1] = src[width-1]; | 209 | 72.7k | if(diag_edge[2] && sao_eo_class == SAO_EO_135D) | 210 | 588 | dst[stride_dst*(height-1)+width-1] = src[stride_src*(height-1)+width-1]; | 211 | 72.7k | if(diag_edge[3] && sao_eo_class == SAO_EO_45D) | 212 | 687 | dst[stride_dst*(height-1)] = src[stride_src*(height-1)]; | 213 | | | 214 | 72.7k | } | 215 | 72.7k | } |
dsp.c:sao_edge_restore_1_12 Line | Count | Source | 136 | 154k | { | 137 | 154k | int x, y; | 138 | 154k | pixel *dst = (pixel *)_dst; | 139 | 154k | const pixel *src = (const pixel *)_src; | 140 | 154k | const int16_t *sao_offset_val = sao->offset_val[c_idx]; | 141 | 154k | int sao_eo_class = sao->eo_class[c_idx]; | 142 | 154k | int init_x = 0, init_y = 0, width = _width, height = _height; | 143 | | | 144 | 154k | stride_dst /= sizeof(pixel); | 145 | 154k | stride_src /= sizeof(pixel); | 146 | | | 147 | 154k | if (sao_eo_class != SAO_EO_VERT) { | 148 | 134k | if (borders[0]) { | 149 | 14.1k | int offset_val = sao_offset_val[0]; | 150 | 416k | for (y = 0; y < height; y++) { | 151 | 402k | dst[y * stride_dst] = av_clip_pixel(src[y * stride_src] + offset_val); | 152 | 402k | } | 153 | 14.1k | init_x = 1; | 154 | 14.1k | } | 155 | 134k | if (borders[2]) { | 156 | 10.3k | int offset_val = sao_offset_val[0]; | 157 | 10.3k | int offset = width - 1; | 158 | 263k | for (x = 0; x < height; x++) { | 159 | 252k | dst[x * stride_dst + offset] = av_clip_pixel(src[x * stride_src + offset] + offset_val); | 160 | 252k | } | 161 | 10.3k | width--; | 162 | 10.3k | } | 163 | 134k | } | 164 | 154k | if (sao_eo_class != SAO_EO_HORIZ) { | 165 | 108k | if (borders[1]) { | 166 | 17.0k | int offset_val = sao_offset_val[0]; | 167 | 333k | for (x = init_x; x < width; x++) | 168 | 316k | dst[x] = av_clip_pixel(src[x] + offset_val); | 169 | 17.0k | init_y = 1; | 170 | 17.0k | } | 171 | 108k | if (borders[3]) { | 172 | 12.8k | int offset_val = sao_offset_val[0]; | 173 | 12.8k | ptrdiff_t y_stride_dst = stride_dst * (height - 1); | 174 | 12.8k | ptrdiff_t y_stride_src = stride_src * (height - 1); | 175 | 432k | for (x = init_x; x < width; x++) | 176 | 419k | dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + offset_val); | 177 | 12.8k | height--; | 178 | 12.8k | } | 179 | 108k | } | 180 | | | 181 | 154k | { | 182 | 154k | int save_upper_left = !diag_edge[0] && sao_eo_class == SAO_EO_135D && !borders[0] && !borders[1]; | 183 | 154k | int save_upper_right = !diag_edge[1] && sao_eo_class == SAO_EO_45D && !borders[1] && !borders[2]; | 184 | 154k | int save_lower_right = !diag_edge[2] && sao_eo_class == SAO_EO_135D && !borders[2] && !borders[3]; | 185 | 154k | int save_lower_left = !diag_edge[3] && sao_eo_class == SAO_EO_45D && !borders[0] && !borders[3]; | 186 | | | 187 | | // Restore pixels that can't be modified | 188 | 154k | if(vert_edge[0] && sao_eo_class != SAO_EO_VERT) { | 189 | 45.3k | for(y = init_y+save_upper_left; y< height-save_lower_left; y++) | 190 | 44.6k | dst[y*stride_dst] = src[y*stride_src]; | 191 | 707 | } | 192 | 154k | if(vert_edge[1] && sao_eo_class != SAO_EO_VERT) { | 193 | 82.4k | for(y = init_y+save_upper_right; y< height-save_lower_right; y++) | 194 | 81.1k | dst[y*stride_dst+width-1] = src[y*stride_src+width-1]; | 195 | 1.33k | } | 196 | | | 197 | 154k | if(horiz_edge[0] && sao_eo_class != SAO_EO_HORIZ) { | 198 | 38.9k | for(x = init_x+save_upper_left; x < width-save_upper_right; x++) | 199 | 37.0k | dst[x] = src[x]; | 200 | 1.96k | } | 201 | 154k | if(horiz_edge[1] && sao_eo_class != SAO_EO_HORIZ) { | 202 | 43.3k | for(x = init_x+save_lower_left; x < width-save_lower_right; x++) | 203 | 40.9k | dst[(height-1)*stride_dst+x] = src[(height-1)*stride_src+x]; | 204 | 2.40k | } | 205 | 154k | if(diag_edge[0] && sao_eo_class == SAO_EO_135D) | 206 | 657 | dst[0] = src[0]; | 207 | 154k | if(diag_edge[1] && sao_eo_class == SAO_EO_45D) | 208 | 775 | dst[width-1] = src[width-1]; | 209 | 154k | if(diag_edge[2] && sao_eo_class == SAO_EO_135D) | 210 | 942 | dst[stride_dst*(height-1)+width-1] = src[stride_src*(height-1)+width-1]; | 211 | 154k | if(diag_edge[3] && sao_eo_class == SAO_EO_45D) | 212 | 550 | dst[stride_dst*(height-1)] = src[stride_src*(height-1)]; | 213 | | | 214 | 154k | } | 215 | 154k | } |
dsp.c:sao_edge_restore_1_8 Line | Count | Source | 136 | 90.5k | { | 137 | 90.5k | int x, y; | 138 | 90.5k | pixel *dst = (pixel *)_dst; | 139 | 90.5k | const pixel *src = (const pixel *)_src; | 140 | 90.5k | const int16_t *sao_offset_val = sao->offset_val[c_idx]; | 141 | 90.5k | int sao_eo_class = sao->eo_class[c_idx]; | 142 | 90.5k | int init_x = 0, init_y = 0, width = _width, height = _height; | 143 | | | 144 | 90.5k | stride_dst /= sizeof(pixel); | 145 | 90.5k | stride_src /= sizeof(pixel); | 146 | | | 147 | 90.5k | if (sao_eo_class != SAO_EO_VERT) { | 148 | 69.1k | if (borders[0]) { | 149 | 9.98k | int offset_val = sao_offset_val[0]; | 150 | 258k | for (y = 0; y < height; y++) { | 151 | 248k | dst[y * stride_dst] = av_clip_pixel(src[y * stride_src] + offset_val); | 152 | 248k | } | 153 | 9.98k | init_x = 1; | 154 | 9.98k | } | 155 | 69.1k | if (borders[2]) { | 156 | 7.68k | int offset_val = sao_offset_val[0]; | 157 | 7.68k | int offset = width - 1; | 158 | 178k | for (x = 0; x < height; x++) { | 159 | 170k | dst[x * stride_dst + offset] = av_clip_pixel(src[x * stride_src + offset] + offset_val); | 160 | 170k | } | 161 | 7.68k | width--; | 162 | 7.68k | } | 163 | 69.1k | } | 164 | 90.5k | if (sao_eo_class != SAO_EO_HORIZ) { | 165 | 67.5k | if (borders[1]) { | 166 | 16.7k | int offset_val = sao_offset_val[0]; | 167 | 412k | for (x = init_x; x < width; x++) | 168 | 395k | dst[x] = av_clip_pixel(src[x] + offset_val); | 169 | 16.7k | init_y = 1; | 170 | 16.7k | } | 171 | 67.5k | if (borders[3]) { | 172 | 15.7k | int offset_val = sao_offset_val[0]; | 173 | 15.7k | ptrdiff_t y_stride_dst = stride_dst * (height - 1); | 174 | 15.7k | ptrdiff_t y_stride_src = stride_src * (height - 1); | 175 | 388k | for (x = init_x; x < width; x++) | 176 | 373k | dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + offset_val); | 177 | 15.7k | height--; | 178 | 15.7k | } | 179 | 67.5k | } | 180 | | | 181 | 90.5k | { | 182 | 90.5k | int save_upper_left = !diag_edge[0] && sao_eo_class == SAO_EO_135D && !borders[0] && !borders[1]; | 183 | 90.5k | int save_upper_right = !diag_edge[1] && sao_eo_class == SAO_EO_45D && !borders[1] && !borders[2]; | 184 | 90.5k | int save_lower_right = !diag_edge[2] && sao_eo_class == SAO_EO_135D && !borders[2] && !borders[3]; | 185 | 90.5k | int save_lower_left = !diag_edge[3] && sao_eo_class == SAO_EO_45D && !borders[0] && !borders[3]; | 186 | | | 187 | | // Restore pixels that can't be modified | 188 | 90.5k | if(vert_edge[0] && sao_eo_class != SAO_EO_VERT) { | 189 | 23.1k | for(y = init_y+save_upper_left; y< height-save_lower_left; y++) | 190 | 22.2k | dst[y*stride_dst] = src[y*stride_src]; | 191 | 921 | } | 192 | 90.5k | if(vert_edge[1] && sao_eo_class != SAO_EO_VERT) { | 193 | 26.1k | for(y = init_y+save_upper_right; y< height-save_lower_right; y++) | 194 | 25.1k | dst[y*stride_dst+width-1] = src[y*stride_src+width-1]; | 195 | 961 | } | 196 | | | 197 | 90.5k | if(horiz_edge[0] && sao_eo_class != SAO_EO_HORIZ) { | 198 | 216k | for(x = init_x+save_upper_left; x < width-save_upper_right; x++) | 199 | 209k | dst[x] = src[x]; | 200 | 7.16k | } | 201 | 90.5k | if(horiz_edge[1] && sao_eo_class != SAO_EO_HORIZ) { | 202 | 64.1k | for(x = init_x+save_lower_left; x < width-save_lower_right; x++) | 203 | 62.1k | dst[(height-1)*stride_dst+x] = src[(height-1)*stride_src+x]; | 204 | 1.98k | } | 205 | 90.5k | if(diag_edge[0] && sao_eo_class == SAO_EO_135D) | 206 | 4.31k | dst[0] = src[0]; | 207 | 90.5k | if(diag_edge[1] && sao_eo_class == SAO_EO_45D) | 208 | 1.07k | dst[width-1] = src[width-1]; | 209 | 90.5k | if(diag_edge[2] && sao_eo_class == SAO_EO_135D) | 210 | 630 | dst[stride_dst*(height-1)+width-1] = src[stride_src*(height-1)+width-1]; | 211 | 90.5k | if(diag_edge[3] && sao_eo_class == SAO_EO_45D) | 212 | 733 | dst[stride_dst*(height-1)] = src[stride_src*(height-1)]; | 213 | | | 214 | 90.5k | } | 215 | 90.5k | } |
dsp.c:sao_edge_restore_1_12 Line | Count | Source | 136 | 154k | { | 137 | 154k | int x, y; | 138 | 154k | pixel *dst = (pixel *)_dst; | 139 | 154k | const pixel *src = (const pixel *)_src; | 140 | 154k | const int16_t *sao_offset_val = sao->offset_val[c_idx]; | 141 | 154k | int sao_eo_class = sao->eo_class[c_idx]; | 142 | 154k | int init_x = 0, init_y = 0, width = _width, height = _height; | 143 | | | 144 | 154k | stride_dst /= sizeof(pixel); | 145 | 154k | stride_src /= sizeof(pixel); | 146 | | | 147 | 154k | if (sao_eo_class != SAO_EO_VERT) { | 148 | 134k | if (borders[0]) { | 149 | 14.1k | int offset_val = sao_offset_val[0]; | 150 | 416k | for (y = 0; y < height; y++) { | 151 | 402k | dst[y * stride_dst] = av_clip_pixel(src[y * stride_src] + offset_val); | 152 | 402k | } | 153 | 14.1k | init_x = 1; | 154 | 14.1k | } | 155 | 134k | if (borders[2]) { | 156 | 10.3k | int offset_val = sao_offset_val[0]; | 157 | 10.3k | int offset = width - 1; | 158 | 263k | for (x = 0; x < height; x++) { | 159 | 252k | dst[x * stride_dst + offset] = av_clip_pixel(src[x * stride_src + offset] + offset_val); | 160 | 252k | } | 161 | 10.3k | width--; | 162 | 10.3k | } | 163 | 134k | } | 164 | 154k | if (sao_eo_class != SAO_EO_HORIZ) { | 165 | 108k | if (borders[1]) { | 166 | 17.0k | int offset_val = sao_offset_val[0]; | 167 | 333k | for (x = init_x; x < width; x++) | 168 | 316k | dst[x] = av_clip_pixel(src[x] + offset_val); | 169 | 17.0k | init_y = 1; | 170 | 17.0k | } | 171 | 108k | if (borders[3]) { | 172 | 12.8k | int offset_val = sao_offset_val[0]; | 173 | 12.8k | ptrdiff_t y_stride_dst = stride_dst * (height - 1); | 174 | 12.8k | ptrdiff_t y_stride_src = stride_src * (height - 1); | 175 | 432k | for (x = init_x; x < width; x++) | 176 | 419k | dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + offset_val); | 177 | 12.8k | height--; | 178 | 12.8k | } | 179 | 108k | } | 180 | | | 181 | 154k | { | 182 | 154k | int save_upper_left = !diag_edge[0] && sao_eo_class == SAO_EO_135D && !borders[0] && !borders[1]; | 183 | 154k | int save_upper_right = !diag_edge[1] && sao_eo_class == SAO_EO_45D && !borders[1] && !borders[2]; | 184 | 154k | int save_lower_right = !diag_edge[2] && sao_eo_class == SAO_EO_135D && !borders[2] && !borders[3]; | 185 | 154k | int save_lower_left = !diag_edge[3] && sao_eo_class == SAO_EO_45D && !borders[0] && !borders[3]; | 186 | | | 187 | | // Restore pixels that can't be modified | 188 | 154k | if(vert_edge[0] && sao_eo_class != SAO_EO_VERT) { | 189 | 45.3k | for(y = init_y+save_upper_left; y< height-save_lower_left; y++) | 190 | 44.6k | dst[y*stride_dst] = src[y*stride_src]; | 191 | 707 | } | 192 | 154k | if(vert_edge[1] && sao_eo_class != SAO_EO_VERT) { | 193 | 82.4k | for(y = init_y+save_upper_right; y< height-save_lower_right; y++) | 194 | 81.1k | dst[y*stride_dst+width-1] = src[y*stride_src+width-1]; | 195 | 1.33k | } | 196 | | | 197 | 154k | if(horiz_edge[0] && sao_eo_class != SAO_EO_HORIZ) { | 198 | 38.9k | for(x = init_x+save_upper_left; x < width-save_upper_right; x++) | 199 | 37.0k | dst[x] = src[x]; | 200 | 1.96k | } | 201 | 154k | if(horiz_edge[1] && sao_eo_class != SAO_EO_HORIZ) { | 202 | 43.3k | for(x = init_x+save_lower_left; x < width-save_lower_right; x++) | 203 | 40.9k | dst[(height-1)*stride_dst+x] = src[(height-1)*stride_src+x]; | 204 | 2.40k | } | 205 | 154k | if(diag_edge[0] && sao_eo_class == SAO_EO_135D) | 206 | 657 | dst[0] = src[0]; | 207 | 154k | if(diag_edge[1] && sao_eo_class == SAO_EO_45D) | 208 | 775 | dst[width-1] = src[width-1]; | 209 | 154k | if(diag_edge[2] && sao_eo_class == SAO_EO_135D) | 210 | 942 | dst[stride_dst*(height-1)+width-1] = src[stride_src*(height-1)+width-1]; | 211 | 154k | if(diag_edge[3] && sao_eo_class == SAO_EO_45D) | 212 | 550 | dst[stride_dst*(height-1)] = src[stride_src*(height-1)]; | 213 | | | 214 | 154k | } | 215 | 154k | } |
dsp.c:sao_edge_restore_1_10 Line | Count | Source | 136 | 72.7k | { | 137 | 72.7k | int x, y; | 138 | 72.7k | pixel *dst = (pixel *)_dst; | 139 | 72.7k | const pixel *src = (const pixel *)_src; | 140 | 72.7k | const int16_t *sao_offset_val = sao->offset_val[c_idx]; | 141 | 72.7k | int sao_eo_class = sao->eo_class[c_idx]; | 142 | 72.7k | int init_x = 0, init_y = 0, width = _width, height = _height; | 143 | | | 144 | 72.7k | stride_dst /= sizeof(pixel); | 145 | 72.7k | stride_src /= sizeof(pixel); | 146 | | | 147 | 72.7k | if (sao_eo_class != SAO_EO_VERT) { | 148 | 51.3k | if (borders[0]) { | 149 | 23.0k | int offset_val = sao_offset_val[0]; | 150 | 518k | for (y = 0; y < height; y++) { | 151 | 494k | dst[y * stride_dst] = av_clip_pixel(src[y * stride_src] + offset_val); | 152 | 494k | } | 153 | 23.0k | init_x = 1; | 154 | 23.0k | } | 155 | 51.3k | if (borders[2]) { | 156 | 17.1k | int offset_val = sao_offset_val[0]; | 157 | 17.1k | int offset = width - 1; | 158 | 303k | for (x = 0; x < height; x++) { | 159 | 286k | dst[x * stride_dst + offset] = av_clip_pixel(src[x * stride_src + offset] + offset_val); | 160 | 286k | } | 161 | 17.1k | width--; | 162 | 17.1k | } | 163 | 51.3k | } | 164 | 72.7k | if (sao_eo_class != SAO_EO_HORIZ) { | 165 | 58.0k | if (borders[1]) { | 166 | 29.2k | int offset_val = sao_offset_val[0]; | 167 | 431k | for (x = init_x; x < width; x++) | 168 | 402k | dst[x] = av_clip_pixel(src[x] + offset_val); | 169 | 29.2k | init_y = 1; | 170 | 29.2k | } | 171 | 58.0k | if (borders[3]) { | 172 | 29.7k | int offset_val = sao_offset_val[0]; | 173 | 29.7k | ptrdiff_t y_stride_dst = stride_dst * (height - 1); | 174 | 29.7k | ptrdiff_t y_stride_src = stride_src * (height - 1); | 175 | 523k | for (x = init_x; x < width; x++) | 176 | 493k | dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + offset_val); | 177 | 29.7k | height--; | 178 | 29.7k | } | 179 | 58.0k | } | 180 | | | 181 | 72.7k | { | 182 | 72.7k | int save_upper_left = !diag_edge[0] && sao_eo_class == SAO_EO_135D && !borders[0] && !borders[1]; | 183 | 72.7k | int save_upper_right = !diag_edge[1] && sao_eo_class == SAO_EO_45D && !borders[1] && !borders[2]; | 184 | 72.7k | int save_lower_right = !diag_edge[2] && sao_eo_class == SAO_EO_135D && !borders[2] && !borders[3]; | 185 | 72.7k | int save_lower_left = !diag_edge[3] && sao_eo_class == SAO_EO_45D && !borders[0] && !borders[3]; | 186 | | | 187 | | // Restore pixels that can't be modified | 188 | 72.7k | if(vert_edge[0] && sao_eo_class != SAO_EO_VERT) { | 189 | 80.3k | for(y = init_y+save_upper_left; y< height-save_lower_left; y++) | 190 | 78.8k | dst[y*stride_dst] = src[y*stride_src]; | 191 | 1.48k | } | 192 | 72.7k | if(vert_edge[1] && sao_eo_class != SAO_EO_VERT) { | 193 | 26.7k | for(y = init_y+save_upper_right; y< height-save_lower_right; y++) | 194 | 25.9k | dst[y*stride_dst+width-1] = src[y*stride_src+width-1]; | 195 | 715 | } | 196 | | | 197 | 72.7k | if(horiz_edge[0] && sao_eo_class != SAO_EO_HORIZ) { | 198 | 119k | for(x = init_x+save_upper_left; x < width-save_upper_right; x++) | 199 | 116k | dst[x] = src[x]; | 200 | 3.10k | } | 201 | 72.7k | if(horiz_edge[1] && sao_eo_class != SAO_EO_HORIZ) { | 202 | 123k | for(x = init_x+save_lower_left; x < width-save_lower_right; x++) | 203 | 119k | dst[(height-1)*stride_dst+x] = src[(height-1)*stride_src+x]; | 204 | 3.38k | } | 205 | 72.7k | if(diag_edge[0] && sao_eo_class == SAO_EO_135D) | 206 | 1.54k | dst[0] = src[0]; | 207 | 72.7k | if(diag_edge[1] && sao_eo_class == SAO_EO_45D) | 208 | 359 | dst[width-1] = src[width-1]; | 209 | 72.7k | if(diag_edge[2] && sao_eo_class == SAO_EO_135D) | 210 | 588 | dst[stride_dst*(height-1)+width-1] = src[stride_src*(height-1)+width-1]; | 211 | 72.7k | if(diag_edge[3] && sao_eo_class == SAO_EO_45D) | 212 | 687 | dst[stride_dst*(height-1)] = src[stride_src*(height-1)]; | 213 | | | 214 | 72.7k | } | 215 | 72.7k | } |
|
216 | | |
217 | | #undef CMP |