www.pudn.com > scaling.rar > pix_expand_h.h62


* ========================================================================= * 
*   TEXAS INSTRUMENTS, INC.                                                 * 
*                                                                           * 
*   NAME                                                                    * 
*       pix_expand                                                          * 
*S                                                                          * 
*S  REVISION HISTORY                                                        * 
*S      15-Oct-2000 Rewrote from scratch . . . . . . . . .  J. Zbiciak      * 
*                                                                           * 
*   USAGE                                                                   * 
*       This routine is C-callable and can be called as:                    * 
*                                                                           * 
*       void pix_expand_asm                                                 * 
*       (                                                                   * 
*           int n,                                    /* # of elements */   * 
*           const unsigned char *restrict in_data,    /* Input data    */   * 
*           short               *restrict out_data    /* Output data   */   * 
*       )                                                                   * 
*                                                                           * 
*                                                                           * 
*   DESCRIPTION                                                             * 
*       The code takes an array of bytes and promotes them to half-words    * 
*       by zero-extension.                                                  * 
*                                                                           * 
*       This is the C equivalent of the assembly code, without              * 
*       restrictions.  The assembly code has restrictions, as noted below.  * 
*                                                                           * 
*       void pix_expand                                                     * 
*       (                                                                   * 
*           int n,                                                          * 
*           const unsigned char *restrict in_data,                          * 
*           short               *restrict out_data                          * 
*       )                                                                   * 
*       {                                                                   * 
*           int i;                                                          * 
*                                                                           * 
*           for (i = 0; i < n; i++)                                         * 
*               out_data[i] =  in_data[i];                                  * 
*       }                                                                   * 
*                                                                           * 
*   ASSUMPTIONS                                                             * 
*       Input and output arrays must be double-word (8-byte) aligned.       * 
*                                                                           * 
*       The input must be at least 16 elements long and contain a           * 
*       multiple of 16 elements.                                            * 
*                                                                           * 
*   NOTE                                                                    * 
*       Interrupts are masked during the entire duration of this            * 
*       function, as the entire function occurs within branch delay slots.  * 
*                                                                           * 
*   MEMORY NOTE                                                             * 
*       No bank conflicts occur.  This is a LITTLE ENDIAN implementation.   * 
*                                                                           * 
*   TECHNIQUES                                                              * 
*       The loop is unrolled 16 times, loading bytes with LDDW.  It uses    * 
*       UNPKHU4 and UNPKLU4 to unpack the data and store the results with   * 
*       STDW.                                                               * 
*                                                                           * 
*       To shave a few extra cycles from the function, the return branch    * 
*       is issued from within the kernel.                                   * 
*                                                                           * 
*   CYCLES                                                                  * 
*       cycles = 3 * (n / 16) + 15.                                         * 
*       For n = 1072, cycles = 216.                                         * 
*                                                                           * 
*   CODESIZE                                                                * 
*       100 bytes.                                                          * 
*                                                                           * 
* ------------------------------------------------------------------------- * 
*             Copyright (c) 2000 Texas Instruments, Incorporated.           * 
*                            All Rights Reserved.                           * 
* ========================================================================= * 
        .sect ".opt_pix_expand" 
        .global _pix_expand_asm 
 
* ========================================================================= * 
*   End of file:  pix_expand_h.h62                                          * 
* ------------------------------------------------------------------------- * 
*             Copyright (c) 2000 Texas Instruments, Incorporated.           * 
*                            All Rights Reserved.                           * 
* ========================================================================= *