Skip to content

Commit 3188549

Browse files
committed
utils: also align alpha planes up to full byte size
I'm not entirely sure why this was originally disabled - the comment justifies itself by claiming that the alpha plane does not respect pl_bit_encoding, but the alpha plane is just a normal plane that is sampled like any other plane, via the same pl_sample_src mechanism (which includes the bits scaling). I think this may have been a legacy all the way from mpv, where bit encoding was handled as part of the 3x3 YUV decoding matrix, but we basically stopped doing that for the majority of inputs a long time ago. Actually, maybe we should just kill pl_bit_encoding being part of pl_color_repr altogether at this point.
1 parent 538c78d commit 3188549

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

src/include/libplacebo/utils/libav_internal.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -527,14 +527,6 @@ PL_LIBAV_API int pl_plane_data_from_pixfmt(struct pl_plane_data out_data[4],
527527
first = true;
528528
for (int p = 0; p < planes; p++) {
529529
aligned_data[p] = out_data[p];
530-
531-
// Planes with only an alpha component should be ignored
532-
if (pl_plane_data_num_comps(&aligned_data[p]) == 1 &&
533-
aligned_data[p].component_map[0] == PL_CHANNEL_A)
534-
{
535-
continue;
536-
}
537-
538530
if (!pl_plane_data_align(&aligned_data[p], &bits))
539531
goto misaligned;
540532

src/utils/upload.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,6 @@ bool pl_plane_data_align(struct pl_plane_data *data, struct pl_bit_encoding *out
113113
if (!aligned.component_size[i])
114114
break;
115115

116-
// Can't meaningfully align alpha channel, so just skip it. This is a
117-
// limitation of the fact that `pl_bit_encoding` only applies to the
118-
// main color channels, and changing this would be very nontrivial.
119-
if (aligned.component_map[i] == PL_CHANNEL_A)
120-
continue;
121-
122116
// Color depth is the original component size, before alignment
123117
SET_TEST(bits.color_depth, aligned.component_size[i]);
124118

0 commit comments

Comments
 (0)