for (j = 0; j < 4; j++) {
static const double lambda_square[] = {
- // exp((i - 15.4244) / 8.4010)
- 0.159451, 0.179607, 0.202310, 0.227884, 0.256690, 0.289138, 0.325687,
- 0.366856, 0.413230, 0.465465, 0.524303, 0.590579, 0.665233, 0.749323,
- 0.844044, 0.950737, 1.070917, 1.206289, 1.358774, 1.530533, 1.724004,
- 1.941931, 2.187406, 2.463911, 2.775368, 3.126195, 3.521370, 3.966498,
- 4.467893, 5.032669, 5.668837, 6.385421, 7.192586, 8.101784, 9.125911,
- 10.27949, 11.57890, 13.04256, 14.69124, 16.54832, 18.64016, 20.99641,
- 23.65052, 26.64013, 30.00764, 33.80084, 38.07352, 42.88630, 48.30746,
- 54.41389, 61.29221, 69.04002, 77.76720, 87.59756, 98.67056, 111.1432,
- 125.1926, 141.0179, 158.8436, 178.9227, 201.5399, 227.0160, 255.7126,
- 288.0366
+ // exp(x / 8.5)
+ 1.0000, 1.1248, 1.2653, 1.4232, 1.6009, 1.8008, 2.0256, 2.2785,
+ 2.5630, 2.8830, 3.2429, 3.6478, 4.1032, 4.6155, 5.1917, 5.8399,
+ 6.5689, 7.3891, 8.3116, 9.3492, 10.516, 11.829, 13.306, 14.967,
+ 16.836, 18.938, 21.302, 23.962, 26.953, 30.318, 34.103, 38.361,
+ 43.151, 48.538, 54.598, 61.414, 69.082, 77.706, 87.408, 98.320,
+ 110.59, 124.40, 139.93, 157.40, 177.05, 199.16, 224.02, 251.99,
+ 283.45, 318.84, 358.65, 403.42, 453.79, 510.45, 574.17, 645.86,
+ 726.49, 817.19, 919.22, 1033.9, 1163.0, 1308.2, 1471.6, 1655.3
};
// Estimate the bit costs and adjust the square errors
double lambda =
lambda_square[av1_get_qindex(&cm->seg, 0, cm->base_qindex) >> 2];
- int i, cost = (int)((1.2 * lambda * (sums[j][0] + 2 + 2 * (j > 0)) + 0.5));
+ int i, cost = (int)((lambda * (sums[j][0] + 2 + 2 * (j > 0)) + 0.5));
for (i = 0; i < 4; i++)
sums[j][i] = ((sums[j][i] + (i && j) * cost) << 4) + j * 4 + i;
}
((cm->frame_to_show->y_crop_height + 31) & ~31) >>
10));
if (!is_lossless_requested(&cpi->oxcf)) {
- // Test CLPF
- int i, hq = 1;
- // TODO(yaowu): investigate per-segment CLPF decision and
- // an optimal threshold, use 80 for now.
- for (i = 0; i < MAX_SEGMENTS; i++)
- hq &= av1_get_qindex(&cm->seg, i, cm->base_qindex) < 80;
-
- // Don't try filter if the entire image is nearly losslessly encoded
- if (!hq) {
- // Find the best strength and block size for the entire frame
- int fb_size_log2, strength;
- av1_clpf_test_frame(&cpi->last_frame_uf, cpi->Source, cm, &strength,
- &fb_size_log2);
-
- if (!fb_size_log2) fb_size_log2 = get_msb(MAX_FB_SIZE);
-
- if (!strength) { // Better to disable for the whole frame?
- cm->clpf_strength = 0;
- } else {
- // Apply the filter using the chosen strength
- cm->clpf_strength = strength - (strength == 4);
- cm->clpf_size =
- fb_size_log2 ? fb_size_log2 - get_msb(MAX_FB_SIZE) + 3 : 0;
- aom_yv12_copy_frame(cm->frame_to_show, &cpi->last_frame_uf);
- cm->clpf_numblocks =
- av1_clpf_frame(cm->frame_to_show, &cpi->last_frame_uf, cpi->Source,
- cm, !!cm->clpf_size, strength, 4 + cm->clpf_size,
- cm->clpf_blocks, av1_clpf_decision);
- }
+ // Find the best strength and block size for the entire frame
+ int fb_size_log2, strength;
+ av1_clpf_test_frame(cm->frame_to_show, cpi->Source, cm, &strength,
+ &fb_size_log2);
+
+ if (!fb_size_log2) fb_size_log2 = get_msb(MAX_FB_SIZE);
+
+ if (strength) {
+ // Apply the filter using the chosen strength
+ cm->clpf_strength = strength - (strength == 4);
+ cm->clpf_size =
+ fb_size_log2 ? fb_size_log2 - get_msb(MAX_FB_SIZE) + 3 : 0;
+ aom_yv12_copy_frame(cm->frame_to_show, &cpi->last_frame_uf);
+ cm->clpf_numblocks =
+ av1_clpf_frame(cm->frame_to_show, &cpi->last_frame_uf, cpi->Source,
+ cm, !!cm->clpf_size, strength, 4 + cm->clpf_size,
+ cm->clpf_blocks, av1_clpf_decision);
}
}
#endif