How to unpack the frame buffer when packing by Compact YCoCg Frame Buffer?
You can download a demo with source code from the paper website which includes code on how to unpack the buffer.
The most simple method is to sample the current pixel to get the luminance (Y) and one of the chroma values, and then sample one of the neighbour pixels to get the other chrome value:
uint2 coord_neighbour = coord;
coord_neighbour.x += 1;
float4 sample0 = texture0.Load(uint3(coord, 0));
float4 sample1 = texture0.Load(uint3(coord_neighbour, 0));
float y = sample0.r;
float co = sample0.g;
float cg = sample1.g;
// switch which chroma value is Co/Cg based on pixel position
if((coord.x & 1) == (coord.y & 1))
{
co = sample1.g;
cg = sample0.g;
}
float3 col = YCoCg2RGB(y, co, cg);
You'll probably want to use one of the more complex reconstruction methods from the paper (check the source code) but this gives you the basic idea.
Thanks you
6 minutes ago, Aqua Costa said:You can download a demo with source code from the paper website which includes code on how to unpack the buffer.
The most simple method is to sample the current pixel to get the luminance (Y) and one of the chroma values, and then sample one of the neighbour pixels to get the other chrome value:
uint2 coord_neighbour = coord; coord_neighbour.x += 1; float4 sample0 = texture0.Load(uint3(coord, 0)); float4 sample1 = texture0.Load(uint3(coord_neighbour, 0)); float y = sample0.r; float co = sample0.g; float cg = sample1.g; // switch which chroma value is Co/Cg based on pixel position if((coord.x & 1) == (coord.y & 1)) { co = sample1.g; cg = sample0.g; } float3 col = YCoCg2RGB(y, co, cg);
You'll probably want to use one of the more complex reconstruction methods from the paper (check the source code) but this gives you the basic idea.