mirror of
https://github.com/mpv-player/mpv
synced 2024-12-29 10:32:15 +00:00
zimg: support 3 component 16 bit pixel unpacking
Works for RGB (e.g. rgb48le) and XYZ. It's unsure whether XYZ is really correctly converted.
This commit is contained in:
parent
577c00510b
commit
f23e663a21
22
video/zimg.c
22
video/zimg.c
@ -253,6 +253,17 @@ static void xccc8_pack(void *dst, void *src[], int x0, int x1)
|
||||
}
|
||||
}
|
||||
|
||||
// 3 16 bit color components written to 3 planes.
|
||||
static void ccc16_unpack(void *src, void *dst[], int x0, int x1)
|
||||
{
|
||||
uint16_t *r = src;
|
||||
for (int x = x0; x < x1; x++) {
|
||||
((uint16_t *)dst[0])[x] = *r++;
|
||||
((uint16_t *)dst[1])[x] = *r++;
|
||||
((uint16_t *)dst[2])[x] = *r++;
|
||||
}
|
||||
}
|
||||
|
||||
static int packed_repack(void *user, unsigned i, unsigned x0, unsigned x1)
|
||||
{
|
||||
struct mp_zimg_repack *r = user;
|
||||
@ -357,6 +368,17 @@ static void setup_regular_rgb_packer(struct mp_zimg_repack *r)
|
||||
r->components[n] = corder[p->components[first + n]];
|
||||
return;
|
||||
}
|
||||
|
||||
if (desc.component_size == 2 && p->num_components == 3) {
|
||||
if (r->pack) // no packer yet
|
||||
return;
|
||||
r->repack = packed_repack;
|
||||
r->packed_repack_scanline = ccc16_unpack;
|
||||
r->zimgfmt = planar_fmt;
|
||||
for (int n = 0; n < 3; n++)
|
||||
r->components[n] = corder[p->components[n]];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// (ctx can be NULL for the sake of probing.)
|
||||
|
Loading…
Reference in New Issue
Block a user