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

📄 frameini.c

📁 魔兽2Linux版
💻 C
📖 第 1 页 / 共 2 页
字号:
//==========================================================================////  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR//  PURPOSE.////  Copyright (c) 1999 - 2001  On2 Technologies Inc. All Rights Reserved.////--------------------------------------------------------------------------/******************************************************************************   Module Title :     FrameIni.c**   Description  :     Video CODEC playback module********************************************************************************//*****************************************************************************  Header Files******************************************************************************/#include "pbdll.h"#include "BlockMapping.h"#include "stdlib.h"#include "vfw_PB_Interface.h"/*****************************************************************************  Module constants.******************************************************************************/                        /*****************************************************************************  Exported Global Variables******************************************************************************/  /*****************************************************************************  Imports ******************************************************************************/  /*****************************************************************************  Module Static Variables******************************************************************************/  /*****************************************************************************  Forward References******************************************************************************/  void InitializeFragCoordinates(PB_INSTANCE *pbi);/*****************************************************************************  Explicit Imports******************************************************************************//* Last Inter frame DC values *///extern Q_LIST_ENTRY InvLastInterDC;//extern Q_LIST_ENTRY InvLastIntraDC;/**************************************************************************** *  *  ROUTINE       :     CalcPixelIndexTable * *  INPUTS        :     Nonex. * *  OUTPUTS       :     None. * *  RETURNS       :     None * *  FUNCTION      :     Initialises the pixel index table. * *  SPECIAL NOTES :     None.  * * *  ERRORS        :     None. * ****************************************************************************/void CalcPixelIndexTable( PB_INSTANCE *pbi){    UINT32 i;    UINT32 * PixelIndexTablePtr;    // Calculate the pixel index table for normal image buffers    PixelIndexTablePtr = pbi->pixel_index_table;    for ( i = 0; i < pbi->YPlaneFragments; i++ )    {        PixelIndexTablePtr[ i ] = ((i / pbi->HFragments) * pbi->Configuration.VFragPixels * pbi->Configuration.VideoFrameWidth);          PixelIndexTablePtr[ i ] += ((i % pbi->HFragments) * pbi->Configuration.HFragPixels);    }     PixelIndexTablePtr = &pbi->pixel_index_table[pbi->YPlaneFragments];    for ( i = 0; i < ((pbi->HFragments >> 1) * pbi->VFragments); i++ )    {        PixelIndexTablePtr[ i ] =  ((i / (pbi->HFragments / 2) ) *                                    (pbi->Configuration.VFragPixels * (pbi->Configuration.VideoFrameWidth / 2)) );           PixelIndexTablePtr[ i ] += ((i % (pbi->HFragments / 2) ) * pbi->Configuration.HFragPixels) + pbi->YPlaneSize;    }    /****************************************************************************************************************/    // Now calculate the pixel index table for image reconstruction buffers    PixelIndexTablePtr = pbi->recon_pixel_index_table;    for ( i = 0; i < pbi->YPlaneFragments; i++ )    {        PixelIndexTablePtr[ i ] = ((i / pbi->HFragments) * pbi->Configuration.VFragPixels * pbi->Configuration.YStride);          PixelIndexTablePtr[ i ] += ((i % pbi->HFragments) * pbi->Configuration.HFragPixels) + pbi->ReconYDataOffset;    }         // U blocks    PixelIndexTablePtr = &pbi->recon_pixel_index_table[pbi->YPlaneFragments];    for ( i = 0; i < pbi->UVPlaneFragments; i++ )    {        PixelIndexTablePtr[ i ] =  ((i / (pbi->HFragments / 2) ) *                                    (pbi->Configuration.VFragPixels * (pbi->Configuration.UVStride)) );           PixelIndexTablePtr[ i ] += ((i % (pbi->HFragments / 2) ) * pbi->Configuration.HFragPixels) + pbi->ReconUDataOffset;    }    // V blocks    PixelIndexTablePtr = &pbi->recon_pixel_index_table[pbi->YPlaneFragments + pbi->UVPlaneFragments];    for ( i = 0; i < pbi->UVPlaneFragments; i++ )    {        PixelIndexTablePtr[ i ] =  ((i / (pbi->HFragments / 2) ) *                                    (pbi->Configuration.VFragPixels * (pbi->Configuration.UVStride)) );           PixelIndexTablePtr[ i ] += ((i % (pbi->HFragments / 2) ) * pbi->Configuration.HFragPixels) + pbi->ReconVDataOffset;    }}/**************************************************************************** *  *  ROUTINE       :     DeleteFragmentInfo * * *  INPUTS        :     Instance of PB to be initialized * *  OUTPUTS       :      * *  RETURNS       :     *  * *  FUNCTION      :     Initializes the Playback instance passed in * *  SPECIAL NOTES :     None.  * * *  ERRORS        :     None. * ****************************************************************************/void DeleteFragmentInfo(PB_INSTANCE * pbi){	// free prior allocs if present	if(	pbi->display_fragmentsAlloc)		free(pbi->display_fragmentsAlloc);	if(	pbi->pixel_index_tableAlloc )		free(pbi->pixel_index_tableAlloc);	if(	pbi->recon_pixel_index_tableAlloc )		free(pbi->recon_pixel_index_tableAlloc);	if(	pbi->FragTokenCountsAlloc)		free(pbi->FragTokenCountsAlloc);	if(	pbi->CodedBlockListAlloc)		free(pbi->CodedBlockListAlloc);	if(	pbi->FragMVectAlloc)		free(pbi->FragMVectAlloc);	if(pbi->FragCoeffsAlloc)		free(pbi->FragCoeffsAlloc);	if(pbi->FragCoefEOBAlloc)		free(pbi->FragCoefEOBAlloc);	if(pbi->skipped_display_fragmentsAlloc)		free(pbi->skipped_display_fragmentsAlloc);	if(pbi->QFragDataAlloc)		free(pbi->QFragDataAlloc);	if(pbi->TokenListAlloc)		free(pbi->TokenListAlloc);	if(pbi->FragCodingMethodAlloc)		free(pbi->FragCodingMethodAlloc);    if(pbi->FragCoordinates)		free(pbi->FragCoordinates);#if defined(POSTPROCESS)		if(	pbi->FragQIndexAlloc)		free(pbi->FragQIndexAlloc);	if( pbi->PPCoefBufferAlloc)		free(pbi->PPCoefBufferAlloc);	if( pbi->FragmentVariancesAlloc)		free(pbi->FragmentVariancesAlloc);#endif		if(pbi->BlockMap)		free(pbi->BlockMap);	if(pbi->SBCodedFlags)		free(pbi->SBCodedFlags);	if(pbi->SBFullyFlags)		free(pbi->SBFullyFlags);	if(pbi->MBFullyFlags)		free(pbi->MBFullyFlags);	if(pbi->MBCodedFlags)		free(pbi->MBCodedFlags);    if(pbi->_Nodes)        free(pbi->_Nodes);    pbi->_Nodes = 0;    	pbi->QFragDataAlloc = 0;	pbi->TokenListAlloc = 0;	pbi->skipped_display_fragmentsAlloc = 0;	pbi->FragCoeffsAlloc = 0;	pbi->FragCoefEOBAlloc = 0;	pbi->display_fragmentsAlloc = 0;	pbi->pixel_index_tableAlloc = 0;	pbi->recon_pixel_index_tableAlloc = 0;	pbi->FragTokenCountsAlloc = 0;	pbi->CodedBlockListAlloc = 0;	pbi->FragCodingMethodAlloc = 0;	pbi->FragMVectAlloc = 0;	pbi->MBCodedFlags = 0;	pbi->MBFullyFlags = 0;	pbi->BlockMap = 0;	pbi->SBCodedFlags = 0;	pbi->SBFullyFlags = 0;	pbi->QFragData = 0;                  	pbi->TokenList = 0;	pbi->skipped_display_fragments = 0;	pbi->FragCoeffs = 0;	pbi->FragCoefEOB = 0;	pbi->display_fragments = 0;	pbi->pixel_index_table = 0;	pbi->recon_pixel_index_table = 0;	pbi->FragTokenCounts = 0;	pbi->CodedBlockList = 0;	pbi->FragCodingMethod = 0;    pbi->FragCoordinates = 0;	pbi->FragMVect = 0;#if defined(POSTPROCESS)	pbi->PPCoefBufferAlloc=0;	pbi->PPCoefBuffer=0;	pbi->FragQIndexAlloc = 0;	pbi->FragQIndex = 0;    pbi->FragmentVariancesAlloc= 0;    pbi->FragmentVariances = 0 ;#endif}/**************************************************************************** *  *  ROUTINE       :     AllocateFragmentInfo * * *  INPUTS        :     Instance of PB to be initialized * *  OUTPUTS       :      * *  RETURNS       :     *  * *  FUNCTION      :     Initializes the Playback instance passed in * *  SPECIAL NOTES :     None.  * * *  ERRORS        :     None. * ****************************************************************************/#define ROUNDUP32(X) ( ( ( (unsigned long) X ) + 31 )&( 0xFFFFFFE0 ) )BOOL AllocateFragmentInfo(PB_INSTANCE * pbi){	// clear any existing info	DeleteFragmentInfo(pbi);	// Perform Fragment Allocations    pbi->display_fragmentsAlloc = (UINT8 *) malloc(32+pbi->UnitFragments * sizeof(UINT8));    if(!pbi->display_fragmentsAlloc) { DeleteFragmentInfo(pbi); return FALSE;}    pbi->pixel_index_tableAlloc = (UINT32 *)malloc(32+pbi->UnitFragments * sizeof(UINT32));    if(!pbi->pixel_index_tableAlloc) { DeleteFragmentInfo(pbi); return FALSE;}    pbi->recon_pixel_index_tableAlloc = (UINT32 *)malloc(32+pbi->UnitFragments * sizeof(UINT32));    if(!pbi->recon_pixel_index_tableAlloc) { DeleteFragmentInfo(pbi); return FALSE;}    pbi->FragTokenCountsAlloc = (UINT32 *)malloc(32+pbi->UnitFragments * sizeof(UINT32));    if(!pbi->FragTokenCountsAlloc) { DeleteFragmentInfo(pbi); return FALSE;}    pbi->CodedBlockListAlloc = (INT32 *)malloc(32+pbi->UnitFragments * sizeof(INT32));    if(!pbi->CodedBlockListAlloc) { DeleteFragmentInfo(pbi); return FALSE;}        pbi->FragMVectAlloc = (MOTION_VECTOR *)malloc(32+pbi->UnitFragments * sizeof(MOTION_VECTOR));    if(!pbi->FragMVectAlloc) { DeleteFragmentInfo(pbi); return FALSE;}        pbi->FragCoeffsAlloc = (UINT8 *)malloc(32+pbi->UnitFragments * sizeof(UINT8 ));    if(!pbi->FragCoeffsAlloc) { DeleteFragmentInfo(pbi); return FALSE;}        pbi->FragCoefEOBAlloc = (UINT8 *)malloc(32+pbi->UnitFragments * sizeof(UINT8 ));    if(!pbi->FragCoefEOBAlloc) { DeleteFragmentInfo(pbi); return FALSE;}        pbi->skipped_display_fragmentsAlloc = (UINT8 *)malloc(32+pbi->UnitFragments * sizeof(UINT8 ));    if(!pbi->skipped_display_fragmentsAlloc) { DeleteFragmentInfo(pbi); return FALSE;}        pbi->QFragDataAlloc = (INT16 (*)[64])malloc(32+pbi->UnitFragments * sizeof(Q_LIST_ENTRY) * 64);    if(!pbi->QFragDataAlloc) { DeleteFragmentInfo(pbi); return FALSE;}        pbi->TokenListAlloc = (UINT32 (*)[128])malloc(32+pbi->UnitFragments * sizeof(UINT32) * 128);    if(!pbi->TokenListAlloc) { DeleteFragmentInfo(pbi); return FALSE;}        pbi->FragCodingMethodAlloc = (CODING_MODE *)malloc(32+pbi->UnitFragments * sizeof(CODING_MODE));    if(!pbi->FragCodingMethodAlloc) { DeleteFragmentInfo(pbi); return FALSE;}    pbi->FragCoordinates = (COORDINATE *)malloc(pbi->UnitFragments * sizeof(COORDINATE));    if(!pbi->FragCoordinates) { DeleteFragmentInfo(pbi); return FALSE;}#if defined(POSTPROCESS)		pbi->FragQIndexAlloc = (UINT32 *) malloc(32+pbi->UnitFragments * sizeof(UINT32));    if(!pbi->FragQIndexAlloc) { DeleteFragmentInfo(pbi); return FALSE;}    pbi->PPCoefBufferAlloc = (INT16 (*)[64])malloc(32+pbi->UnitFragments * sizeof(Q_LIST_ENTRY) * 64);

⌨️ 快捷键说明

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