www.pudn.com > scaling.rar > scale_h2_h.h


/* ======================================================================== */
/*  NAME                                                                    */
/*      scale_h2 -- Horizontal scaling by 2                                 */
/*S                                                                        S*/
/*S AUTHOR                                                                 S*/
/*S     J. Sankaran                                                        S*/
/*S                                                                        S*/
/*S REVISION HISTORY                                                       S*/
/*S     02-Feb-2002  Initial revision of code  . . . . .  J.Sankaran       S*/
/*                                                                          */
/*  USAGE                                                                   */
/*      This routine has the following C prototype:                         */
/*                                                                          */
/*      void scale_h2_cn(                                                   */
/*                           const unsigned char *restrict inp,             */
/*                           int   cols,                                    */
/*                           unsigned char *restrict outp                   */
/*                       )                                                  */
/*                                                                          */
/*                                                                          */
/*      The scale_h2 function accepts an input array "inp" that contains    */
/*      "cols" contiguous pixels and produces an output array "outp" of     */
/*      "cols/2" pixels. Simple averaging and rounding are performed.       */
/*      This step may also be viewed as simple bi-linear interpolation.     */
/*                                                                          */
/*  DESCRIPTION                                                             */
/*      The following C code model shows the behaviour of the code.         */
/*                                                                          */
/*      void scale_h2_cn(                                                   */
/*                         const unsigned char *restrict inp,               */
/*                         int   cols,                                      */
/*                         unsigned char *restrict outp                     */
/*                       )                                                  */
/*       {                                                                  */
/*           int i;                                                         */
/*                                                                          */
/*           for( i = 0; i < (cols >> 1); i++)                              */
/*           {                                                              */
/*               outp[i] = (inp[2*i] + inp[(2*i)+1] + 1) >> 1;              */
/*           }                                                              */
/*       }                                                                  */
/*                                                                          */
/*     Every two consecutive pixels of the input image are averaged to      */
/*     form an output pixel.                                                */
/*                                                                          */
/*  TECHNIQUES                                                              */
/*     This code can be used to process either one line, or an arbitrary    */
/*     number of lines as long as they are contiguous in memory.            */
/*                                                                          */
/*  ASSUMPTIONS                                                             */
/*     The input array is aligned on a double-word boundary. The output     */
/*     array is aligned on a double word boundary. The number of input      */
/*     pixels is a multiple of 32.                                          */
/*                                                                          */
/*  NOTES                                                                   */
/*    None                                                                  */
/*                                                                          */
/*  SOURCE                                                                  */
/*    None                                                                  */
/*                                                                          */
/*  MEMORY NOTE                                                             */
/*     No bank conflcits should occurr irrespective of the alignemt of      */
/*     the arrays in memory.                                                */
/*                                                                          */
/*  INTERRUPT NOTE                                                          */
/*     This code is interrupt tolerant though not interruptible.            */
/*                                                                          */
/*  CYCLES                                                                  */
/*     (5*cols)/32 - 5                                                      */
/*                                                                          */
/*  cols = 640,  cycles = 95.                                               */
/*                                                                          */
/* ------------------------------------------------------------------------ */
/*            Copyright (c) 2002 Texas Instruments, Incorporated.           */
/*                           All Rights Reserved.                           */
/* ======================================================================== */

#ifndef SCALE_H2_H_H_
#define SCALE_H2_H_H_ 1

void scale_h2_sa(
                    const unsigned char *restrict inp,
                    int cols,
                    unsigned char *restrict outp
                );

#endif

/* ======================================================================== */
/*  End of file:  scale_h2_h.h                                              */
/* ------------------------------------------------------------------------ */
/*            Copyright (c) 2002 Texas Instruments, Incorporated.           */
/*                           All Rights Reserved.                           */
/* ======================================================================== */