mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-20 21:00:41 +08:00
swscale/ops: add explicit row offset to SwsDitherOp
To improve decorrelation between components, we offset the dither matrix
slightly for each component. This is currently done by adding a hard-coded
offset of {0, 3, 2, 5} to each of the four components, respectively.
However, this represents a serious challenge when re-ordering SwsDitherOp
past a swizzle, or when splitting an SwsOpList into multiple sub-operations
(e.g. for decoupling luma from subsampled chroma when they are independent).
To fix this on a fundamental level, we have to keep track of the offset per
channel as part of the SwsDitherOp metadata, and respect those values at
runtime.
This commit merely adds the metadata; the update to the underlying backends
will come in a follow-up commit. The FATE change is merely due to the
added offsets in the op list print-out.
This commit is contained in:
@@ -624,6 +624,7 @@ static void check_dither(void)
|
||||
/* Test all sizes up to 256x256 */
|
||||
for (int size_log2 = 0; size_log2 <= 8; size_log2++) {
|
||||
const int size = 1 << size_log2;
|
||||
const int mask = size - 1;
|
||||
AVRational *matrix = av_refstruct_allocz(size * size * sizeof(*matrix));
|
||||
if (!matrix) {
|
||||
fail();
|
||||
@@ -641,7 +642,8 @@ static void check_dither(void)
|
||||
.op = SWS_OP_DITHER,
|
||||
.type = t,
|
||||
.dither.size_log2 = size_log2,
|
||||
.dither.matrix = matrix,
|
||||
.dither.matrix = matrix,
|
||||
.dither.y_offset = {0, 3 & mask, 2 & mask, 5 & mask},
|
||||
});
|
||||
|
||||
av_refstruct_unref(&matrix);
|
||||
|
||||
@@ -1 +1 @@
|
||||
eae3a49ac3af42c13ad274883611ac21
|
||||
0f38d0a1cb1f9367352c92b23bcb954e
|
||||
|
||||
Reference in New Issue
Block a user