资源简介
公司用TI 的3630方案,camera输出是uyvy,但是qq HD视频需要的却是420的NV12(非标准,V在U前面),网上没找到合适的算法,自己学了一个。
代码片段和文件信息
#include
#include
#include
#include
#include
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;
typedef signed char int8_t;
typedef signed short int16_t;
#define WIDTH 320
#define HEIGHT 240
#define BUFFERSIZE HEIGHT*WIDTH*2
void createInYUV(int8_t *inyuv)
{
int ijval = 10;
for(i = 0; i < WIDTH;i++){
for(j = 0; j < HEIGHT; j++){
*inyuv++ = val++;
*inyuv++ = val++;
*inyuv++ = val++;
}
}
}
void YUVtoUYVY(uint8_t *inyuvuint8_t *outuyvy)
{
int ij;
for(i = 0; i < HEIGHT; i ++){
for(j = 0; j < WIDTH; j += 2){
*outuyvy++ = *(inyuv+1);
*outuyvy++ = *inyuv;
*outuyvy++ = *(inyuv+2);
*outuyvy++ = *(inyuv+3);
inyuv += 6;
评论
共有 条评论