c2p_core.h revision a5e7ae69e440f6816420fc99599f044e79e716b6
/*
* Fast C2P (Chunky-to-Planar) Conversion
*
* NOTES:
* - This code was inspired by Scout's C2P tutorial
* - It assumes to run on a big endian system
*
* Copyright © 2003-2008 Geert Uytterhoeven
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*
* Basic transpose step
*/
{
d[i1] ^= t;
}
static inline void c2p_unsupported(void) {
BUG_WARN(1);
}
{
switch (n) {
case 1:
return 0x55555555;
case 2:
return 0x33333333;
case 4:
return 0x0f0f0f0f;
case 8:
return 0x00ff00ff;
case 16:
return 0x0000ffff;
}
return 0;
}
/*
* Transpose operations on 8 32-bit words
*/
{
switch (m) {
case 1:
/* First n x 1 block */
/* Second n x 1 block */
/* Third n x 1 block */
/* Fourth n x 1 block */
return;
case 2:
/* First n x 2 block */
/* Second n x 2 block */
return;
case 4:
/* Single n x 4 block */
return;
}
}
/*
* Transpose operations on 4 32-bit words
*/
{
switch (m) {
case 1:
/* First n x 1 block */
/* Second n x 1 block */
return;
case 2:
/* Single n x 2 block */
return;
}
}
/*
* Transpose operations on 4 32-bit words (reverse order)
*/
{
switch (m) {
case 2:
/* Single n x 2 block */
return;
}
}
/*
* Transpose operations on 2 32-bit words
*/
{
/* Single n x 1 block */
return;
}
/*
* Transpose operations on 2 32-bit words (reverse order)
*/
{
/* Single n x 1 block */
return;
}