📄 rotate_ti_apply.c
字号:
/*
* Copyright 2002 by Texas Instruments Incorporated.
* All rights reserved. Property of Texas Instruments Incorporated.
* Restricted rights to use, duplicate or disclose this code are
* granted through contract.
*
*/
/* "@(#) RF5_IEK 2.00.02 12-11-02 (swat-c19)" */
/*
* ======== rotate_ti_apply.c ========
* Implementation of the color rotate operation.
*/
#pragma CODE_SECTION(ROTATE_TI_apply, ".text:apply")
#include <std.h>
#include "irotate.h"
#include "rotate_ti.h"
#include "rotate_ti_priv.h"
/*
* ======== ROTATE_TI_apply ========
* Function that rotates cr, cb color plane.
*/
Void ROTATE_TI_apply(IROTATE_Handle handle, unsigned char y[],
unsigned char cr[], unsigned char cb[],
Int lumaSize, Int chromaSize, Short cosine, Short sine)
{
ROTATE_TI_Obj *rotate = (ROTATE_TI_Obj *)handle;
Int i;
Short crTemp;
Short cbTemp;
Int crInt;
Int cbInt;
Short crFin;
Short cbFin;
/* Reverse the image's luma if requested. */
if (rotate->reverseImage == TRUE) {
for(i = 0; i < lumaSize; i++) {
y[i] = 255 - y[i];
}
}
for(i = 0; i < chromaSize; i++)
{
/* Center pixels around 0, by deducting 128 from both cr and cb. */
crTemp = cr[i] - 128;
cbTemp = cb[i] - 128;
/* Rotate cr and cb by multiplying using cosine and sine */
crInt = (crTemp * cosine) - (cbTemp * sine);
cbInt = (crTemp * sine) + (cbTemp * cosine);
/*
* Convert Q15 number and add 128 back to center chroma
* values around 128.
*/
crFin = (crInt >> 15) + 128;
cbFin = (cbInt >> 15) + 128;
/* Limit values to the range of 0-255 */
cr[i] = crFin & 0xFF;
cb[i] = cbFin & 0xFF;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -