⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vtc_shape_shapeenhdecode.cpp

📁 完整的RTP RTSP代码库
💻 CPP
📖 第 1 页 / 共 3 页
字号:
65537, 65537, 65537, 65537, 65537, 65537, 65537, 65537,45333, 28672, 21363, 26870, 41125, 9455, 25752, 12372,65537, 65537, 65537, 65537, 65537, 65537, 65537, 65537,46324, 37071, 4994, 5136, 18879, 28687, 9330, 366,65537, 65537, 65537, 65537, 65537, 65537, 65537, 65537,31745, 26116, 346, 397, 2900, 13830, 361, 8};static UInt prob_even0[256]={65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,25542, 38525, 48333, 53517, 26541, 23214, 61559, 59853,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,7151, 31006, 33480, 29879, 2609, 4142, 16384, 11884,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,44817, 65535, 56097, 64984, 40735, 47710, 43386, 52046,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,17545, 29626, 37308, 42263, 4196, 13552, 7199, 7230,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,1, 1, 1, 39322, 13578, 17416, 29218, 31831,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,1311, 65535, 32768, 7282, 1, 3048, 25206, 19935,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,1, 32768, 17873, 61861, 3417, 14895, 4541, 5293,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,4819, 32768, 39950, 43523, 1148, 4021, 12072, 5436,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,1, 1, 134, 1, 1, 55, 5461, 2849,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,24, 5243, 590, 1079, 86, 95, 14564, 7159,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,328, 1, 2564, 14919, 21845, 1, 9362, 15880,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,43, 362, 150, 1179, 752, 529, 683, 331,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,1, 1, 700, 862, 25, 24, 1317, 558,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,1, 1, 1, 172, 2, 4, 793, 342,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,572, 1, 1928, 43080, 3337, 1680, 1401, 2131,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,18, 1, 366, 7456, 8, 18, 40, 8};static UInt prob_even1[256]={65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,0, 0, 0, 0, 0, 0, 0, 0,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,0, 0, 0, 0, 0, 0, 0, 0,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,0, 0, 0, 0, 0, 0, 0, 0,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,0, 0, 0, 0, 0, 0, 0, 0,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,0, 0, 0, 0, 0, 0, 0, 0,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,0, 0, 0, 0, 0, 0, 0, 0,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,0, 0, 0, 0, 0, 0, 0, 0,65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536,0, 0, 0, 0, 0, 0, 0, 0,65537, 65537, 65537, 65537, 65537, 65537, 65537, 65537,54018, 8704, 1, 903, 61648, 31196, 327, 575,65537, 65537, 65537, 65537, 65537, 65537, 65537, 65537,64400, 36956, 1673, 9758, 52289, 4361, 659, 1433,65537, 65537, 65537, 65537, 65537, 65537, 65537, 65537,56482, 65535, 1, 1, 11905, 3034, 1, 1,65537, 65537, 65537, 65537, 65537, 65537, 65537, 65537,61103, 56650, 925, 8814, 11845, 2075, 828, 223,65537, 65537, 65537, 65537, 65537, 65537, 65537, 65537,4161, 1, 494, 5041, 52508, 32195, 11005, 2463,65537, 65537, 65537, 65537, 65537, 65537, 65537, 65537,63286, 32768, 39133, 49486, 53351, 8541, 37603, 15011,65537, 65537, 65537, 65537, 65537, 65537, 65537, 65537,18805, 13107, 1039, 1214, 5060, 21845, 3830, 387,65537, 65537, 65537, 65537, 65537, 65537, 65537, 65537,31654, 32951, 490, 1496, 2535, 11699, 328, 13};#define Error -1/***********************************************************HeaderBegin******* * * File:        sisc_decode.c * * Author:      Samsung AIT (SAIT) * Created:     23-Apr-98 * * Description: Scalable shape coder using scan interleaving (sisc fac version) * * Copyright (C) 1996 Samsung AIT All Rights Reserved.                 * ***********************************************************HeaderEnd*********/Int CVTCDecoder::ShapeEnhDeCoding(UChar *LowShape,		/* in: shape mask in the lower layer */                        UChar *HalfShape,	/* out: shape mask in the current layer */                        UChar *CurShape,	/* out: shape mask in the current layer */                        Int object_width,                        Int object_height,			FILTER *filter){    Int i, j, k, l, p, q, x, y, x2, y2;    Int bab_type, ret;    Int width2		= object_width,	height2		= object_height,	width		= width2 >> 1,	height		= height2 >> 1;    Int NB = (object_width >= 1024 || object_height >=1024)? 6:      (object_width >=512|| object_height >=512)?5:4;    Int mborder		= MBORDER,    	mblks           = NB,	mbsize          = 1<<mblks,		/* bab size in the current layer : 16 */	mbsize_ext      = mbsize+(mborder<<1);  /* bordered bab size in the current layer: 20 */     Int border		= BORDER,    	blks            = mblks-1,	bsize           = 1<<blks,		/* bab size in the lower layer : 8 */	bsize_ext       = bsize+(border<<1);	/* bordered bab size in the lower layer: 8 */     Int blkx            = (object_width+mbsize-1)/mbsize,	blky            = (object_height+mbsize-1)/mbsize;    UInt prob;    UChar *lower_bab;			/* alpha block in the lower layer */    UChar *bordered_lower_bab;		/* bordered alpha block in the lower layer */     UChar *half_bab;			/* alpha mb in the current layer */    UChar *bordered_half_bab;		/* bordered alpha mb in the current layer */     UChar *curr_bab;			/* alpha mb in the current layer */    UChar *bordered_curr_bab;		/* bordered alpha mb in the current layer */    ArDecoder	ar_decoder;    /*-- Memory allocation ---------------------------------------------------------*/    lower_bab = (UChar *) calloc(bsize*bsize, sizeof(UChar));    bordered_lower_bab = (UChar *) calloc(bsize_ext*bsize_ext, sizeof(UChar));    half_bab = (UChar *) calloc(mbsize*bsize, sizeof(UChar));    bordered_half_bab = (UChar *) calloc(mbsize_ext*bsize_ext, sizeof(UChar));    curr_bab = (UChar *) calloc(mbsize*mbsize, sizeof(UChar));    bordered_curr_bab = (UChar *) calloc(mbsize_ext*mbsize_ext, sizeof(UChar));    /*-- Decode the Enhancement Layer ------------------------------------------------*/    StartArDecoder_Still(&ar_decoder);    for ( j=y=y2=0; j<blky; j++, y+=bsize, y2+=mbsize )     {      for ( i=x=x2=0; i<blkx; i++, x+=bsize, x2+=mbsize )       {        /*-- Initialize BABs --*/	q = y*width;	for ( l=p=0; l<bsize; l++, q+=width ) 	{          for ( k=0; k<bsize; k++, p++ ) 	  {	      if(  y+l < height && x+k < width )		lower_bab[p] = (LowShape[ q+x+k ] != 0);	      else		lower_bab[p] = 0;          }	}		q = y2*width;	for ( l=p=0; l<mbsize; l++, q+=width )           for ( k=0; k<bsize; k++, p++ ) 		    half_bab[p]=0;	q = y2*width2;	for ( l=p=0; l<mbsize; l++, q+=width2 )           for ( k=0; k<mbsize; k++, p++ ) 			curr_bab[p]=0;	/*-- Get BAB coding mode -- */	if(filter->DWT_Class==DWT_ODD_SYMMETRIC){	  prob=scalable_bab_type_prob[0];	} else if(filter->DWT_Class==DWT_EVEN_SYMMETRIC) {	  prob=scalable_bab_type_prob[1];	} else {	  fprintf(stderr,"Error: filter type in ShapeEnhHeaderDecode()!\n");	  exit(0);	}	bab_type = ArDecodeSymbol_Still(&ar_decoder, prob);        /* Add surrounding pixels for Modified SISC. */	AddBorderToBABs(LowShape, HalfShape, CurShape,			lower_bab, half_bab, curr_bab,			bordered_lower_bab, bordered_half_bab,			bordered_curr_bab,			object_width, object_height,			i, j, mbsize, blkx);	/* Decode mask pixel values in the current layer */	ret = ShapeEnhContentDecode(bordered_lower_bab, 				bordered_half_bab, 				bordered_curr_bab, 				bab_type, 				mbsize, 					filter,				&ar_decoder);	if (ret == Error)        {          fprintf(stderr,"\n SI arithmetic coding Error !\n");          return  Error;        }	q = mborder*mbsize_ext;	for ( l=p=0; l<mbsize; l++, q+=mbsize_ext )           for ( k=0; k<mbsize; k++, p++ ) 	      	curr_bab[p]=bordered_curr_bab[q+k+mborder];	q = mborder*bsize_ext;	for ( l=p=0; l<mbsize; l++, q+=bsize_ext )           for ( k=0; k<bsize; k++, p++ ) 	      	half_bab[p]=bordered_half_bab[q+k+border];        /*-- Put BABs to HalfShape--*/	q = y2*width;	for ( l=p=0; l<mbsize; l++, q+=width )           for ( k=0; k<bsize; k++, p++ ) 	    if(  y2+l < height2 && x+k < width )	      HalfShape[ q+x+k ] = half_bab[p];      	/*-- Put BABs to CurShape--*/	q = y2*width2;	for ( l=p=0; l<mbsize; l++, q+=width2 ) 	  for ( k=0; k<mbsize; k++, p++ ) 	    if(  y2+l < height2 && x2+k < width2 )	      CurShape[ q+x2+k ] = curr_bab[p];            }    }    StopArDecoder_Still (&ar_decoder);    /*-- Memory free ---------------------------------------------------------*/    free(lower_bab);    free(bordered_lower_bab);    free(half_bab);    free(bordered_half_bab);    free(curr_bab);    free(bordered_curr_bab);    return ( 0 );}/* Modified by shson */Int CVTCDecoder::ShapeEnhContentDecode(UChar *bordered_lower_bab, 			UChar *bordered_half_bab, 			UChar *bordered_curr_bab, 			Int bab_type, 			Int mbsize,		      FILTER *filter,			ArDecoder *ar_decoder){	if (bab_type==0) /* Interleaved Scan-Line (ISL) coding */	{		Int scan_order = DecideScanOrder(bordered_lower_bab,mbsize); // SAIT_PDAM: ADDED by D.-S.Cho (Samsung AIT)		ExclusiveORdecoding (bordered_lower_bab,				     bordered_half_bab,				     bordered_curr_bab,				     mbsize,					 scan_order, // SAIT_PDAM: ADDED by D.-S.Cho (Samsung AIT)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -