sbtb.c
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:9k
源码类别:

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. #include "statname.h"
  36. void windowB(float *vbuf, int vb_ptr, unsigned char *pcm);
  37. void windowB_dual(float *vbuf, int vb_ptr, unsigned char *pcm);
  38. void windowB16(float *vbuf, int vb_ptr, unsigned char *pcm);
  39. void windowB16_dual(float *vbuf, int vb_ptr, unsigned char *pcm);
  40. void windowB8(float *vbuf, int vb_ptr, unsigned char *pcm);
  41. void windowB8_dual(float *vbuf, int vb_ptr, unsigned char *pcm);
  42. /*============================================================*/
  43. void sbtB_mono(float *sample, unsigned char *pcm, 
  44.                int n, float vbuf[][512], int vb_ptr_arg[])
  45. {
  46. int i;
  47. vb_ptr = vb_ptr_arg[0];
  48. for(i=0;i<n;i++) {
  49.   fdct32(sample, vbuf[0]+vb_ptr);
  50.   windowB(vbuf[0], vb_ptr, pcm);
  51.   sample += 64;
  52.   vb_ptr = (vb_ptr-32) & 511;
  53.   pcm += 32;
  54. }
  55. vb_ptr_arg[0] = vb_ptr;
  56. }
  57. /*------------------------------------------------------------*/
  58. void sbtB_dual(float *sample, unsigned char *pcm, 
  59.                int n, float vbuf[][512], int vb_ptr_arg[])
  60. {
  61. int i;
  62. vb_ptr = vb_ptr_arg[0];
  63. for(i=0;i<n;i++) {
  64.   fdct32_dual(sample, vbuf[0]+vb_ptr);
  65.   fdct32_dual(sample+1, vbuf[1]+vb_ptr);
  66.   windowB_dual(vbuf[0], vb_ptr, pcm);
  67.   windowB_dual(vbuf[1], vb_ptr, pcm+1);
  68.   sample += 64;
  69.   vb_ptr = (vb_ptr-32) & 511;
  70.   pcm += 64;
  71. }
  72. vb_ptr_arg[0] = vb_ptr;
  73. }
  74. /*------------------------------------------------------------*/
  75. #ifdef REDUCTION
  76. /*------------------------------------------------------------*/
  77. /* convert dual to mono */
  78. void sbtB_dual_mono(float *sample, unsigned char *pcm, 
  79.                     int n, float vbuf[][512], int vb_ptr_arg[])
  80. {
  81. int i;
  82. vb_ptr = vb_ptr_arg[0];
  83. for(i=0;i<n;i++) {
  84.   fdct32_dual_mono(sample, vbuf[0]+vb_ptr);
  85.   windowB(vbuf[0], vb_ptr, pcm);
  86.   sample += 64;
  87.   vb_ptr = (vb_ptr-32) & 511;
  88.   pcm += 32;
  89. }
  90. vb_ptr_arg[0] = vb_ptr;
  91. }
  92. /*------------------------------------------------------------*/
  93. /* convert dual to left */
  94. void sbtB_dual_left(float *sample, unsigned char *pcm, 
  95.                     int n, float vbuf[][512], int vb_ptr_arg[])
  96. {
  97. int i;
  98. vb_ptr = vb_ptr_arg[0];
  99. for(i=0;i<n;i++) {
  100.   fdct32_dual(sample, vbuf[0]+vb_ptr);
  101.   windowB(vbuf[0], vb_ptr, pcm);
  102.   sample += 64;
  103.   vb_ptr = (vb_ptr-32) & 511;
  104.   pcm += 32;
  105. }
  106. vb_ptr_arg[0] = vb_ptr;
  107. }
  108. /*------------------------------------------------------------*/
  109. /* convert dual to right */
  110. void sbtB_dual_right(float *sample, unsigned char *pcm, 
  111.                      int n, float vbuf[][512], int vb_ptr_arg[])
  112. {
  113. int i;
  114. vb_ptr = vb_ptr_arg[0];
  115. sample++;   /* point to right chan */
  116. for(i=0;i<n;i++) {
  117.   fdct32_dual(sample, vbuf[0]+vb_ptr);
  118.   windowB(vbuf[0], vb_ptr, pcm);
  119.   sample += 64;
  120.   vb_ptr = (vb_ptr-32) & 511;
  121.   pcm += 32;
  122. }
  123. vb_ptr_arg[0] = vb_ptr;
  124. }
  125. /*------------------------------------------------------------*/
  126. /*---------------- 16 pt sbt's  -------------------------------*/
  127. /*------------------------------------------------------------*/
  128. void sbtB16_mono(float *sample, unsigned char *pcm, 
  129.                  int n, float vbuf[][512], int vb_ptr_arg[])
  130. {
  131. int i;
  132. vb_ptr = vb_ptr_arg[0];
  133. for(i=0;i<n;i++) {
  134.   fdct16(sample, vbuf[0]+vb_ptr);
  135.   windowB16(vbuf[0], vb_ptr, pcm);
  136.   sample += 64;
  137.   vb_ptr = (vb_ptr-16) & 255;
  138.   pcm += 16;
  139. }
  140. vb_ptr_arg[0] = vb_ptr;
  141. }
  142. /*------------------------------------------------------------*/
  143. void sbtB16_dual(float *sample, unsigned char *pcm, 
  144.                  int n, float vbuf[][512], int vb_ptr_arg[])
  145. {
  146. int i;
  147. vb_ptr = vb_ptr_arg[0];
  148. for(i=0;i<n;i++) {
  149.   fdct16_dual(sample, vbuf[0]+vb_ptr);
  150.   fdct16_dual(sample+1, vbuf[1]+vb_ptr);
  151.   windowB16_dual(vbuf[0], vb_ptr, pcm);
  152.   windowB16_dual(vbuf[1], vb_ptr, pcm+1);
  153.   sample += 64;
  154.   vb_ptr = (vb_ptr-16) & 255;
  155.   pcm += 32;
  156. }
  157. vb_ptr_arg[0] = vb_ptr;
  158. }
  159. /*------------------------------------------------------------*/
  160. void sbtB16_dual_mono(float *sample, unsigned char *pcm, 
  161.                       int n, float vbuf[][512], int vb_ptr_arg[])
  162. {
  163. int i;
  164. vb_ptr = vb_ptr_arg[0];
  165. for(i=0;i<n;i++) {
  166.   fdct16_dual_mono(sample, vbuf[0]+vb_ptr);
  167.   windowB16(vbuf[0], vb_ptr, pcm);
  168.   sample += 64;
  169.   vb_ptr = (vb_ptr-16) & 255;
  170.   pcm += 16;
  171. }
  172. vb_ptr_arg[0] = vb_ptr;
  173. }
  174. /*------------------------------------------------------------*/
  175. void sbtB16_dual_left(float *sample, unsigned char *pcm, 
  176.                       int n, float vbuf[][512], int vb_ptr_arg[])
  177. {
  178. int i;
  179. vb_ptr = vb_ptr_arg[0];
  180. for(i=0;i<n;i++) {
  181.   fdct16_dual(sample, vbuf[0]+vb_ptr);
  182.   windowB16(vbuf[0], vb_ptr, pcm);
  183.   sample += 64;
  184.   vb_ptr = (vb_ptr-16) & 255;
  185.   pcm += 16;
  186. }
  187. vb_ptr_arg[0] = vb_ptr;
  188. }
  189. /*------------------------------------------------------------*/
  190. void sbtB16_dual_right(float *sample, unsigned char *pcm, 
  191.                        int n, float vbuf[][512], int vb_ptr_arg[])
  192. {
  193. int i;
  194. vb_ptr = vb_ptr_arg[0];
  195. sample++;
  196. for(i=0;i<n;i++) {
  197.   fdct16_dual(sample, vbuf[0]+vb_ptr);
  198.   windowB16(vbuf[0], vb_ptr, pcm);
  199.   sample += 64;
  200.   vb_ptr = (vb_ptr-16) & 255;
  201.   pcm += 16;
  202. }
  203. vb_ptr_arg[0] = vb_ptr;
  204. }
  205. /*------------------------------------------------------------*/
  206. /*---------------- 8 pt sbt's  -------------------------------*/
  207. /*------------------------------------------------------------*/
  208. void sbtB8_mono(float *sample, unsigned char *pcm, 
  209.                 int n, float vbuf[][512], int vb_ptr_arg[])
  210. {
  211. int i;
  212. vb_ptr = vb_ptr_arg[0];
  213. for(i=0;i<n;i++) {
  214.   fdct8(sample, vbuf[0]+vb_ptr);
  215.   windowB8(vbuf[0], vb_ptr, pcm);
  216.   sample += 64;
  217.   vb_ptr = (vb_ptr-8) & 127;
  218.   pcm += 8;
  219. }
  220. vb_ptr_arg[0] = vb_ptr;
  221. }
  222. /*------------------------------------------------------------*/
  223. void sbtB8_dual(float *sample, unsigned char *pcm, 
  224.                 int n, float vbuf[][512], int vb_ptr_arg[])
  225. {
  226. int i;
  227. vb_ptr = vb_ptr_arg[0];
  228. for(i=0;i<n;i++) {
  229.   fdct8_dual(sample, vbuf[0]+vb_ptr);
  230.   fdct8_dual(sample+1, vbuf[1]+vb_ptr);
  231.   windowB8_dual(vbuf[0], vb_ptr, pcm);
  232.   windowB8_dual(vbuf[1], vb_ptr, pcm+1);
  233.   sample += 64;
  234.   vb_ptr = (vb_ptr-8) & 127;
  235.   pcm += 16;
  236. }
  237. vb_ptr_arg[0] = vb_ptr;
  238. }
  239. /*------------------------------------------------------------*/
  240. void sbtB8_dual_mono(float *sample, unsigned char *pcm, 
  241.                      int n, float vbuf[][512], int vb_ptr_arg[])
  242. {
  243. int i;
  244. vb_ptr = vb_ptr_arg[0];
  245. for(i=0;i<n;i++) {
  246.   fdct8_dual_mono(sample, vbuf[0]+vb_ptr);
  247.   windowB8(vbuf[0], vb_ptr, pcm);
  248.   sample += 64;
  249.   vb_ptr = (vb_ptr-8) & 127;
  250.   pcm += 8;
  251. }
  252. vb_ptr_arg[0] = vb_ptr;
  253. }
  254. /*------------------------------------------------------------*/
  255. void sbtB8_dual_left(float *sample, unsigned char *pcm, 
  256.                      int n, float vbuf[][512], int vb_ptr_arg[])
  257. {
  258. int i;
  259. vb_ptr = vb_ptr_arg[0];
  260. for(i=0;i<n;i++) {
  261.   fdct8_dual(sample, vbuf[0]+vb_ptr);
  262.   windowB8(vbuf[0], vb_ptr, pcm);
  263.   sample += 64;
  264.   vb_ptr = (vb_ptr-8) & 127;
  265.   pcm += 8;
  266. }
  267. vb_ptr_arg[0] = vb_ptr;
  268. }
  269. /*------------------------------------------------------------*/
  270. void sbtB8_dual_right(float *sample, unsigned char *pcm, 
  271.                       int n, float vbuf[][512], int vb_ptr_arg[])
  272. {
  273. int i;
  274. vb_ptr = vb_ptr_arg[0];
  275. sample++;
  276. for(i=0;i<n;i++) {
  277.   fdct8_dual(sample, vbuf[0]+vb_ptr);
  278.   windowB8(vbuf[0], vb_ptr, pcm);
  279.   sample += 64;
  280.   vb_ptr = (vb_ptr-8) & 127;
  281.   pcm += 8;
  282. }
  283. vb_ptr_arg[0] = vb_ptr;
  284. }
  285. /*------------------------------------------------------------*/
  286. // end reduction 8 bit
  287. #endif