////////////////////////////////////////////////////////////////////////////
//
//
// Project : VideoNet version 1.1.
// Description : Peer to Peer Video Conferencing over the LAN.
// Author : Nagareshwar Y Talekar ( nsry2002@yahoo.co.in)
// Date : 15-6-2004.
//
// This is the modified version of tmndecode (H.263 decoder)
// written by Karl & Robert.It was in ANSI C. I have converted into C++
// so that it can be integrated into any windows application. I have
// removed some of the files which had display and file storing
// functions.I have removed the unnecessary code and also added some
// new files..
// Original library dealt with files. Input & Output , both were files.
// I have done some major changes so that it can be used for real time
// decoding process. Now one can use this library for decoding H263 frames.
//
//
// File description :
// Name : GetPic.cpp
//
/////////////////////////////////////////////////////////////////////////////
/************************************************************************
*
* getpic.c, picture decoding for tmndecode (H.263 decoder)
* Copyright (C) 1996 Telenor R&D, Norway
* Karl Olav Lillevold <Karl.Lillevold@nta.no>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Karl Olav Lillevold <Karl.Lillevold@nta.no>
* Telenor Research and Development
* P.O.Box 83 tel.: +47 63 84 84 00
* N-2007 Kjeller, Norway fax.: +47 63 81 00 76
*
* Robert Danielsen e-mail: Robert.Danielsen@nta.no
* Telenor Research and Development www: http://www.nta.no/brukere/DVC/
* P.O.Box 83 tel.: +47 63 84 84 00
* N-2007 Kjeller, Norway fax.: +47 63 81 00 76
*
************************************************************************/
/*
* modified by Wayne Ellis BT Labs to run Annex E Arithmetic Decoding
* <ellis_w_wayne@bt-web.bt.co.uk>
*
* based on mpeg2decode, (C) 1994, MPEG Software Simulation Group
* and mpeg2play, (C) 1994 Stefan Eckart
* <stefan@lis.e-technik.tu-muenchen.de>
*/
#include "GetPic.h"
/* decode one frame or field picture */
void getpicture(int *framenum)
{
int i;
unsigned char *tmp;
for (i=0; i<3; i++) {
tmp = oldrefframe[i];
oldrefframe[i] = refframe[i];
refframe[i] = tmp;
newframe[i] = refframe[i];
}
if (mv_outside_frame && *framenum > 0) {
make_edge_image(oldrefframe[0],edgeframe[0],coded_picture_width,
coded_picture_height,32);
make_edge_image(oldrefframe[1],edgeframe[1],chrom_width, chrom_height,16);
make_edge_image(oldrefframe[2],edgeframe[2],chrom_width, chrom_height,16);
}
getMBs(*framenum);
if (pb_frame) {
if (expand && outtype == T_X11) {
interpolate_image(bframe[0], exnewframe[0],
coded_picture_width, coded_picture_height);
interpolate_image(bframe[1], exnewframe[1], chrom_width, chrom_height);
interpolate_image(bframe[2], exnewframe[2], chrom_width, chrom_height);
storeframe(exnewframe, *framenum);
}
else
storeframe(bframe,*framenum);
*framenum += pb_frame;
}
if (expand && outtype == T_X11) {
interpolate_image(newframe[0], exnewframe[0],
coded_picture_width, coded_picture_height);
interpolate_image(newframe[1], exnewframe[1], chrom_width, chrom_height);
interpolate_image(newframe[2], exnewframe[2], chrom_width, chrom_height);
storeframe(exnewframe, *framenum);
}
else
storeframe(newframe,*framenum);
}
/**
* Store the pointer to Y, U , V frames...
*
*/
void storeframe(unsigned char *src[],int frame)
{
yp=src[0]; // Y component
up=src[1]; // U component
vp=src[2]; // V component
}
/* decode all macroblocks of the current picture */
static void getMBs(int framenum)
{
int comp;
int MBA, MBAmax;
int bx, by;
int COD=0,MCBPC, CBPY, CBP=0, CBPB=0, MODB=0, Mode=0, DQUANT;
int COD_index, CBPY_index, MODB_index, DQUANT_index, MCBPC_index;
int INTRADC_index, YCBPB_index, UVCBPB_index, mvdbx_index, mvdby_index;
int mvx, mvy, mvy_index, mvx_index, pmv0, pmv1, xpos, ypos, gob, i,k;
int mvdbx=0, mvdby=0, pmvdbx, pmvdby, gfid, YCBPB, UVCBPB, gobheader_read;
int startmv,stopmv,offset,bsize,last_done=0,pCBP=0,pCBPB=0,pCOD=0;
int DQ_tab[4] = {-1,-2,1,2};
short *bp;
/* number of macroblocks per picture */
MBAmax = mb_width*mb_height;
MBA = 0; /* macroblock address */
newgob = 0;
/* mark MV's above the picture */
for (i = 1; i < mb_width+1; i++) {
for (k = 0; k < 5; k++) {
MV[0][k][0][i] = NO_VEC;
MV[1][k][0][i] = NO_VEC;
}
modemap[0][i] = MODE_INTRA;
}
/* zero MV's on the sides of the picture */
for (i = 0; i < mb_height+1; i++) {
for (k = 0; k < 5; k++) {
MV[0][k][i][0] = 0;
MV[1][k][i][0] = 0;
MV[0][k][i][mb_width+1] = 0;
MV[1][k][i][mb_width+1] = 0;
}
modemap[i][0] = MODE_INTRA;
modemap[i][mb_width+1] = MODE_INTRA;
}
fault = 0;
gobheader_read = 0;
for (;;) {
//if (trace)
// printf("frame %d, MB %d\n",framenum,MBA);
resync:
/* This version of the decoder does not resync on every possible
error, and it does not do all possible error checks. It is not
difficult to make it much more error robust, but I do not think
it is necessary to include this in the freely available
version. */
if (fault) {
if(trace)
fputs("Warning: A Fault Condition Has Occurred - Resyncing \n",dlog);
startcode(); /* sync on new startcode */
fault = 0;
}
if (!(showbits(22)>>6)) { /* startcode */
startcode();
/* in case of byte aligned start code, ie. PSTUF, GSTUF or ESTUF
is used */
if (showbits(22) == (32|SE_CODE)) { /* end of sequence */
if (!(syntax_arith_coding && MBA < MBAmax)) {
return;
}
}
else if ((showbits(22) == PSC<<5) ) { /* new picture */
if (!(syntax_arith_coding && MBA < MBAmax)) {
return;
}
}
else {
if (!(syntax_arith_coding && MBA%mb_width)) {
if (syntax_arith_coding) { /* SAC hack to finish GOBs which */
gob = (showbits(22) & 31); /* end with MBs coded with no bits */
if (gob * mb_width != MBA)
goto finish_gob;
}
gob = getheader() - 1;
if (gob > mb_height) {
if (!quiet)
fputs("GN out of range\n",dlog);
return;
}
/* GFID is not allowed to change unless PTYPE in picture header
changes */
gfid = getbits(2);
/* NB: in error-prone environments the decoder can use this
value to determine whether a picture header where the PTYPE
has changed, has been lost */
quant = getbits(5);
//if (trace)
// printf("GQUANT: %d\n", quant);
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于RTP的H263视频传输测试例子 (127个子文件)
GetPic.cpp 32KB
coder.cpp 31KB
dct.cpp 23KB
Recon.cpp 22KB
countbit.cpp 18KB
Sactbls.cpp 12KB
mot_est.cpp 12KB
pred.cpp 12KB
GetVlc.cpp 11KB
GetBlk.cpp 10KB
Tmndec.cpp 9KB
libr263.cpp 8KB
DGlobal.cpp 8KB
Sac.cpp 7KB
Idct.cpp 7KB
huffman.cpp 6KB
GetBits.cpp 6KB
YuvToRgb.cpp 5KB
GetHdr.cpp 5KB
convert.cpp 5KB
videoTrans_test.cpp 5KB
stream.cpp 4KB
Idctref.cpp 4KB
Indices.cpp 4KB
rlib.cpp 3KB
quant.cpp 3KB
main.cpp 2KB
Global.cpp 1KB
rtpsession.h 26KB
rtpsourcedata.h 20KB
rtpsources.h 17KB
rtcpcompoundpacketbuilder.h 12KB
rtcppacketbuilder.h 11KB
rtptransmitter.h 11KB
rtpudpv6transmitter.h 11KB
rtperrors.h 11KB
rtpsessionparams.h 11KB
rtpudpv4transmitter.h 11KB
rtcpsdespacket.h 11KB
rtppacketbuilder.h 10KB
rtpexternaltransmitter.h 9KB
rtpkeyhashtable.h 9KB
rtphashtable.h 8KB
rtptimeutilities.h 8KB
rtcpsdesinfo.h 8KB
rtcpsrpacket.h 8KB
rtpmemorymanager.h 7KB
rtppacket.h 7KB
rtcpscheduler.h 7KB
rtcprrpacket.h 6KB
config.h 6KB
struct.h 5KB
def.h 5KB
rtpinternalsourcedata.h 5KB
rtprawpacket.h 4KB
rtpipv6address.h 4KB
rtcpcompoundpacket.h 4KB
rtpipv4address.h 4KB
Tmndec.h 4KB
rtcpbyepacket.h 4KB
rtpbyteaddress.h 4KB
ctables.h 4KB
DGlobal.h 4KB
rtcpapppacket.h 4KB
rtpipv4destination.h 3KB
rtpaddress.h 3KB
rtpipv6destination.h 3KB
rtpsessionsources.h 3KB
rtpcollisionlist.h 3KB
rtpdefines.h 3KB
rtcppacket.h 3KB
rtpstructs.h 3KB
rtcpunknownpacket.h 3KB
decdef.h 3KB
Recon.h 3KB
rtplibraryversion.h 2KB
rtpmemoryobject.h 2KB
jthread.h 2KB
rtprandom.h 2KB
libr263.h 2KB
GetPic.h 2KB
jmutex.h 2KB
rtprandomrand48.h 2KB
rtppollthread.h 2KB
rtpconfig.h 2KB
Sactbls.h 2KB
rtprandomurandom.h 2KB
rtprandomrands.h 2KB
rlib.h 2KB
Idct.h 2KB
rtpheader.h 2KB
rtpdebug.h 2KB
coder.h 2KB
rtptypes_win.h 2KB
Global.h 2KB
Indices.h 2KB
pred.h 2KB
countbit.h 2KB
GetBlk.h 2KB
GetVlc.h 2KB
共 127 条
- 1
- 2
ljbsdu
- 粉丝: 204
- 资源: 150
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
前往页