LCOV - code coverage report
Current view: directory - media/libjpeg - jdcolext.c (source / functions) Found Hit Coverage
Test: app.info Lines: 35 0 0.0 %
Date: 2012-06-02 Functions: 14 0 0.0 %

       1                 : /*
       2                 :  * jdcolext.c
       3                 :  *
       4                 :  * Copyright (C) 1991-1997, Thomas G. Lane.
       5                 :  * Copyright (C) 2009, 2011, D. R. Commander.
       6                 :  * This file is part of the Independent JPEG Group's software.
       7                 :  * For conditions of distribution and use, see the accompanying README file.
       8                 :  *
       9                 :  * This file contains output colorspace conversion routines.
      10                 :  */
      11                 : 
      12                 : 
      13                 : /* This file is included by jdcolor.c */
      14                 : 
      15                 : 
      16                 : /*
      17                 :  * Convert some rows of samples to the output colorspace.
      18                 :  *
      19                 :  * Note that we change from noninterleaved, one-plane-per-component format
      20                 :  * to interleaved-pixel format.  The output buffer is therefore three times
      21                 :  * as wide as the input buffer.
      22                 :  * A starting row offset is provided only for the input buffer.  The caller
      23                 :  * can easily adjust the passed output_buf value to accommodate any row
      24                 :  * offset required on that side.
      25                 :  */
      26                 : 
      27                 : INLINE
      28                 : LOCAL(void)
      29               0 : ycc_rgb_convert_internal (j_decompress_ptr cinfo,
      30                 :                           JSAMPIMAGE input_buf, JDIMENSION input_row,
      31                 :                           JSAMPARRAY output_buf, int num_rows)
      32                 : {
      33               0 :   my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
      34                 :   register int y, cb, cr;
      35                 :   register JSAMPROW outptr;
      36                 :   register JSAMPROW inptr0, inptr1, inptr2;
      37                 :   register JDIMENSION col;
      38               0 :   JDIMENSION num_cols = cinfo->output_width;
      39                 :   /* copy these pointers into registers if possible */
      40               0 :   register JSAMPLE * range_limit = cinfo->sample_range_limit;
      41               0 :   register int * Crrtab = cconvert->Cr_r_tab;
      42               0 :   register int * Cbbtab = cconvert->Cb_b_tab;
      43               0 :   register INT32 * Crgtab = cconvert->Cr_g_tab;
      44               0 :   register INT32 * Cbgtab = cconvert->Cb_g_tab;
      45                 :   SHIFT_TEMPS
      46                 : 
      47               0 :   while (--num_rows >= 0) {
      48               0 :     inptr0 = input_buf[0][input_row];
      49               0 :     inptr1 = input_buf[1][input_row];
      50               0 :     inptr2 = input_buf[2][input_row];
      51               0 :     input_row++;
      52               0 :     outptr = *output_buf++;
      53               0 :     for (col = 0; col < num_cols; col++) {
      54               0 :       y  = GETJSAMPLE(inptr0[col]);
      55               0 :       cb = GETJSAMPLE(inptr1[col]);
      56               0 :       cr = GETJSAMPLE(inptr2[col]);
      57                 :       /* Range-limiting is essential due to noise introduced by DCT losses. */
      58               0 :       outptr[RGB_RED] =   range_limit[y + Crrtab[cr]];
      59               0 :       outptr[RGB_GREEN] = range_limit[y +
      60               0 :                               ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
      61                 :                                                  SCALEBITS))];
      62               0 :       outptr[RGB_BLUE] =  range_limit[y + Cbbtab[cb]];
      63                 :       /* Set unused byte to 0xFF so it can be interpreted as an opaque */
      64                 :       /* alpha channel value */
      65                 : #ifdef RGB_ALPHA
      66               0 :       outptr[RGB_ALPHA] = 0xFF;
      67                 : #endif
      68               0 :       outptr += RGB_PIXELSIZE;
      69                 :     }
      70                 :   }
      71               0 : }
      72                 : 
      73                 : 
      74                 : /*
      75                 :  * Convert grayscale to RGB: just duplicate the graylevel three times.
      76                 :  * This is provided to support applications that don't want to cope
      77                 :  * with grayscale as a separate case.
      78                 :  */
      79                 : 
      80                 : INLINE
      81                 : LOCAL(void)
      82               0 : gray_rgb_convert_internal (j_decompress_ptr cinfo,
      83                 :                            JSAMPIMAGE input_buf, JDIMENSION input_row,
      84                 :                            JSAMPARRAY output_buf, int num_rows)
      85                 : {
      86                 :   register JSAMPROW inptr, outptr;
      87                 :   register JDIMENSION col;
      88               0 :   JDIMENSION num_cols = cinfo->output_width;
      89                 : 
      90               0 :   while (--num_rows >= 0) {
      91               0 :     inptr = input_buf[0][input_row++];
      92               0 :     outptr = *output_buf++;
      93               0 :     for (col = 0; col < num_cols; col++) {
      94                 :       /* We can dispense with GETJSAMPLE() here */
      95               0 :       outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col];
      96                 :       /* Set unused byte to 0xFF so it can be interpreted as an opaque */
      97                 :       /* alpha channel value */
      98                 : #ifdef RGB_ALPHA
      99               0 :       outptr[RGB_ALPHA] = 0xFF;
     100                 : #endif
     101               0 :       outptr += RGB_PIXELSIZE;
     102                 :     }
     103                 :   }
     104               0 : }

Generated by: LCOV version 1.7