mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-01-12 00:06:51 +08:00
swscale/ops: remove broken value range assumption hack
This information is now pre-filled automatically for SWS_OP_READ when
relevant.
yuv444p10msbbe -> rgb24:
[u16 XXXX -> +++X] SWS_OP_READ : 3 elem(s) planar >> 0
[u16 ...X -> +++X] SWS_OP_SWAP_BYTES
[u16 ...X -> +++X] SWS_OP_RSHIFT : >> 6
[u16 ...X -> +++X] SWS_OP_CONVERT : u16 -> f32
[f32 ...X -> ...X] SWS_OP_LINEAR : matrix3+off3 [...]
[f32 ...X -> ...X] SWS_OP_DITHER : 16x16 matrix + {0 3 2 5}
[f32 ...X -> ...X] SWS_OP_MAX : {0 0 0 0} <= x
+ [f32 ...X -> ...X] SWS_OP_MIN : x <= {255 255 255 _}
[f32 ...X -> +++X] SWS_OP_CONVERT : f32 -> u8
[ u8 ...X -> +++X] SWS_OP_WRITE : 3 elem(s) packed >> 0
(X = unused, + = exact, 0 = zero)
(This clamp is needed and was incorrectly optimized away before, because the
`SWS_OP_RSHIFT` incorrectly distorted the value range assertion)
This commit is contained in:
@@ -248,29 +248,8 @@ void ff_sws_op_list_update_comps(SwsOpList *ops)
|
||||
|
||||
switch (op->op) {
|
||||
case SWS_OP_READ:
|
||||
for (int i = 0; i < op->rw.elems; i++) {
|
||||
if (ff_sws_pixel_type_is_int(op->type)) {
|
||||
int bits = 8 * ff_sws_pixel_type_size(op->type) >> op->rw.frac;
|
||||
if (!op->rw.packed && ops->src.desc) {
|
||||
/* Use legal value range from pixdesc if available;
|
||||
* we don't need to do this for packed formats because
|
||||
* non-byte-aligned packed formats will necessarily go
|
||||
* through SWS_OP_UNPACK anyway */
|
||||
for (int c = 0; c < 4; c++) {
|
||||
if (ops->src.desc->comp[c].plane == i) {
|
||||
bits = ops->src.desc->comp[c].depth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
op->comps.flags[i] |= SWS_COMP_EXACT;
|
||||
op->comps.min[i] = av_max_q(Q(0), op->comps.min[i]);
|
||||
op->comps.max[i] = av_min_q(Q((1ULL << bits) - 1), op->comps.max[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Explicitly strip flags and min/max range data for unread comps */
|
||||
/* Active components are preserved from the user-provided value,
|
||||
* other components are explicitly stripped */
|
||||
for (int i = op->rw.elems; i < 4; i++) {
|
||||
op->comps.flags[i] = prev.flags[i];
|
||||
op->comps.min[i] = prev.min[i];
|
||||
|
||||
@@ -1 +1 @@
|
||||
6b2360c6fa99f5d0e428a97dfeff7189
|
||||
d781f3ddfeed4590eb253814366d2d01
|
||||
|
||||
Reference in New Issue
Block a user