📄 shuffle.c
字号:
/*
* Copyright (c) 2000 TriMedia Technologies Inc.
*
* +------------------------------------------------------------------+
* | This software is furnished under a license and may only be used |
* | and copied in accordance with the terms and conditions of such |
* | a license and with the inclusion of this copyright notice. This |
* | software or any other copies of this software may not be provided|
* | or otherwise made available to any other person. The ownership |
* | and title of this software is not transferred. |
* | |
* | The information in this software is subject to change without |
* | any prior notice and should not be construed as a commitment by |
* | TriMedia Technologies. |
* | |
* | this code and information is provided "as is" without any |
* | warranty of any kind, either expressed or implied, including but |
* | not limited to the implied warranties of merchantability and/or |
* | fitness for any particular purpose. |
* +------------------------------------------------------------------+
*
* Module name : shuffle.c 1.0
*
* Last update : 14:26:51 - 2000/04/26
*
* Description :
*
* Program to convert from old to new IDCT format
* old format - IDCT input is transposed and shuffled
* new format - IDCT input is normal order
*
*/
#include <stdlib.h>
#include <stdio.h>
void fastshuffle(short *, short *);
short data[64] ;
short result[64];
main(int argc, char **argv)
{
int i, j, dataword;
for (i=0; i<8; i++) {
for (j=0; j<8; j++) {
scanf("%d", &dataword);
data[8*i+j] = dataword ;
}
}
fastshuffle(data, result);
for (i=0; i<8; i++) {
for (j=0; j<8; j++)
printf("%6d ", result[8*i+j]);
printf("\n");
}
exit(EXIT_SUCCESS);
}
const int I_j[] = {0, 2, 4, 6, 1, 3, 5, 7};
void fastshuffle(short *block, short *swap)
{
int i, j;
/* transpose input block with shuffling and scaling up by factor 8 */
/* for accomodating funny Trimedia format for input of IDCT */
for (j = 0; j < 8; j++)
{
for (i = 0; i < 8; i++)
{
swap[(i << 3) | I_j[j]] = *block++ ;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -