43 #define OFFSET(x) offsetof(PP7Context, x)
44 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
57 { 0, 48, 12, 60, 3, 51, 15, 63, },
58 { 32, 16, 44, 28, 35, 19, 47, 31, },
59 { 8, 56, 4, 52, 11, 59, 7, 55, },
60 { 40, 24, 36, 20, 43, 27, 39, 23, },
61 { 2, 50, 14, 62, 1, 49, 13, 61, },
62 { 34, 18, 46, 30, 33, 17, 45, 29, },
63 { 10, 58, 6, 54, 9, 57, 5, 53, },
64 { 42, 26, 38, 22, 41, 25, 37, 21, },
71 #define SN1 2.2360679775
72 #define SN2 3.16227766017
77 N / (N1 *
N0),
N / (N1 * N1),
N / (N1 *
N0),
N / (N1 * N2),
79 N / (N2 *
N0),
N / (N2 * N1),
N / (N2 *
N0),
N / (N2 * N2),
84 N / (SN2 *
SN0),
N / (SN2 * SN2),
N / (SN2 *
SN0),
N / (SN2 * SN2),
86 N / (SN2 *
SN0),
N / (SN2 * SN2),
N / (SN2 *
SN0),
N / (SN2 * SN2),
94 for (qp = 0; qp < 99; qp++) {
95 for (i = 0; i < 16; i++) {
105 for (i = 0; i < 4; i++) {
106 int s0 = src[0 * stride] + src[6 * stride];
107 int s1 = src[1 * stride] + src[5 * stride];
108 int s2 = src[2 * stride] + src[4 * stride];
109 int s3 = src[3 * stride];
117 dst[1] = 2 * s3 +
s2;
118 dst[3] = s3 - 2 *
s2;
128 for (i = 0; i < 4; i++) {
129 int s0 = src[0 * 4] + src[6 * 4];
130 int s1 = src[1 * 4] + src[5 * 4];
131 int s2 = src[2 * 4] + src[4 * 4];
140 dst[1 * 4] = 2 * s3 +
s2;
141 dst[3 * 4] = s3 - 2 *
s2;
153 for (i = 1; i < 16; i++) {
154 unsigned int threshold1 = p->
thres2[qp][i];
155 unsigned int threshold2 = threshold1 << 1;
157 if (((
unsigned)(level + threshold1)) > threshold2)
158 a += level * factor[i];
160 return (a + (1 << 11)) >> 12;
169 for (i = 1; i < 16; i++) {
170 unsigned int threshold1 = p->
thres2[qp][i];
171 unsigned int threshold2 = threshold1 << 1;
173 if (((
unsigned)(level + threshold1)) > threshold2) {
174 if (((
unsigned)(level + 2 * threshold1)) > 2 * threshold2)
175 a += level * factor[i];
178 a += 2 * (level - (int)threshold1) * factor[i];
180 a += 2 * (level + (int)threshold1) * factor[i];
184 return (a + (1 << 11)) >> 12;
193 for (i = 1; i < 16; i++) {
194 unsigned int threshold1 = p->
thres2[qp][i];
195 unsigned int threshold2 = threshold1 << 1;
197 if (((
unsigned)(level + threshold1)) > threshold2) {
199 a += (level - (int)threshold1) * factor[i];
201 a += (level + (int)threshold1) * factor[i];
204 return (a + (1 << 11)) >> 12;
208 int dst_stride,
int src_stride,
210 uint8_t *qp_store,
int qp_stride,
int is_luma)
216 int16_t *
temp = (int16_t *)(p->
src + 32);
218 if (!src || !dst)
return;
219 for (y = 0; y <
height; y++) {
220 int index = 8 + 8 * stride + y * stride;
221 memcpy(p_src + index, src + y * src_stride, width);
222 for (x = 0; x < 8; x++) {
223 p_src[index - x - 1]= p_src[index + x ];
224 p_src[index + width + x ]= p_src[index + width - x - 1];
227 for (y = 0; y < 8; y++) {
228 memcpy(p_src + ( 7 - y ) * stride, p_src + ( y + 8 ) * stride, stride);
229 memcpy(p_src + (height + 8 + y) * stride, p_src + (height - y + 7) * stride, stride);
233 for (y = 0; y <
height; y++) {
234 for (x = -8; x < 0; x += 4) {
235 const int index = x + y * stride + (8 - 3) * (1 + stride) + 8;
237 int16_t *tp =
temp + 4 * x;
239 dctA_c(tp + 4 * 8, src, stride);
241 for (x = 0; x <
width; ) {
242 const int qps = 3 + is_luma;
249 qp = qp_store[ (
FFMIN(x, width - 1) >> qps) + (
FFMIN(y, height - 1) >> qps) * qp_stride];
252 for (; x <
end; x++) {
253 const int index = x + y * stride + (8 - 3) * (1 + stride) + 8;
255 int16_t *tp =
temp + 4 * x;
259 dctA_c(tp + 4 * 8, src, stride);
264 v = (v +
dither[y & 7][x & 7]) >> 6;
265 if ((
unsigned)v > 255)
267 dst[x + y * dst_stride] =
v;
292 const int h =
FFALIGN(inlink->
h + 16, 16);
341 const int aligned_w =
FFALIGN(inlink->
w, 8);
342 const int aligned_h =
FFALIGN(inlink->
h, 8);
354 if (qp_table || pp7->
qp) {
357 inlink->
w, inlink->
h, qp_table, qp_stride, 1);
359 cw, ch, qp_table, qp_stride, 0);
361 cw, ch, qp_table, qp_stride, 0);
370 inlink->
w, inlink->
h);
408 .priv_class = &pp7_class,