home *** CD-ROM | disk | FTP | other *** search
/ Graphics 16,000 / graphics-16000.iso / amiga / mpeg / mpgplyr1.lha / src / gray.c < prev    next >
C/C++ Source or Header  |  1992-12-08  |  2KB  |  62 lines

  1. /*
  2.  * Copyright (c) 1992 The Regents of the University of California.
  3.  * All rights reserved.
  4.  * 
  5.  * Permission to use, copy, modify, and distribute this software and its
  6.  * documentation for any purpose, without fee, and without written agreement is
  7.  * hereby granted, provided that the above copyright notice and the following
  8.  * two paragraphs appear in all copies of this software.
  9.  * 
  10.  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
  11.  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  12.  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13.  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14.  * 
  15.  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16.  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17.  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18.  * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19.  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20.  */
  21.  
  22. #include "video.h"
  23. #include "dither.h"
  24.  
  25.  
  26. /*
  27.  *--------------------------------------------------------------
  28.  *
  29.  * GrayDitherImage --
  30.  *
  31.  *    Dithers image into 128 gray scales. Simply maps luminance
  32.  *      value into 1 of 128 gray scale colors (divide by two, essentially).
  33.  *
  34.  * Results:
  35.  *    None.
  36.  *
  37.  * Side effects:
  38.  *    None.
  39.  *
  40.  *--------------------------------------------------------------
  41.  */
  42.  
  43. void
  44. GrayDitherImage(lum, cr, cb, out, h, w)
  45.     unsigned char *lum;
  46.     unsigned char *cr;
  47.     unsigned char *cb;
  48.     unsigned char *out;
  49.     int w, h;
  50. {
  51.  
  52.   for (w*=h; w>0; w--) {
  53.     *out++ = pixel[*lum++];
  54.   }
  55. }
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.