55 return prev ? NULL : s->
dct;
58 #define OFFSET(x) offsetof(SPPContext, x)
59 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
82 { 0, 48, 12, 60, 3, 51, 15, 63 },
83 { 32, 16, 44, 28, 35, 19, 47, 31 },
84 { 8, 56, 4, 52, 11, 59, 7, 55 },
85 { 40, 24, 36, 20, 43, 27, 39, 23 },
86 { 2, 50, 14, 62, 1, 49, 13, 61 },
87 { 34, 18, 46, 30, 33, 17, 45, 29 },
88 { 10, 58, 6, 54, 9, 57, 5, 53 },
89 { 42, 26, 38, 22, 41, 25, 37, 21 },
95 {0,0}, {2,2}, {6,4}, {4,6},
96 {0,0}, {5,1}, {2,2}, {7,3}, {4,4}, {1,5}, {6,6}, {3,7},
98 {0,0}, {4,0}, {1,1}, {5,1}, {3,2}, {7,2}, {2,3}, {6,3},
99 {0,4}, {4,4}, {1,5}, {5,5}, {3,6}, {7,6}, {2,7}, {6,7},
101 {0,0}, {0,2}, {0,4}, {0,6}, {1,1}, {1,3}, {1,5}, {1,7},
102 {2,0}, {2,2}, {2,4}, {2,6}, {3,1}, {3,3}, {3,5}, {3,7},
103 {4,0}, {4,2}, {4,4}, {4,6}, {5,1}, {5,3}, {5,5}, {5,7},
104 {6,0}, {6,2}, {6,4}, {6,6}, {7,1}, {7,3}, {7,5}, {7,7},
106 {0,0}, {4,4}, {0,4}, {4,0}, {2,2}, {6,6}, {2,6}, {6,2},
107 {0,2}, {4,6}, {0,6}, {4,2}, {2,0}, {6,4}, {2,4}, {6,0},
108 {1,1}, {5,5}, {1,5}, {5,1}, {3,3}, {7,7}, {3,7}, {7,3},
109 {1,3}, {5,7}, {1,7}, {5,3}, {3,1}, {7,5}, {3,5}, {7,1},
110 {0,1}, {4,5}, {0,5}, {4,1}, {2,3}, {6,7}, {2,7}, {6,3},
111 {0,3}, {4,7}, {0,7}, {4,3}, {2,1}, {6,5}, {2,5}, {6,1},
112 {1,0}, {5,4}, {1,4}, {5,0}, {3,2}, {7,6}, {3,6}, {7,2},
113 {1,2}, {5,6}, {1,6}, {5,2}, {3,0}, {7,4}, {3,4}, {7,0},
117 int qp,
const uint8_t *permutation)
122 unsigned threshold1 = qp * ((1<<4) - bias) - 1;
123 unsigned threshold2 = threshold1 << 1;
125 memset(dst, 0, 64 *
sizeof(dst[0]));
126 dst[0] = (src[0] + 4) >> 3;
128 for (i = 1; i < 64; i++) {
130 if (((
unsigned)(level + threshold1)) > threshold2) {
131 const int j = permutation[i];
132 dst[j] = (level + 4) >> 3;
138 int qp,
const uint8_t *permutation)
143 unsigned threshold1 = qp * ((1<<4) - bias) - 1;
144 unsigned threshold2 = threshold1 << 1;
146 memset(dst, 0, 64 *
sizeof(dst[0]));
147 dst[0] = (src[0] + 4) >> 3;
149 for (i = 1; i < 64; i++) {
151 if (((
unsigned)(level + threshold1)) > threshold2) {
152 const int j = permutation[i];
153 if (level > 0) dst[j] = (level - threshold1 + 4) >> 3;
154 else dst[j] = (level + threshold1 + 4) >> 3;
160 int dst_linesize,
int src_linesize,
166 #define STORE(pos) do { \
167 temp = ((src[x + y*src_linesize + pos] << log2_scale) + d[pos]) >> 6; \
169 temp = ~(temp >> 31); \
170 dst[x + y*dst_linesize + pos] = temp; \
173 for (y = 0; y <
height; y++) {
175 for (x = 0; x <
width; x += 8) {
189 static inline void add_block(int16_t *dst,
int linesize,
const int16_t
block[64])
193 for (y = 0; y < 8; y++) {
194 *(uint32_t *)&dst[0 + y*linesize] += *(uint32_t *)&block[0 + y*8];
195 *(uint32_t *)&dst[2 + y*linesize] += *(uint32_t *)&block[2 + y*8];
196 *(uint32_t *)&dst[4 + y*linesize] += *(uint32_t *)&block[4 + y*8];
197 *(uint32_t *)&dst[6 + y*linesize] += *(uint32_t *)&block[6 + y*8];
214 int dst_linesize,
int src_linesize,
int width,
int height,
215 const uint8_t *qp_table,
int qp_stride,
int is_luma)
221 int16_t *
block = (int16_t *)block_align;
222 int16_t *block2 = (int16_t *)(block_align + 16);
224 for (y = 0; y <
height; y++) {
225 int index = 8 + 8*linesize + y*linesize;
226 memcpy(p->
src + index, src + y*src_linesize, width);
227 for (x = 0; x < 8; x++) {
228 p->
src[index - x - 1] = p->
src[index + x ];
229 p->
src[index + width + x ] = p->
src[index + width - x - 1];
232 for (y = 0; y < 8; y++) {
233 memcpy(p->
src + ( 7-y)*linesize, p->
src + ( y+8)*linesize, linesize);
234 memcpy(p->
src + (height+8+y)*linesize, p->
src + (height-y+7)*linesize, linesize);
237 for (y = 0; y < height + 8; y += 8) {
238 memset(p->
temp + (8 + y) * linesize, 0, 8 * linesize *
sizeof(*p->
temp));
239 for (x = 0; x < width + 8; x += 8) {
245 const int qps = 3 + is_luma;
246 qp = qp_table[(
FFMIN(x, width - 1) >> qps) + (
FFMIN(y, height - 1) >> qps) * qp_stride];
249 for (i = 0; i <
count; i++) {
250 const int x1 = x +
offset[i + count - 1][0];
251 const int y1 = y + offset[i + count - 1][1];
252 const int index = x1 + y1*linesize;
262 dst_linesize, linesize, width,
285 const int h =
FFALIGN(inlink->
h + 16, 16);
312 const int8_t *qp_table = NULL;
333 av_assert0(w * h <= spp->non_b_qp_alloc_size);
342 if (qp_table || spp->
qp) {
349 const int aligned_w =
FFALIGN(inlink->
w, 8);
350 const int aligned_h =
FFALIGN(inlink->
h, 8);
373 inlink->
w, inlink->
h);
380 char *res,
int res_len,
int flags)
384 if (!strcmp(cmd,
"level")) {
385 if (!strcmp(args,
"max"))
467 .priv_class = &spp_class,