コード例 #1
0
ファイル: mpeg_decode.c プロジェクト: BigHNF/tcpmp-revive
static int UpdateInput( mpeg_decode* dec )
{
	int Result = ERR_NONE;

	IDCT_BLOCK_PREPARE(dec,dec->blockptr);
	dec->mb_xsize = 0; 
	dec->mb_ysize = 0;
	dec->pos_end = 0;
	dec->refframe = 0;
	dec->Frame = 0;
	dec->ValidSeq = 0;
	dec->ErrorShowed = 0;
	dec->OnlyIVOP = 1;
	memcpy(dec->zigzag,zigzag,sizeof(zigzag));

	if (dec->Codec.In.Format.Type == PACKET_VIDEO)
		Result = CodecIDCTSetFormat(&dec->Codec,PF_YUV420,dec->Codec.In.Format.Format.Video.Width,dec->Codec.In.Format.Format.Video.Height,
									 		              dec->Codec.In.Format.Format.Video.Width,dec->Codec.In.Format.Format.Video.Height,
														  dec->Codec.In.Format.Format.Video.Aspect);
	return Result;
}
コード例 #2
0
ファイル: mpeg_decode.c プロジェクト: BigHNF/tcpmp-revive
static void Picture( mpeg_decode* dec )
{
	static const int16_t aspect[16] = 
	{
		    0,10000, 6735, 7031,
		 7615, 8055, 8437, 8935,
		 9157, 9815,10255,10695,
		10950,11575,12015,    0,
	};

	if (!dec->Codec.In.Format.Format.Video.Aspect && aspect[dec->aspect])
		dec->Codec.In.Format.Format.Video.Aspect = Scale(ASPECT_ONE,10000,aspect[dec->aspect]);

	CodecIDCTSetFormat(&dec->Codec,PF_YUV420,dec->width,dec->height,dec->width,dec->height,dec->Codec.In.Format.Format.Video.Aspect);

    flushbits(dec,10); // temporal ref

    loadbits(dec);
	dec->prediction_type = getbits(dec,3);

    flushbits(dec,16); // non constant bit rate

	loadbits(dec);
    if (dec->prediction_type == P_VOP || dec->prediction_type == B_VOP)
	{
        dec->full_pixel[0] = getbits(dec,1);
        dec->fcode[0] = getbits(dec,3)-1;
    }

    if (dec->prediction_type == B_VOP) 
	{
        dec->full_pixel[1] = getbits(dec,1);
        dec->fcode[1] = getbits(dec,3)-1;
    }

    dec->frame_state = 1;

	DEBUG_MSG1(DEBUG_VCODEC,T("MPEG Picture:%d"),dec->prediction_type);
}
コード例 #3
0
ファイル: h263_header.c プロジェクト: Jsoucek/q3ce
int gethdr_h263( mp4_decode *dec )
{
	int code;

	bytealign(dec);
	loadbits(dec);

    code = getbits(dec,22-8);
	while (!eofbits(dec))
	{
		loadbits(dec);
		code = ((code << 8) + getbits(dec,8)) & 0x3FFFFF;
		if (code == 32)
			break;
	}

	if (code != 32)
		return 0;

    flushbits(dec,8); // picture timestamp

	loadbits(dec);
	if (!getbits1(dec)) // marker
		return 0;
	if (getbits1(dec)) // h263 id
		return 0;

	flushbits(dec,3);

	code = getbits(dec,3); // format

	if (code == 6 || code == 7)
	{
		if (dec->showerror)
		{
			dec->showerror = 0;
			ShowError(dec->Codec.Node.Class,MPEG4_ID,MPEG4_ERROR_H263);
		}
		//todo: finish
		return 0;
	}
	else
	{
		static const int size[8][2] = {
			{ 0,0 },
			{ 128,96 },
			{ 176,144 },
			{ 352,288 },
			{ 704,576 },
			{ 1408,1152 }};

		int width = size[code][0];
        int height = size[code][1];
		if (!dec->ignoresize && (!width || CodecIDCTSetFormat(&dec->Codec,PF_YUV420,
			dec->Codec.In.Format.Video.Width,dec->Codec.In.Format.Video.Height,width,height) != ERR_NONE))
		{
			dec->validvol = 0;
			return 0;
		}
       
		loadbits(dec);
        dec->prediction_type = getbits(dec,1);
		dec->long_vectors = (char)getbits(dec,1);

		if (getbits1(dec)) // sac not supported
			return 0;

		getbits(dec,1); // obmc
        
		if (getbits1(dec)) // pb frame not supported
			return 0;

		dec->quantizer = getbits(dec,5);
		flushbits(dec,1);

		dec->rounding = 0;
	}

    while (getbits1(dec)) // pei
	{
        flushbits(dec,8);
		loadbits(dec);
    }

	dec->fcode_for = 1;
	dec->validvol = 1;
	dec->Codec.IDCT.Ptr->Set(dec->Codec.IDCT.Ptr,IDCT_ROUNDING,&dec->rounding,sizeof(bool_t));
	return 1;
}