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

📄 16bit.c

📁 MPEG2 PLAYER in linux
💻 C
📖 第 1 页 / 共 2 页
字号:
	    L = L_tab[(int) *lum2++];	    R = L + cr_r;	    G = L + cr_g + cb_g;	    B = L + cb_b;	    *row2++ = (r_2_pix[R] | g_2_pix[G] | b_2_pix[B]);	}        /*         * These values are at the start of the next line, (due         * to the ++'s above),but they need to be at the start         * of the line after that.         */	lum += cols_2 + cols_2;	lum2 += cols_2 + cols_2;	row1 += cols_2 + cols_2;	row2 += cols_2 + cols_2;    }}/* *-------------------------------------------------------------- * * Color32DitherImage -- * *	Converts image into 32 bit color (or 24-bit non-packed). * * Results: *	None. * * Side effects: *	None. * *-------------------------------------------------------------- *//* * This is a copysoft version of the function above with ints instead * of shorts to cause a 4-byte pixel size */voidColor32DitherImage(lum, cr, cb, out, rows, cols)  unsigned char *lum;  unsigned char *cr;  unsigned char *cb;  unsigned char *out;  int cols, rows;{    int L, CR, CB;    unsigned int *row1, *row2;    unsigned char *lum2;    int x, y;    unsigned int r, b, g;    int cr_r;    int cr_g;    int cb_g;    int cb_b;    int cols_2 = cols / 2;    row1 = (unsigned int *)out;    row2 = row1 + cols_2 + cols_2;    lum2 = lum + cols_2 + cols_2;    for (y=0; y<rows; y+=2) {	for (x=0; x<cols_2; x++) {	    int R, G, B;	    CR = *cr++;	    CB = *cb++;	    cr_r = Cr_r_tab[CR];	    cr_g = Cr_g_tab[CR];	    cb_g = Cb_g_tab[CB];	    cb_b = Cb_b_tab[CB];            L = L_tab[(int) *lum++];	    R = L + cr_r;	    G = L + cr_g + cb_g;	    B = L + cb_b;	    *row1++ = (r_2_pix[R] | g_2_pix[G] | b_2_pix[B]);#ifdef INTERPOLATE            if(x != cols_2 - 1) {	      CR = (CR + *cr) >> 1;	      CB = (CB + *cb) >> 1;	      cr_r = Cr_r_tab[CR];	      cr_g = Cr_g_tab[CR];	      cb_g = Cb_g_tab[CB];	      cb_b = Cb_b_tab[CB];            }#endif            L = L_tab[(int) *lum++];	    R = L + cr_r;	    G = L + cr_g + cb_g;	    B = L + cb_b;	    *row1++ = (r_2_pix[R] | g_2_pix[G] | b_2_pix[B]);	    /*	     * Now, do second row.	     */#ifdef INTERPOLATE            if(y != rows - 2) {	      CR = (CR + *(cr + cols_2 - 1)) >> 1;	      CB = (CB + *(cb + cols_2 - 1)) >> 1;	      cr_r = Cr_r_tab[CR];	      cr_g = Cr_g_tab[CR];	      cb_g = Cb_g_tab[CB];	      cb_b = Cb_b_tab[CB];            }#endif	    L = L_tab [(int) *lum2++];	    R = L + cr_r;	    G = L + cr_g + cb_g;	    B = L + cb_b;	    *row2++ = (r_2_pix[R] | g_2_pix[G] | b_2_pix[B]);	    L = L_tab [(int) *lum2++];	    R = L + cr_r;	    G = L + cr_g + cb_g;	    B = L + cb_b;	    *row2++ = (r_2_pix[R] | g_2_pix[G] | b_2_pix[B]);	}	lum += cols_2 + cols_2;	lum2 += cols_2 + cols_2;	row1 += cols_2 + cols_2;	row2 += cols_2 + cols_2;    }}/* * Erik Corry's pixel doubling routines for 15/16/24/32 bit screens. *//* *-------------------------------------------------------------- * * Twox2Color16DitherImage -- * *	Converts image into 16 bit color at double size. * * Results: *	None. * * Side effects: *	None. * *-------------------------------------------------------------- *//* * In this function I make use of a nasty trick. The tables have the lower * 16 bits replicated in the upper 16. This means I can write ints and get * the horisontal doubling for free (almost). */voidTwox2Color16DitherImage(lum, cr, cb, out, rows, cols)  unsigned char *lum;  unsigned char *cr;  unsigned char *cb;  unsigned char *out;  int cols, rows;{    int L, CR, CB;    unsigned int *row1 = (unsigned int *)out;    unsigned int *row2 = row1 + cols;    unsigned int *row3 = row2 + cols;    unsigned int *row4 = row3 + cols;    unsigned char *lum2;    int x, y;    unsigned int r, b, g;    int cr_r;    int cr_g;    int cb_g;    int cb_b;    int cols_2 = cols/2;    lum2 = lum + cols_2 + cols_2;    for (y=0; y<rows; y+=2) {	for (x=0; x<cols_2; x++) {	    int R, G, B;            int t;	    CR = *cr++;	    CB = *cb++;	    cr_r = Cr_r_tab[CR];	    cr_g = Cr_g_tab[CR];	    cb_g = Cb_g_tab[CB];	    cb_b = Cb_b_tab[CB];            L = L_tab[(int) *lum++];	    R = L + cr_r;	    G = L + cr_g + cb_g;	    B = L + cb_b;	    t = (r_2_pix[R] | g_2_pix[G] | b_2_pix[B]);	    row1[0] = t;	    row1++;	    row2[0] = t;	    row2++;#ifdef INTERPOLATE            if(x != cols_2 - 1) {	      CR = (CR + *cr) >> 1;	      CB = (CB + *cb) >> 1;	      cr_r = Cr_r_tab[CR];	      cr_g = Cr_g_tab[CR];	      cb_g = Cb_g_tab[CB];	      cb_b = Cb_b_tab[CB];            }#endif            L = L_tab[(int) *lum++];	    R = L + cr_r;	    G = L + cr_g + cb_g;	    B = L + cb_b;	    t = (r_2_pix[R] | g_2_pix[G] | b_2_pix[B]);	    row1[0] = t;	    row1++;	    row2[0] = t;	    row2++;	    /*	     * Now, do second row.	     */#ifdef INTERPOLATE            if(y != rows - 2) {	      CR = (CR + *(cr + cols_2 - 1)) >> 1;	      CB = (CB + *(cb + cols_2 - 1)) >> 1;	      cr_r = Cr_r_tab[CR];	      cr_g = Cr_g_tab[CR];	      cb_g = Cb_g_tab[CB];	      cb_b = Cb_b_tab[CB];            }#endif	    L = L_tab[(int) *lum2++];	    R = L + cr_r;	    G = L + cr_g + cb_g;	    B = L + cb_b;	    t = (r_2_pix[R] | g_2_pix[G] | b_2_pix[B]);	    row3[0] = t;	    row3++;	    row4[0] = t;	    row4++;	    L = L_tab[(int) *lum2++];	    R = L + cr_r;	    G = L + cr_g + cb_g;	    B = L + cb_b;	    t = (r_2_pix[R] | g_2_pix[G] | b_2_pix[B]);	    row3[0] = t;	    row3++;	    row4[0] = t;	    row4++;	}	lum += cols_2 + cols_2;	lum2 += cols_2 + cols_2;	row1 += 6 * cols_2;	row3 += 6 * cols_2;	row2 += 6 * cols_2;	row4 += 6 * cols_2;    }}/* *-------------------------------------------------------------- * * Twox2Color32 -- * *	Converts image into 24/32 bit color. * * Results: *	None. * * Side effects: *	None. * *-------------------------------------------------------------- */#ifdef SIXTYFOUR_BIT#define ONE_TWO 1#else#define ONE_TWO 2#endifvoidTwox2Color32DitherImage(lum, cr, cb, out, rows, cols)  unsigned char *lum;  unsigned char *cr;  unsigned char *cb;  unsigned char *out;  int cols, rows;{    int L, CR, CB;    unsigned long *row1 = (unsigned long *)out;    unsigned long *row2 = row1 + cols * ONE_TWO;    unsigned long *row3 = row2 + cols * ONE_TWO;    unsigned long *row4 = row3 + cols * ONE_TWO;    unsigned char *lum2;    int x, y;    unsigned int r, b, g;    int cr_r;    int cr_g;    int cb_g;    int cb_b;    int cols_2 = cols/2;    lum2 = lum + cols_2 + cols_2;    for (y=0; y<rows; y+=2) {	for (x=0; x<cols_2; x++) {	    int R, G, B;            long t;	    CR = *cr++;	    CB = *cb++;	    cr_r = Cr_r_tab[CR];	    cr_g = Cr_g_tab[CR];	    cb_g = Cb_g_tab[CB];	    cb_b = Cb_b_tab[CB];            L = L_tab[ (int) *lum++];	    R = L + cr_r;	    G = L + cr_g + cb_g;	    B = L + cb_b;	    t = (r_2_pix[R] | g_2_pix[G] | b_2_pix[B]);	    row1[0] = t;	    row2[0] = t;#ifndef SIXTYFOUR_BIT	    row1[1] = t;	    row2[1] = t;#endif	    row1 += ONE_TWO;	    row2 += ONE_TWO;/* INTERPOLATE is now standard */#ifdef INTERPOLATE            if(x != cols_2 - 1) {	      CR = (CR + *cr) >> 1;	      CB = (CB + *cb) >> 1;	      cr_r = Cr_r_tab[CR];	      cr_g = Cr_g_tab[CR];	      cb_g = Cb_g_tab[CB];	      cb_b = Cb_b_tab[CB];            }#endif/* end INTERPOLATE */            L = L_tab[ (int) *lum++];	    R = L + cr_r;	    G = L + cr_g + cb_g;	    B = L + cb_b;	    t = (r_2_pix[R] | g_2_pix[G] | b_2_pix[B]);	    row1[0] = t;	    row2[0] = t;#ifndef SIXTYFOUR_BIT	    row1[1] = t;	    row2[1] = t;#endif	    row1 += ONE_TWO;	    row2 += ONE_TWO;	    /*	     * Now, do second row.	     *//* INTERPOLATE is now standard */#ifdef INTERPOLATE            if(y != rows - 2) {	      CR = (unsigned int) (CR + *(cr + cols_2 - 1)) >> 1;	      CB = (unsigned int) (CB + *(cb + cols_2 - 1)) >> 1;	      cr_r = Cr_r_tab[CR];	      cr_g = Cr_g_tab[CR];	      cb_g = Cb_g_tab[CB];	      cb_b = Cb_b_tab[CB];            }#endif/* endif */	    L = L_tab[ (int) *lum2++];	    R = L + cr_r;	    G = L + cr_g + cb_g;	    B = L + cb_b;	    t = (r_2_pix[R] | g_2_pix[G] | b_2_pix[B]);	    row3[0] = t;	    row4[0] = t;#ifndef SIXTYFOUR_BIT	    row3[1] = t;	    row4[1] = t;#endif	    row3 += ONE_TWO;	    row4 += ONE_TWO;	    L = L_tab[(int) *lum2++];	    R = L + cr_r;	    G = L + cr_g + cb_g;	    B = L + cb_b;	    t = (r_2_pix[R] | g_2_pix[G] | b_2_pix[B]);	    row3[0] = t;	    row4[0] = t;#ifndef SIXTYFOUR_BIT	    row3[1] = t;	    row4[1] = t;#endif	    row3 += ONE_TWO;	    row4 += ONE_TWO;	}	lum += cols_2 + cols_2;	lum2 += cols_2 + cols_2;	row1 += ONE_TWO * 6 *cols_2;	row3 += ONE_TWO * 6 *cols_2;	row2 += ONE_TWO * 6 *cols_2;	row4 += ONE_TWO * 6 *cols_2;    }}

⌨️ 快捷键说明

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