hxvamain.cpp
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:4k
源码类别:

Symbian

开发平台:

C/C++

  1. /* ***** BEGIN LICENSE BLOCK ***** 
  2.  * Version: RCSL 1.0/RPSL 1.0 
  3.  *  
  4.  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  5.  *      
  6.  * The contents of this file, and the files included with this file, are 
  7.  * subject to the current version of the RealNetworks Public Source License 
  8.  * Version 1.0 (the "RPSL") available at 
  9.  * http://www.helixcommunity.org/content/rpsl unless you have licensed 
  10.  * the file under the RealNetworks Community Source License Version 1.0 
  11.  * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
  12.  * in which case the RCSL will apply. You may also obtain the license terms 
  13.  * directly from RealNetworks.  You may not use this file except in 
  14.  * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
  15.  * applicable to this file, the RCSL.  Please see the applicable RPSL or 
  16.  * RCSL for the rights, obligations and limitations governing use of the 
  17.  * contents of the file.  
  18.  *  
  19.  * This file is part of the Helix DNA Technology. RealNetworks is the 
  20.  * developer of the Original Code and owns the copyrights in the portions 
  21.  * it created. 
  22.  *  
  23.  * This file, and the files included with this file, is distributed and made 
  24.  * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
  25.  * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
  26.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
  27.  * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
  28.  * 
  29.  * Technology Compatibility Kit Test Suite(s) Location: 
  30.  *    http://www.helixcommunity.org/content/tck 
  31.  * 
  32.  * Contributor(s): 
  33.  *  
  34.  * ***** END LICENSE BLOCK ***** */ 
  35. // This module implements primitive functionality of Helix Video Arch
  36. // required by the Decoder.
  37. #include "hxvamain.h"
  38. extern HXVA_FID_TYPES hxva_fid_type[HXVA_NUM_IMAGE_FORMATS + 1] = {
  39. TYPEENUM(HXVA_FID_UNDEFINED, HXVA_FID_TYPE_UNDEFINED)
  40.           // Init
  41. TYPEENUM(HXVA_FID_RGB24, HXVA_FID_TYPE_RGB)
  42.           // R 8 bits G  8 Bits B 8 Bits
  43. TYPEENUM(HXVA_FID_YUV12,HXVA_FID_TYPE_YUV)
  44. // I420
  45. // Y plane, U plane Quarter size V plane Quarter size
  46. TYPEENUM(HXVA_FID_IYUV,HXVA_FID_TYPE_YUV)
  47. // Same as I420
  48. TYPEENUM(HXVA_FID_YUY2,HXVA_FID_TYPE_YUV)
  49. TYPEENUM(HXVA_FID_H261,HXVA_FID_TYPE_DATA)
  50. TYPEENUM(HXVA_FID_H263,HXVA_FID_TYPE_DATA)
  51. TYPEENUM(HXVA_FID_H263PLUS,HXVA_FID_TYPE_DATA)
  52. };
  53. HXVA_Image_Format::HXVA_Image_Format()
  54. {
  55.     this->Clear();
  56. }
  57. void
  58. HXVA_Image_Format::Clear()
  59. {
  60.     fid = HXVA_FID_UNDEFINED;
  61.     dimensions.width = dimensions.height = 0;
  62.     Complete();
  63.     yuv_info.y_pitch = yuv_info.u_pitch = yuv_info.v_pitch = 0;
  64. }
  65. void
  66. HXVA_Image_Format::Complete()
  67. {
  68.     // rectangle = dimensions;
  69. rectangle.location.x = rectangle.location.y = 0;
  70. rectangle.dimensions.height = dimensions.height;
  71. rectangle.dimensions.width = dimensions.width;
  72.     if (HXVA_FID_Is_YUV(fid))
  73.     {
  74. // these are defaults.. set actual if different.
  75.         yuv_info.y_pitch = dimensions.width;
  76.         yuv_info.u_pitch = yuv_info.v_pitch = dimensions.width / 2;
  77.     }
  78. }
  79. HXVA_Image::HXVA_Image()
  80.     :
  81.     format()
  82. {
  83.     size = 0;
  84.     sequence_number = 0;
  85.     yuv_info.y_plane = yuv_info.u_plane = yuv_info.v_plane = NULL;
  86. }
  87. void
  88. HXVA_Image::SetBasePointer(void *base)
  89. {
  90.     if (HXVA_FID_Is_YUV(format.fid))
  91.     {
  92.         if (base)
  93. {
  94. yuv_info.y_plane = (UINT8*)base;
  95. if (format.fid == HXVA_FID_YUV12 || format.fid == HXVA_FID_IYUV)
  96. {
  97. yuv_info.u_plane = yuv_info.y_plane +
  98. (format.yuv_info.y_pitch * format.rectangle.dimensions.height);
  99. yuv_info.v_plane = yuv_info.u_plane +
  100. (format.yuv_info.u_pitch * format.rectangle.dimensions.height / 2);
  101. }
  102. else 
  103. {
  104.         
  105.             yuv_info.y_plane = yuv_info.u_plane = yuv_info.v_plane = 0;
  106.         }
  107.     }
  108.     else
  109.         data = (UINT8*)base;
  110. }
  111. UINT8*
  112. HXVA_Image::GetBasePointer(void) const
  113. {
  114.     if (HXVA_FID_Is_YUV(format.fid))
  115.         return yuv_info.y_plane;
  116.     return data;
  117. }