📄 convert.c
字号:
/*
* Copyright 2003 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.
*
*/
#include <csl.h>
#include <csl_dat.h>
#include <csl_cache.h>
#include "mpeg2dma.h"
#define min(x,y) ((x)<(y))?(x):(y)
/* Input for this func will 4:2:2 data. This function
* will convert the data to 4:2:0 and will also reformat
* the data to be contiguous at MB level.
*/
void yuv422to420( char *frameIn[], char *frm_out[],
int width, int height)
{
char *pSrcY = frameIn[0];
char *pSrcU = frameIn[1];
char *pSrcV = frameIn[2];
char *pDestY = frm_out[0];
char *pDestU = frm_out[1];
char *pDestV = frm_out[2];
unsigned int qdma_countY, qdma_idxY, qdma_optY;
unsigned int qdma_countU, qdma_idxU, qdma_optU;
unsigned int qdma_countV, qdma_idxV, qdma_optV;
int rowindex;
int ch_width = width>>1;
int ch_height = height >>1;
/* ------------------------------------------------------------------- */
/* Luma Transfer */
/* ------------------------------------------------------------------- */
qdma_countY = EDMA_MK_CNT(width>>2,0);
qdma_idxY = EDMA_MK_IDX(0, 0);
qdma_optY = EDMA_MK_OPT(EDMA_OPT_FS_NO,
EDMA_OPT_LINK_NO,
EDMA_OPT_TCC_OF(CHANNEL12),
EDMA_OPT_TCINT_YES,
EDMA_OPT_DUM_INC,
EDMA_OPT_2DD_NO,
EDMA_OPT_SUM_INC,
EDMA_OPT_2DS_NO,
EDMA_OPT_ESIZE_32BIT,
EDMA_OPT_PRI_LOW) | TCCM(CHANNEL12);
qdma_countU = EDMA_MK_CNT(ch_width>>2,0);
qdma_idxU = EDMA_MK_IDX(0, 0);
qdma_optU = EDMA_MK_OPT(EDMA_OPT_FS_NO,
EDMA_OPT_LINK_NO,
EDMA_OPT_TCC_OF(CHANNEL13),
EDMA_OPT_TCINT_YES,
EDMA_OPT_DUM_INC,
EDMA_OPT_2DD_NO,
EDMA_OPT_SUM_INC,
EDMA_OPT_2DS_NO,
EDMA_OPT_ESIZE_32BIT,
EDMA_OPT_PRI_LOW) | TCCM(CHANNEL13);
qdma_countV = EDMA_MK_CNT(ch_width>>2,0);
qdma_idxV = EDMA_MK_IDX(0, 0);
qdma_optV = EDMA_MK_OPT(EDMA_OPT_FS_NO,
EDMA_OPT_LINK_NO,
EDMA_OPT_TCC_OF(CHANNEL14),
EDMA_OPT_TCINT_YES,
EDMA_OPT_DUM_INC,
EDMA_OPT_2DD_NO,
EDMA_OPT_SUM_INC,
EDMA_OPT_2DS_NO,
EDMA_OPT_ESIZE_32BIT,
EDMA_OPT_PRI_LOW) | TCCM(CHANNEL14);
for( rowindex = 0; rowindex < ch_height;rowindex++)
{
QDMA_START(qdma_optY, pSrcY, qdma_countY, pDestY, qdma_idxY);
pSrcY += width;
pDestY += width;
QDMA_START(qdma_optY, pSrcY, qdma_countY, pDestY, qdma_idxY);
pSrcY += width;
pDestY += width;
QDMA_START(qdma_optU, pSrcU, qdma_countU, pDestU, qdma_idxU);
QDMA_START(qdma_optV, pSrcV, qdma_countV, pDestV, qdma_idxV);
pDestU += ch_width;
pDestV += ch_width;
pSrcU += 2*ch_width;
pSrcV += 2*ch_width;
QDMA_WAIT_HIGH(CHANNEL13);
QDMA_WAIT_HIGH(CHANNEL14);
}
QDMA_WAIT_HIGH(CHANNEL12);
return ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -