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

📄 img_fdct_8x8.h

📁 DM642的mpeg4编码
💻 H
📖 第 1 页 / 共 3 页
字号:
/* ======================================================================== */
/*  TEXAS INSTRUMENTS, INC.                                                 */
/*                                                                          */
/*  IMGLIB  DSP Image/Video Processing Library                              */
/*                                                                          */
/*      Release:        Revision 1.04b                                      */
/*      CVS Revision:   1.8     Sun Sep 29 03:32:20 2002 (UTC)              */
/*      Snapshot date:  23-Oct-2003                                         */
/*                                                                          */
/*  This library contains proprietary intellectual property of Texas        */
/*  Instruments, Inc.  The library and its source code are protected by     */
/*  various copyrights, and portions may also be protected by patents or    */
/*  other legal protections.                                                */
/*                                                                          */
/*  This software is licensed for use with Texas Instruments TMS320         */
/*  family DSPs.  This license was provided to you prior to installing      */
/*  the software.  You may review this license by consulting the file       */
/*  TI_license.PDF which accompanies the files in this library.             */
/* ------------------------------------------------------------------------ */
/*          Copyright (C) 2003 Texas Instruments, Incorporated.             */
/*                          All Rights Reserved.                            */
/* ======================================================================== */
/* ======================================================================== */
/*  Assembler compatibility shim for assembling 4.30 and later code on      */
/*  tools prior to 4.30.                                                    */
/* ======================================================================== */
/* ======================================================================== */
/*  End of assembler compatibility shim.                                    */
/* ======================================================================== */
/* ======================================================================== */
/*                                                                          */
/*  TEXAS INSTRUMENTS, INC.                                                 */
/*                                                                          */
/*  NAME                                                                    */
/*      IMG_fdct_8x8 -- 8x8 Block FDCT With Rounding, Little Endian         */
/*                                                                          */
/*  REVISION DATE                                                           */
/*      23-May-2002                                                         */
/*                                                                          */
/*  USAGE                                                                   */
/*      This routine is C callable, and has the following C prototype:      */
/*                                                                          */
/*          void IMG_fdct_8x8(short fdct_data[], unsigned num_fdcts)        */
/*                                                                          */
/*      The fdct routine accepts a list of 8x8 pixel blocks and performs    */
/*      FDCTs on each.  The array should be laid out identically to         */
/*      "fdct_data[num_fdcts][8][8]".  All operations in this array are     */
/*      performed entirely in-place.                                        */
/*                                                                          */
/*      Input values are stored in shorts, and may be in the range          */
/*      [-512,511].  Larger input values may result in overflow.            */
/*                                                                          */
/*      This code requires '50 + 76 * num_fdcts' cycles to process          */
/*      'num_fdcts' blocks, including function call overhead.  When         */
/*      'num_fdcts' is zero, an early exit is taken and the function        */
/*      runs for only 13 cycles (again, including call overhead).           */
/*                                                                          */
/*  DESCRIPTION                                                             */
/*      The IMG_fdct_8x8 function implements a Chen FDCT. Output values are */
/*      rounded, providing improved accuracy.  Input terms are expected     */
/*      to be signed 11Q0 values, producing signed 15Q0 results.  (A        */
/*      smaller dynamic range may be used on the input, producing a         */
/*      correspondingly smaller output range.  Typical applications         */
/*      include processing signed 9Q0 and unsigned 8Q0 pixel data,          */
/*      producing signed 13Q0 or 12Q0 outputs, respectively.)  No           */
/*      saturation is performed.                                            */
/*                                                                          */
/*      Note:  This code guarantees correct operation, even in the case     */
/*      that 'num_fdcts == 0'.  In this case, the function runs for only    */
/*      13 cycles (counting 6 cycles of function-call overhead), due to     */
/*      early-exit code.  The early-exit case performs one access to the    */
/*      fdct_data[] array and no access to the stack.                       */
/*                                                                          */
/*  C CODE                                                                  */
/*                                                                          */
/*      void IMG_fdct_8x8(short *dct_data, unsigned num_fdcts)              */
/*      {                                                                   */
/*          // ---------------------------------------------------- //      */
/*          //  Set up the cosine coefficients.                     //      */
/*          // ---------------------------------------------------- //      */
/*          const unsigned short c1 = 0x1F62;   // Q13   coeff      //      */
/*          const unsigned short c3 = 0x1A9B;   // Q13   coeff      //      */
/*          const unsigned short c5 = 0x11C7;   // Q13   coeff      //      */
/*          const unsigned short c7 = 0x063E;   // Q13   coeff      //      */
/*          const unsigned short c2 = 0x29CF;   // Q13.5 coeff      //      */
/*          const unsigned short c6 = 0x1151;   // Q13.5 coeff      //      */
/*          const unsigned short C1 = 0xFB15;   // Q16   coeff      //      */
/*          const unsigned short C3 = 0xD4DB;   // Q16   coeff      //      */
/*          const unsigned short C5 = 0x8E3A;   // Q16   coeff      //      */
/*          const unsigned short C7 = 0x31F1;   // Q16   coeff      //      */
/*          const unsigned short C2 = 0xA73D;   // Q15.5 coeff      //      */
/*          const unsigned short C6 = 0x4546;   // Q15.5 coeff      //      */
/*          const unsigned short C4 = 0xB505;   // Q16   coeff      //      */
/*                                                                          */
/*          // ---------------------------------------------------- //      */
/*          //  Intermediate calculations.                          //      */
/*          // ---------------------------------------------------- //      */
/*          short f0, f1, f2, f3;   // Spatial domain samples.      //      */
/*          short f4, f5, f6, f7;   // Spatial domain samples.      //      */
/*          short g0, g1, h0, h1;   // Even-half intermediate.      //      */
/*          short p0, p1;           // Even-half intermediate.      //      */
/*          short r0, r1, r0_,r1_;  // Even-half intermediate.      //      */
/*          short P0, P1, R0, R1;   // Even-half intermediate.      //      */
/*          short g2, g3, h2, h3;   // Odd-half intermediate.       //      */
/*          short q1a,s1a,q0, q1;   // Odd-half intermediate.       //      */
/*          short s0, s1;           // Odd-half intermediate.       //      */
/*          short Q0, Q1, S0, S1;   // Odd-half intermediate.       //      */
/*          short F0, F1, F2, F3;   // Freq. domain results.        //      */
/*          short F4, F5, F6, F7;   // Freq. domain results.        //      */
/*                                                                          */
/*          // ---------------------------------------------------- //      */
/*          //  Input and output pointers, loop control.            //      */
/*          // ---------------------------------------------------- //      */
/*          unsigned i, j;                                                  */
/*          short    *dct_io_ptr;                                           */
/*                                                                          */
/*          // ---------------------------------------------------- //      */
/*          //  Outer vertical loop -- Process each 8x8 block.      //      */
/*          // ---------------------------------------------------- //      */
/*          dct_io_ptr = dct_data;                                          */
/*          for (i = 0; i < num_fdcts; i++)                                 */
/*          {                                                               */
/*              // ------------------------------------------------ //      */
/*              //  Perform Vertical 1-D FDCT on columns within     //      */
/*              //  each block.  The inputs to this pass are in Q0  //      */
/*              //  and the outputs are in Q1.5.                    //      */
/*              // ------------------------------------------------ //      */
/*              for (j = 0; j < 8; j++)                                     */
/*              {                                                           */
/*                  // -------------------------------------------- //      */
/*                  //  Load the spatial-domain samples.            //      */
/*                  //  The incoming terms start at Q0 precision.   //      */
/*                  // -------------------------------------------- //      */
/*                  f0 = dct_io_ptr[ 0];                                    */
/*                  f1 = dct_io_ptr[ 8];                                    */
/*                  f2 = dct_io_ptr[16];                                    */
/*                  f3 = dct_io_ptr[24];                                    */
/*                  f4 = dct_io_ptr[32];                                    */
/*                  f5 = dct_io_ptr[40];                                    */
/*                  f6 = dct_io_ptr[48];                                    */
/*                  f7 = dct_io_ptr[56];                                    */
/*                                                                          */
/*                  // -------------------------------------------- //      */
/*                  //  Stage 1:  Separate into even & odd halves.  //      */
/*                  //                                              //      */
/*                  //  The results of this stage are implicitly    //      */

⌨️ 快捷键说明

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