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

📄 shapeenhdecode.cpp

📁 au1200 linux2.6.11 硬件解码mae驱动和maiplayer播放器源码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/****************************************************************************//*   MPEG4 Visual Texture Coding (VTC) Mode Software                        *//*                                                                          *//*   This software was jointly developed by the following participants:     *//*                                                                          *//*   Single-quant,  multi-quant and flow control                            *//*   are provided by  Sarnoff Corporation                                   *//*     Iraj Sodagar   (iraj@sarnoff.com)                                    *//*     Hung-Ju Lee    (hjlee@sarnoff.com)                                   *//*     Paul Hatrack   (hatrack@sarnoff.com)                                 *//*     Shipeng Li     (shipeng@sarnoff.com)                                 *//*     Bing-Bing Chai (bchai@sarnoff.com)                                   *//*     B.S. Srinivas  (bsrinivas@sarnoff.com)                               *//*                                                                          *//*   Bi-level is provided by Texas Instruments                              *//*     Jie Liang      (liang@ti.com)                                        *//*                                                                          *//*   Shape Coding is provided by  OKI Electric Industry Co., Ltd.           *//*     Zhixiong Wu    (sgo@hlabs.oki.co.jp)                                 *//*     Yoshihiro Ueda (yueda@hlabs.oki.co.jp)                               *//*     Toshifumi Kanamaru (kanamaru@hlabs.oki.co.jp)                        *//*                                                                          *//*   OKI, Sharp, Sarnoff, TI and Microsoft contributed to bitstream         *//*   exchange and bug fixing.                                               *//*                                                                          *//*   Scalable Shape Coding was provided by:                                 *//*         Shipeng Li (Sarnoff Corporation),                                *//*         Dae-Sung Cho (Samsung AIT),					    *//*         Se Hoon Son (Samsung AIT)	                                    *//* In the course of development of the MPEG-4 standard, this software       *//* module is an implementation of a part of one or more MPEG-4 tools as     *//* specified by the MPEG-4 standard.                                        *//*                                                                          *//* The copyright of this software belongs to ISO/IEC. ISO/IEC gives use     *//* of the MPEG-4 standard free license to use this  software module or      *//* modifications thereof for hardware or software products claiming         *//* conformance to the MPEG-4 standard.                                      *//*                                                                          *//* Those intending to use this software module in hardware or software      *//* products are advised that use may infringe existing  patents. The        *//* original developers of this software module and their companies, the     *//* subsequent editors and their companies, and ISO/IEC have no liability    *//* and ISO/IEC have no liability for use of this software module or         *//* modification thereof in an implementation.                               *//*                                                                          *//* Permission is granted to MPEG members to use, copy, modify,              *//* and distribute the software modules ( or portions thereof )              *//* for standardization activity within ISO/IEC JTC1/SC29/WG11.              *//*                                                                          *//* Copyright 1995, 1996, 1997, 1998 ISO/IEC                                 *//****************************************************************************//***************************************************************************** "This software module was originally developed by: 	Dae-Sung Cho (Samsung AIT),	Se Hoon Son (Samsung AIT)         and edited by:	Dae-Sung Cho (Samsung AIT)         in the course of development of the <MPEG-4 Video(ISO/IEC 14496-2)>. This  software module is an implementation of a part of one or more <MPEG-4 Video  (ISO/IEC 14496-2)> tools as specified by the <MPEG-4 Video(ISO/IEC 14496-2)  >. ISO/IEC gives users of the <MPEG-4 Video(ISO/IEC 14496-2)> free license  to this software module or modifications thereof for use in hardware or  software products claiming conformance to the <MPEG-4 Video(ISO/IEC 14496-2  )>. Those intending to use this software module in hardware or software  products are advised that its use may infringe existing patents. The  original developer of this software module and his/her company, the  subsequent editors and their companies, and ISO/IEC have no liability for  use of this software module or modifications thereof in an implementation.  Copyright is not released for non <MPEG-4 Video(ISO/IEC 14496-2)>  conforming products. Samsung AIT (SAIT) retains full right to use the code  for his/her own purpose, assign or donate the code to a third party and to  inhibit third parties from using the code for non <MPEG-4 Video(ISO/IEC  14496-2)> conforming products. This copyright notice must be included in  all copies or derivative works. Copyright (c)1997, 1998". *****************************************************************************/#include <stdio.h>#include <math.h>#include <malloc.h>#include "basic.hpp"#include "dataStruct.hpp"//#include "ShapeBaseCommon.h"//#include "BinArCodec.h" //#include "dwt.h"#include "ShapeEnhDef.hpp"//#include "ShapeEnhCommon.h"//#include "ShapeEnhDecode.h"#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)

⌨️ 快捷键说明

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