Changeset 636df0d7bc8d467c915436684e3fb5580e53255f
- Timestamp:
- 01/31/04 06:53:35 (5 years ago)
- git-parent:
- Files:
-
- modules/codec/ogt/Modules.am (modified) (1 diff)
- modules/codec/ogt/common.c (modified) (1 diff)
- modules/codec/ogt/pixmap.c (modified) (8 diffs)
- modules/codec/ogt/pixmap.h (modified) (4 diffs)
- modules/codec/ogt/render.c (modified) (12 diffs)
- modules/video_chroma/i420_rgb.c (modified) (4 diffs)
- modules/video_chroma/i420_rgb.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/codec/ogt/Modules.am
r5dab5a0 r636df0d 21 21 subtitle.h \ 22 22 cvd_parse.c \ 23 pixmap.c \ 23 24 pixmap.h \ 24 25 render.c \ modules/codec/ogt/common.c
r5dab5a0 r636df0d 1 1 /***************************************************************************** 2 * Common SVCD and VCD subtitle routines.2 * Common SVCD and CVD subtitle routines. 3 3 ***************************************************************************** 4 4 * Copyright (C) 2003, 2004 VideoLAN 5 * $Id: common.c,v 1.1 1 2004/01/30 13:17:12rocky Exp $5 * $Id: common.c,v 1.12 2004/01/31 05:53:35 rocky Exp $ 6 6 * 7 7 * Author: Rocky Bernstein <rocky@panix.com> modules/codec/ogt/pixmap.c
r1a86038 r636df0d 3 3 ***************************************************************************** 4 4 * Copyright (C) 2003, 2004 VideoLAN 5 * $Id: pixmap.c,v 1. 2 2004/01/30 13:23:08rocky Exp $5 * $Id: pixmap.c,v 1.3 2004/01/31 05:53:35 rocky Exp $ 6 6 * 7 7 * Author: Rocky Bernstein … … 51 51 p_rgb_b[i]) 52 52 */ 53 uint 8_t *p_rgb_r;/* Red values of palette */54 uint 8_t *p_rgb_g;/* Green values of palette */55 uint 8_t *p_rgb_b;/* Blue values of palette */53 uint16_t p_rgb_r[CMAP_RGB2_SIZE]; /* Red values of palette */ 54 uint16_t p_rgb_g[CMAP_RGB2_SIZE]; /* Green values of palette */ 55 uint16_t p_rgb_b[CMAP_RGB2_SIZE]; /* Blue values of palette */ 56 56 }; 57 57 58 59 /* Number of entries in RGB palette/colormap*/60 #define CMAP_SIZE 25661 58 62 59 /* … … 111 108 /** 112 109 Find the nearest colormap entry in p_vout (assumed to have RGB2 113 chroma, i.e. 256 RGB entries) that is closest in color to p_yuv. Set114 RGB to the color found and return the colormap index. -1 is returned115 if there is some error.110 chroma, i.e. 256 RGB 8bpp entries) that is closest in color to p_rgb. Set 111 out_rgb to the color found and return the colormap index. 112 INVALID_CMAP_ENTRY is returned if there is some error. 116 113 117 114 The closest match is determined by the the Euclidean distance … … 122 119 */ 123 120 124 int125 find_cmap_rgb8_nearest(const vout_thread_t *p_vout, const ogt_yuvt_t *p_yuv,121 cmap_t 122 find_cmap_rgb8_nearest(const vout_thread_t *p_vout, const uint8_t *rgb, 126 123 uint8_t *out_rgb) 127 124 { 128 uint8_t *p_cmap_r; 129 uint8_t *p_cmap_g; 130 uint8_t *p_cmap_b; 131 uint8_t rgb[RGB_SIZE]; 125 uint16_t *p_cmap_r; 126 uint16_t *p_cmap_g; 127 uint16_t *p_cmap_b; 132 128 133 129 int i; 134 int i_bestmatch=0;130 cmap_t i_bestmatch = INVALID_CMAP_ENTRY; 135 131 uint32_t i_mindist = 0xFFFFFFFF; /* The largest number here. */ 136 132 … … 138 134 139 135 if ( !p_vout && p_vout->output.i_chroma != VLC_FOURCC('R','G','B','2') ) 140 return -1;136 return INVALID_CMAP_ENTRY; 141 137 142 138 p_cmap_r=p_vout->chroma.p_sys->p_rgb_r; … … 144 140 p_cmap_b=p_vout->chroma.p_sys->p_rgb_b; 145 141 146 yuv2rgb(p_yuv, rgb); 147 148 for (i = 0; i < CMAP_SIZE; i++) { 142 for (i = 0; i < CMAP_RGB2_SIZE; i++) { 149 143 /* Interval range calculations to show that we don't overflow the 150 144 word sizes below. pixels component values start out 8 … … 171 165 #define int32_sqr(x) ( ((int32_t) (x)) * ((int32_t) x) ) 172 166 173 uint32_t dr = ( RED_COEF * ( int32_sqr(rgb[RED_PIXEL] - p_cmap_r[i]) 167 /* colormap entires are scaled to 16 bits, so we need to shift 168 them back down to 8. */ 169 #define CMAP8_RED(i) (p_cmap_r[i]>>8) 170 #define CMAP8_GREEN(i) (p_cmap_g[i]>>8) 171 #define CMAP8_BLUE(i) (p_cmap_b[i]>>8) 172 173 uint32_t dr = ( RED_COEF * ( int32_sqr(rgb[RED_PIXEL] - CMAP8_RED(i)) 174 174 << SCALEBITS ) ) >> (SCALEBITS*2); 175 uint32_t dg = ( GREEN_COEF * ( int32_sqr(rgb[GREEN_PIXEL] - p_cmap_g[i])175 uint32_t dg = ( GREEN_COEF * ( int32_sqr(rgb[GREEN_PIXEL] - CMAP8_GREEN(i)) 176 176 << SCALEBITS ) ) >> (SCALEBITS*2); 177 uint32_t db = ( BLUE_COEF * ( int32_sqr(rgb[BLUE_PIXEL] - p_cmap_b[i])178 << SCALEBITS ) ) >> (SCALEBITS*2);177 uint32_t db = ( BLUE_COEF * ( int32_sqr(rgb[BLUE_PIXEL] - CMAP8_BLUE(i)) 178 << SCALEBITS ) ) >> (SCALEBITS*2); 179 179 180 180 uint32_t i_dist = dr + dg + db; … … 182 182 i_bestmatch = i; 183 183 i_mindist = i_dist; 184 #if 0 185 printf("+++Change dist to %d RGB cmap %d (%0x, %0x, %0x)\n", 186 i_dist, i, p_cmap_r[ i ], p_cmap_g[ i ], p_cmap_b[ i ]); 187 #endif 184 188 } 185 189 } 186 190 187 out_rgb[RED_PIXEL] = p_cmap_r[i_bestmatch]; 188 out_rgb[GREEN_PIXEL] = p_cmap_g[i_bestmatch]; 189 out_rgb[BLUE_PIXEL] = p_cmap_b[i_bestmatch]; 191 if (out_rgb) 192 { 193 out_rgb[RED_PIXEL] = CMAP8_RED(i_bestmatch); 194 out_rgb[GREEN_PIXEL] = CMAP8_GREEN(i_bestmatch); 195 out_rgb[BLUE_PIXEL] = CMAP8_BLUE(i_bestmatch); 196 } 190 197 191 198 return i_bestmatch; 199 } 200 201 /** 202 Get the the rgb value for a given colormap entry for p_vout (which is' 203 assumed to have RGB2 chroma). 204 205 VLC_FALSE is returned if there was some error. 206 */ 207 vlc_bool_t 208 query_color(const vout_thread_t *p_vout, cmap_t i_cmap, 209 /*out*/ uint8_t *out_rgb) 210 { 211 uint16_t *p_cmap_r; 212 uint16_t *p_cmap_g; 213 uint16_t *p_cmap_b; 214 215 /* Check that we really have RGB2. */ 216 217 if ( !p_vout && p_vout->output.i_chroma != VLC_FOURCC('R','G','B','2') ) 218 return VLC_FALSE; 219 220 if ( !out_rgb ) 221 return VLC_FALSE; 222 223 p_cmap_r=p_vout->chroma.p_sys->p_rgb_r; 224 p_cmap_g=p_vout->chroma.p_sys->p_rgb_g; 225 p_cmap_b=p_vout->chroma.p_sys->p_rgb_b; 226 227 out_rgb[RED_PIXEL] = CMAP8_RED(i_cmap); 228 out_rgb[GREEN_PIXEL] = CMAP8_GREEN(i_cmap); 229 out_rgb[BLUE_PIXEL] = CMAP8_BLUE(i_cmap); 230 231 return VLC_TRUE; 192 232 } 193 233 modules/codec/ogt/pixmap.h
r5dab5a0 r636df0d 3 3 ***************************************************************************** 4 4 * Copyright (C) 2003, 2004 VideoLAN 5 * $Id: pixmap.h,v 1. 4 2004/01/30 13:17:12rocky Exp $5 * $Id: pixmap.h,v 1.5 2004/01/31 05:53:35 rocky Exp $ 6 6 * 7 7 * Author: Rocky Bernstein … … 36 36 } s; 37 37 } ogt_yuvt_t; 38 39 /** An undefined or invalid colormap index. */ 40 #define INVALID_CMAP_ENTRY -1 41 42 /** Type of a palette/colormap index*/ 43 typedef int16_t cmap_t; 44 45 /** Number of entries in RGB palette/colormap*/ 46 #define CMAP_RGB2_SIZE 256 38 47 39 48 /** … … 114 123 */ 115 124 static inline void 116 put_rgb24_pixel(const uint8_t *rgb, uint8_t *p_pixel)125 put_rgb24_pixel(const uint8_t *rgb, /*out*/ uint8_t *p_pixel) 117 126 { 118 127 #ifdef WORDS_BIGENDIAN … … 125 134 126 135 /** 127 Find the nearest colormap entry in p_vout (assumed to have RGB2128 chroma, i.e. 256 RGB entries) that is closest in color to p_yuv. Set129 rgb to the color found and return the colormap index. -1 is returned130 if there is some error.136 Find the nearest colormap entry in p_vout (assumed to have RGB2 137 chroma, i.e. 256 RGB 8bpp entries) that is closest in color to p_rgb. Set 138 out_rgb to the color found and return the colormap index. 139 INVALID_CMAP_ENTRY is returned if there is some error. 131 140 */ 132 int 133 find_cmap_nearest(const vout_thread_t *p_vout, const ogt_yuvt_t *p_yuv, 134 uint8_t *rgb); 141 cmap_t 142 find_cmap_rgb8_nearest(const vout_thread_t *p_vout, const uint8_t *p_rgb, 143 /*out*/ uint8_t *out_rgb); 144 145 /** 146 Get the the rgb value for a given colormap entry for p_vout (which is' 147 assumed to have RGB2 chroma). 148 149 VLC_FALSE is returned if there was some error. 150 */ 151 vlc_bool_t 152 query_color(const vout_thread_t *p_vout, cmap_t i_cmap, 153 /*out*/ uint8_t *rgb); 135 154 136 155 #endif /* PIXMAP_H */ modules/codec/ogt/render.c
rafd56ce r636df0d 3 3 ***************************************************************************** 4 4 * Copyright (C) 2003, 2004 VideoLAN 5 * $Id: render.c,v 1.2 6 2004/01/29 11:50:22rocky Exp $5 * $Id: render.c,v 1.27 2004/01/31 05:53:35 rocky Exp $ 6 6 * 7 7 * Author: Rocky Bernstein <rocky@panix.com> … … 26 26 *****************************************************************************/ 27 27 28 /*#define TESTING_ BLENDING1*/28 /*#define TESTING_TRANSPARENCY 1*/ 29 29 30 30 /***************************************************************************** … … 236 236 } 237 237 238 #ifdef TESTING_ BLENDING238 #ifdef TESTING_TRANSPARENCY 239 239 if (p_source->s.t == MAX_ALPHA) p_source->s.t >>= 1; 240 240 #endif … … 435 435 i_avg_tr = ( p_source->s.t + (p_source+1)->s.t ) / 2; 436 436 437 #ifdef TESTING_ BLENDING437 #ifdef TESTING_TRANSPARENCY 438 438 if (i_avg_tr == MAX_ALPHA) i_avg_tr >>= 1; 439 439 #endif … … 802 802 } 803 803 804 #ifdef TESTING_ BLENDING804 #ifdef TESTING_TRANSPARENCY 805 805 if (p_source->s.t == MAX_ALPHA) p_source->s.t >>= 1; 806 806 #endif … … 1111 1111 } 1112 1112 1113 #ifdef TESTING_ BLENDING1113 #ifdef TESTING_TRANSPARENCY 1114 1114 if (p_source->s.t == MAX_ALPHA) p_source->s.t >>= 2; 1115 1115 #endif … … 1575 1575 } 1576 1576 1577 /* 1578 Return the colormap index for the average of p_pixel and a subtitle 1579 pixel in RGB form. 1580 */ 1581 static inline cmap_t 1582 avg_rgb2(const vout_thread_t *p_vout, uint8_t i_pixel, cmap_t i_cmap_sub, 1583 const uint8_t rgb_sub[] ) 1584 { 1585 uint8_t rgb_vout[RGB_SIZE]; 1586 static cmap_t avg_cache[CMAP_RGB2_SIZE][NUM_SUBTITLE_COLORS]; 1587 static vlc_bool_t b_first_time = VLC_TRUE; 1588 int i; 1589 1590 /* FIXME: really we need to save subtitle number since in theory 1591 the palette can change each on each distinct subtitle. In practice 1592 this doesn't happen that much. 1593 */ 1594 if (b_first_time) 1595 { 1596 int i, j; 1597 for (i=0; i<CMAP_RGB2_SIZE; i++) 1598 for (j=0; j<NUM_SUBTITLE_COLORS; j++) 1599 avg_cache[i][j] = INVALID_CMAP_ENTRY; 1600 } 1601 1602 if ( avg_cache[i_pixel][i_cmap_sub] != INVALID_CMAP_ENTRY ) 1603 return avg_cache[i_pixel][i_cmap_sub]; 1604 1605 if ( !query_color(p_vout, i_pixel, rgb_vout) ) return INVALID_CMAP_ENTRY; 1606 1607 for (i = 0; i < RGB_SIZE; i++) 1608 { 1609 rgb_vout[i] = (rgb_vout[i] + rgb_sub[i]) / 2; 1610 } 1611 1612 #if 0 1613 { 1614 uint8_t rgb_approx[RGB_SIZE]; 1615 1616 avg_cache[i_pixel][i_cmap_sub] = 1617 find_cmap_rgb8_nearest(p_vout, rgb_vout, rgb_approx); 1618 printf( 1619 "cmap old %0x new 0%x sub=(%0x, %0x, %0x) " 1620 "avg=(%0x, %0x, %0x) vout=(%0x, %0x, %0x)\n", 1621 i_pixel, i_cmap, 1622 rgb_sub[RED_PIXEL], rgb_sub[GREEN_PIXEL], rgb_sub[BLUE_PIXEL], 1623 rgb_approx[RED_PIXEL], rgb_approx[GREEN_PIXEL], rgb_approx[BLUE_PIXEL], 1624 rgb_vout[RED_PIXEL], rgb_vout[GREEN_PIXEL], rgb_vout[BLUE_PIXEL]); 1625 } 1626 #else 1627 avg_cache[i_pixel][i_cmap_sub] = 1628 find_cmap_rgb8_nearest(p_vout, rgb_vout, NULL); 1629 #endif 1630 return avg_cache[i_pixel][i_cmap_sub]; 1631 } 1632 1577 1633 #undef BYTES_PER_PIXEL 1578 1634 #define BYTES_PER_PIXEL 1 … … 1602 1658 int i_x_start, i_y_start, i_x_end, i_y_end; 1603 1659 1604 /* 4 entry colormap*/1660 /* 4-entry array of colormap indices */ 1605 1661 uint8_t cmap[NUM_SUBTITLE_COLORS]; 1606 int i_cmap; 1662 int i; 1663 1664 /* Actual RGB values for above; this is used in blending.*/ 1665 uint8_t cmap_rgb[NUM_SUBTITLE_COLORS][RGB_SIZE]; 1607 1666 1608 1667 struct subpicture_sys_t *p_sys = p_spu->p_sys; … … 1612 1671 &i_aspect_x ); 1613 1672 1614 /* Find a corresponding colormap entries for our palette entries. */1615 for( i_cmap = 0; i_cmap < NUM_SUBTITLE_COLORS; i_cmap++ )1616 {1617 uint8_t Y = p_sys->p_palette[i_cmap].s.y;1618 1619 /* FIXME: when we have a way to look at colormap entries we can1620 do better. For now we have to use 0xff for white 0x00 for1621 black and 0x44 for something in between. To do this we use1622 only the Y component.1623 */1624 if (Y > 0x70)1625 cmap[i_cmap] = 0xff; /* Use white. */1626 else if (Y < 0x10)1627 cmap[i_cmap] = 0x00; /* Use black. */1628 else1629 cmap[i_cmap] = 0x44; /* Use something else. */1630 }1631 1632 1673 i_xscale = (( p_vout->output.i_width << ASCALE ) * i_aspect_x) 1633 1674 / (i_aspect_y * p_vout->render.i_width); … … 1644 1685 i_width = p_spu->i_width * i_xscale; 1645 1686 i_height = p_spu->i_height * i_yscale; 1687 1688 1689 /** FIXME: do once per subtitle in subtitle processing, not here 1690 each time we render. */ 1691 /* Find a corresponding colormap entries for our palette entries. */ 1692 for( i = 0; i < NUM_SUBTITLE_COLORS; i++ ) 1693 { 1694 1695 if ( p_sys->p_palette[i].s.t != 0 ) { 1696 uint8_t rgb[RGB_SIZE]; 1697 uint8_t approx_rgb[RGB_SIZE]; 1698 yuv2rgb(&(p_sys->p_palette[i]), rgb); 1699 cmap[i] = 1700 find_cmap_rgb8_nearest(p_vout, rgb, approx_rgb); 1701 dbg_print( (DECODE_DBG_RENDER), 1702 "palette %d RGB=(%0x, %0x, %0x)\n", i, 1703 rgb[RED_PIXEL], rgb[GREEN_PIXEL], rgb[BLUE_PIXEL]); 1704 } 1705 } 1646 1706 1647 1707 /* Set where we will start blending subtitle from using … … 1707 1767 1708 1768 p_yuvt = p_sys->p_palette[*p_source & 0x3]; 1709 if ( (p_yuvt.s.t) < (MAX_ALPHA) / 2 ) { 1710 /* Completely or relatively transparent. Don't change pixel. */ 1711 ; 1769 1770 #ifdef TESTING_TRANSPARENCY 1771 if (p_yuvt.s.t == MAX_ALPHA) p_yuvt.s.t >>= 1; 1772 #endif 1773 1774 switch ( p_yuvt.s.t ) 1775 { 1776 case 0: 1777 /* Completely transparent. Don't change pixel. */ 1712 1778 #if 0 1713 printf(" "); /*++++*/ 1714 #endif 1715 } else { 1716 uint32_t i_xdest = ( ((i_x*i_xscale) >> ASCALE) 1717 * BYTES_PER_PIXEL ); 1718 uint32_t i_xlast = ( (((i_x+1)*i_xscale) >> ASCALE) 1719 * BYTES_PER_PIXEL ); 1720 /* This is the pixel that's going to change;*/ 1721 uint8_t *p_dest = p_pixel_base_y + i_xdest; 1722 memset( p_dest, cmap[*p_source & 0x3], i_xlast - i_xdest ); 1779 printf(" "); /*++++*/ 1780 #endif 1781 break; 1782 case MAX_ALPHA: 1783 { 1784 uint32_t i_xdest = ( ((i_x*i_xscale) >> ASCALE) 1785 * BYTES_PER_PIXEL ); 1786 uint32_t i_xlast = ( (((i_x+1)*i_xscale) >> ASCALE) 1787 * BYTES_PER_PIXEL ); 1788 /* This is the pixel that's going to change;*/ 1789 uint8_t *p_dest = p_pixel_base_y + i_xdest; 1790 memset( p_dest, cmap[*p_source & 0x3], i_xlast - i_xdest ); 1723 1791 #if 0 1724 printf("%1d", *p_source); /*++++*/ 1725 #endif 1726 } 1727 1792 printf("%1d", *p_source); /*++++*/ 1793 #endif 1794 break; 1795 } 1796 default: 1797 { 1798 uint32_t i_xdest = ( ((i_x*i_xscale) >> ASCALE) 1799 * BYTES_PER_PIXEL ); 1800 uint32_t i_xlast = ( (((i_x+1)*i_xscale) >> ASCALE) 1801 * BYTES_PER_PIXEL ); 1802 /* This is the pixel that's going to change;*/ 1803 uint8_t *p_pixel = p_pixel_base_y + i_xdest; 1804 uint32_t len = i_xlast - i_xdest; 1805 1806 for ( len = i_xlast - i_xdest -1; len >= 0; len-- ) 1807 { 1808 cmap_t i_cmap = avg_rgb2(p_vout, *p_pixel, 1809 cmap[*p_source], 1810 cmap_rgb[*p_source]); 1811 if (i_cmap != INVALID_CMAP_ENTRY) 1812 *p_pixel= (uint8_t) i_cmap; 1813 p_pixel++; 1814 } 1815 #if 0 1816 printf("%1d", *p_source); /*++++*/ 1817 #endif 1818 } 1819 } 1728 1820 } 1729 1821 #if 0 … … 1759 1851 } 1760 1852 1761 if ( (p_yuvt.s.t) < (MAX_ALPHA) / 2 ) { 1762 /* Completely or relatively transparent. Don't change pixel. */ 1763 ; 1853 #ifdef TESTING_TRANSPARENCY 1854 if (p_yuvt.s.t == MAX_ALPHA) p_yuvt.s.t >>= 1; 1855 #endif 1856 switch ( p_yuvt.s.t ) 1857 { 1858 case 0: 1859 /* Completely transparent. Don't change pixel. */ 1764 1860 #if 0 1765 printf(" "); /*++++*/ 1766 #endif 1767 } else { 1768 uint32_t i_xdest = ( ((i_x*i_xscale) >> ASCALE) 1769 * BYTES_PER_PIXEL ); 1770 uint32_t i_xlast = ( (((i_x+1)*i_xscale) >> ASCALE) 1771 * BYTES_PER_PIXEL ); 1772 uint32_t len = i_xlast - i_xdest; 1861 printf(" "); /*++++*/ 1862 #endif 1863 break; 1864 case MAX_ALPHA: 1865 { 1866 uint32_t i_xdest = ( ((i_x*i_xscale) >> ASCALE) 1867 * BYTES_PER_PIXEL ); 1868 uint32_t i_xlast = ( (((i_x+1)*i_xscale) >> ASCALE) 1869 * BYTES_PER_PIXEL ); 1870 uint32_t len = i_xlast - i_xdest; 1773 1871 #if 0 1774 printf("%1d", *p_source); /*++++*/ 1775 #endif 1776 for( i_ytmp = i_yreal ; i_ytmp < i_ynext ; 1777 i_ytmp += p_pic->p->i_pitch ) { 1778 uint8_t *p_dest = p_pixel_base + i_ytmp + i_xdest; 1779 memset( p_dest, cmap[*p_source & 0x3], len ); 1872 printf("%1d", *p_source); /*++++*/ 1873 #endif 1874 for( i_ytmp = i_yreal ; i_ytmp < i_ynext ; 1875 i_ytmp += p_pic->p->i_pitch ) { 1876 uint8_t *p_dest = p_pixel_base + i_ytmp + i_xdest; 1877 memset( p_dest, cmap[*p_source & 0x3], len ); 1878 } 1879 break; 1880 } 1881 default: 1882 { 1883 uint32_t i_xdest = ( ((i_x*i_xscale) >> ASCALE) 1884 * BYTES_PER_PIXEL ); 1885 uint32_t i_xlast = ( (((i_x+1)*i_xscale) >> ASCALE) 1886 * BYTES_PER_PIXEL ); 1887 int32_t len; 1888 #if 0 1889 printf("%1d", *p_source); /*++++*/ 1890 #endif 1891 1892 for( i_ytmp = i_yreal ; i_ytmp < i_ynext ; 1893 i_ytmp += p_pic->p->i_pitch ) { 1894 /* This is the pixel that's going to change;*/ 1895 uint8_t *p_pixel = p_pixel_base + i_ytmp + i_xdest; 1896 for ( len = i_xlast - i_xdest -1; len >= 0; len-- ) 1897 { 1898 cmap_t i_cmap = avg_rgb2(p_vout, *p_pixel, 1899 cmap[*p_source], 1900 cmap_rgb[*p_source]); 1901 if (i_cmap != INVALID_CMAP_ENTRY) 1902 *p_pixel= (uint8_t) i_cmap; 1903 p_pixel++; 1904 } 1905 } 1906 } 1780 1907 } 1781 } 1782 } 1783 1908 } 1784 1909 } 1785 1910 } modules/video_chroma/i420_rgb.c
r5ca0ebc r636df0d 2 2 * i420_rgb.c : YUV to bitmap RGB conversion module for vlc 3 3 ***************************************************************************** 4 * Copyright (C) 2000, 2001 VideoLAN5 * $Id: i420_rgb.c,v 1. 6 2003/12/22 14:32:56 samExp $4 * Copyright (C) 2000, 2001, 2004 VideoLAN 5 * $Id: i420_rgb.c,v 1.7 2004/01/31 05:53:35 rocky Exp $ 6 6 * 7 7 * Author: Sam Hocevar <sam@zoy.org> … … 345 345 int r,g,b; 346 346 int i = 0, j = 0; 347 uint16_t red[ 256 ], green[ 256 ], blue[ 256 ]; 347 uint16_t *p_cmap_r=p_vout->chroma.p_sys->p_rgb_r; 348 uint16_t *p_cmap_g=p_vout->chroma.p_sys->p_rgb_g; 349 uint16_t *p_cmap_b=p_vout->chroma.p_sys->p_rgb_b; 350 348 351 unsigned char p_lookup[PALETTE_TABLE_SIZE]; 349 352 … … 372 375 373 376 /* Clip the colors */ 374 red[ j ] = CLIP( r ); 375 green[ j ] = CLIP( g ); 376 blue[ j ] = CLIP( b ); 377 p_cmap_r[ j ] = CLIP( r ); 378 p_cmap_g[ j ] = CLIP( g ); 379 p_cmap_b[ j ] = CLIP( b ); 380 381 #if 0 382 printf("+++Alloc RGB cmap %d (%d, %d, %d)\n", j, 383 p_cmap_r[ j ] >>8, p_cmap_g[ j ] >>8, 384 p_cmap_b[ j ] >>8); 385 #endif 377 386 378 387 /* Allocate color */ … … 391 400 392 401 /* The colors have been allocated, we can set the palette */ 393 p_vout->output.pf_setpalette( p_vout, red, green, blue);402 p_vout->output.pf_setpalette( p_vout, p_cmap_r, p_cmap_g, p_cmap_b ); 394 403 395 404 #if 0 modules/video_chroma/i420_rgb.h
r41a8349 r636df0d 2 2 * i420_rgb.h : YUV to bitmap RGB conversion module for vlc 3 3 ***************************************************************************** 4 * Copyright (C) 2000 VideoLAN5 * $Id: i420_rgb.h,v 1. 4 2003/08/29 18:58:05 fenrirExp $4 * Copyright (C) 2000, 2004 VideoLAN 5 * $Id: i420_rgb.h,v 1.5 2004/01/31 05:53:35 rocky Exp $ 6 6 * 7 7 * Authors: Samuel Hocevar <sam@zoy.org> … … 22 22 *****************************************************************************/ 23 23 24 /***************************************************************************** 24 /** Number of entries in RGB palette/colormap */ 25 #define CMAP_RGB2_SIZE 256 26 27 /** 25 28 * chroma_sys_t: chroma method descriptor 26 ***************************************************************************** 29 27 30 * This structure is part of the chroma transformation descriptor, it 28 31 * describes the yuv2rgb specific properties. 29 * ****************************************************************************/32 */ 30 33 struct chroma_sys_t 31 34 { … … 34 37 35 38 #ifdef MODULE_NAME_IS_i420_rgb 36 /* Pre-calculated conversion tables */ 37 void *p_base; /* base for all conversion tables */ 38 uint8_t *p_rgb8; /* RGB 8 bits table */ 39 uint16_t *p_rgb16; /* RGB 16 bits table */ 40 uint32_t *p_rgb32; /* RGB 32 bits table */ 39 /**< Pre-calculated conversion tables */ 40 void *p_base; /**< base for all conversion tables */ 41 uint8_t *p_rgb8; /**< RGB 8 bits table */ 42 uint16_t *p_rgb16; /**< RGB 16 bits table */ 43 uint32_t *p_rgb32; /**< RGB 32 bits table */ 44 45 /**< To get RGB value for palette entry i, use (p_rgb_r[i], p_rgb_g[i], 46 p_rgb_b[i]). Note these are 16 bits per pixel. For 8bpp entries, 47 shift right 8 bits. 48 */ 49 uint16_t p_rgb_r[CMAP_RGB2_SIZE]; /**< Red values of palette */ 50 uint16_t p_rgb_g[CMAP_RGB2_SIZE]; /**< Green values of palette */ 51 uint16_t p_rgb_b[CMAP_RGB2_SIZE]; /**< Blue values of palette */ 41 52 #endif 42 53 };
