コード例 #1
0
static int decore_init(int hor_size, int ver_size, unsigned long color_depth)
{
	// init global stuff
	ld = &base;
	coeff_pred = &ac_dc;
	
	initbits ();
	
	// read first vol and vop
	mp4_hdr.width = hor_size;
	mp4_hdr.height = ver_size;
	
	mp4_hdr.quant_precision = 5;
	mp4_hdr.bits_per_pixel = 8;
	
	mp4_hdr.quant_type = 0;
	
	mp4_hdr.time_increment_resolution = 15;
	mp4_hdr.complexity_estimation_disable = 1;
	
	mp4_hdr.picnum = 0;
	mp4_hdr.mb_xsize = mp4_hdr.width / 16;
	mp4_hdr.mb_ysize = mp4_hdr.height / 16;
	mp4_hdr.mba_size = mp4_hdr.mb_xsize * mp4_hdr.mb_ysize;

	// set picture dimension global vars
	{
		horizontal_size = mp4_hdr.width;
		vertical_size = mp4_hdr.height;

		mb_width = horizontal_size / 16;
		mb_height = vertical_size / 16;

		coded_picture_width = horizontal_size + 64;
		coded_picture_height = vertical_size + 64;
		chrom_width = coded_picture_width >> 1;
		chrom_height = coded_picture_height >> 1;
	}

	// init decoder
	initdecoder();

	switch (color_depth)
		{
		case 32:
			convert_yuv = yuv2rgb_32;
			break;
		case 16:
			convert_yuv = yuv2rgb_16;
			break;
		default:
			convert_yuv = yuv2rgb_24;
			break;
		}

	return 1;
}
コード例 #2
0
ファイル: Tmndec.cpp プロジェクト: AnthonyNystrom/MobiVU
int DecompressFrame(unsigned char *cdata,int size,unsigned char **outdata,int outsize)
{
static int first=1,framenum=0;
		
		//Initialize output pointers...
		yp=NULL;
		up=NULL;
		vp=NULL;

		// Copy to other buffer can be done...
		// So that source buffer will be free
		 
		cindex=0;       // index into the cframe....
		csize=size;     // size of compressed frame 
		cframe=cdata;   // pointer to compressed frme
		//memcpy(cframe,cdata,size);


		// Reset the pointers...
		initbits();

		// Get the frame header
		getheader();

	
		// If first time...then call initdecoder....
		// This has to be done after calling getheader()
		// because getheader() setup some variables using the information
		// from header...

		if (first) 
		{
		   initdecoder();
		   first = 0;
		}

    

		// Decompress the frame and get the picture frame in YUV format
		getpicture(&framenum);
    
		framenum++;

		if(yp==NULL || up==NULL || vp==NULL)
		{
			myLog.WriteLog((char*)"DecompressFrame",(char*)"decompression failed...");
			return  0;
		}
		*outdata = yp;
/*
        if(yp!=NULL && up!=NULL && vp!=NULL){
			FILE *fpyuv;
			if (framenum==1)
				fpyuv=fopen("/sdcard/video2.yuv","wb");
			else
				fpyuv=fopen("/sdcard/video2.yuv","ab");
			if (fpyuv!=NULL){
				char sMsgLog[128];
				int iUVSize = (horizontal_size/2) * (vertical_size/2);
				fwrite(yp,1,horizontal_size * vertical_size+(iUVSize*2), fpyuv);
				fclose(fpyuv);
			}
		}*/
		return 1;
	


   		// convert YUV to RGB
		// *******  TODO *********
		// check if outdata is enough to store rgb data
		//
		int totalsize=horizontal_size * vertical_size *4;
		if(outsize< totalsize || outdata==NULL)
		{
			myLog.WriteLog((char*)"DecompressFrame",(char*)"Output buffer is not sufficient");
			return 0;			
		}
		
//		ConvertYUVtoRGB32(yp,up,vp,outdata,horizontal_size,vertical_size);
		/*FILE *fpyuv;
		char sFileName[128];
		sprintf(sFileName, "/sdcard/video_%d.rgba", framenum);		
		fpyuv=fopen(sFileName,"wb");
		
		if (fpyuv!=NULL){
			fwrite(outdata,1,horizontal_size * vertical_size*4, fpyuv);
			fclose(fpyuv);
		}*/
		
		//myLog.WriteLog((char*)"DecompressFrame()",(char*)"Decode SUCCESSFUL :-)");
 
return 1;
コード例 #3
0
ファイル: Tmndec.cpp プロジェクト: Yegz/Removte_Video
int DecompressFrame(unsigned char *cdata,int size,unsigned char *outdata,int outsize)
{
static int first=1,framenum=0;
		
		//Initialize output pointers...
		yp=NULL;
		up=NULL;
		vp=NULL;

		// Copy to other buffer can be done...
		// So that source buffer will be free
		 
		cindex=0;       // index into the cframe....
		csize=size;     // size of compressed frame 
		cframe=cdata;   // pointer to compressed frme
		//memcpy(cframe,cdata,size);


		// Reset the pointers...
		initbits();

		// Get the frame header
		getheader();

	
		// If first time...then call initdecoder....
		// This has to be done after calling getheader()
		// because getheader() setup some variables using the information
		// from header...

		if (first) 
		{
		   initdecoder();
		   first = 0;
		}

    

		// Decompress the frame and get the picture frame in YUV format
		getpicture(&framenum);
    
		framenum++;

		if(yp==NULL || up==NULL || vp==NULL)
		{
			if(trace)
			fputs("decompression failed...",dlog);
		
			return  0;
		}


   		// convert YUV to RGB
		// *******  TODO *********
		// check if outdata is enough to store rgb data
		//
		int totalsize=horizontal_size * vertical_size *3;
		if(outsize< totalsize || outdata==NULL)
		{
			if(dlog)
			fputs("Output buffer is not sufficient",dlog);
		return 0;			
		}

		ConvertYUV2RGB(yp,up,vp,outdata,horizontal_size,vertical_size);
 
return 1;
}