Previous 199869 Revisions Next

r17409 Wednesday 22nd August, 2012 at 20:10:44 UTC by Wilbert Pol
(MESS) pcfx.c: Start displaying some things from huc6270-b; doesn't look correct yet though. (nw)
[src/emu/video]huc6261.c huc6261.h

trunk/src/emu/video/huc6261.c
r17408r17409
4141huc6261_device::huc6261_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
4242   : device_t(mconfig, HUC6261, "HuC6261", tag, owner, clock)
4343{
44   // Set up UV lookup table
45   for ( int ur = 0; ur < 256; ur++ )
46   {
47      for ( int vr = 0; vr < 256; vr++ )
48      {
49         INT32 r,g,b;
50         INT32 u = ur - 128;
51         INT32 v = vr - 128;
52
53         r =              - 1.13983 * v;
54         g = -0.35465 * u - 0.58060 * v;
55         b =  2.03211 * u;
56
57         m_uv_lookup[ ( ur << 8 ) | vr ][0] = r;
58         m_uv_lookup[ ( ur << 8 ) | vr ][1] = g;
59         m_uv_lookup[ ( ur << 8 ) | vr ][2] = b;
60      }
61   }
4462}
4563
4664
65inline UINT32 huc6261_device::yuv2rgb(UINT32 yuv)
66{
67   INT32 r, g, b;
68   UINT8 y = yuv >> 16;
69   UINT16 uv = yuv & 0xffff;
70
71   r = y + m_uv_lookup[uv][0];
72   g = y + m_uv_lookup[uv][1];
73   b = y + m_uv_lookup[uv][2];
74
75   if ( r < 0 ) r = 0;
76   if ( g < 0 ) g = 0;
77   if ( b < 0 ) b = 0;
78   if ( r > 255 ) r = 255;
79   if ( g > 255 ) g = 255;
80   if ( b > 255 ) b = 255;
81
82   return ( r << 16 ) | ( g << 8 ) | b;
83}
84
4785void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
4886{
4987   int vpos = m_screen->vpos();
r17408r17409
5896      {
5997         g_profiler.start( PROFILER_VIDEO );
6098         /* Get next pixel information */
61         m_pixel_data = 0; //m_get_next_pixel_data( 0, 0xffff );
99         m_pixel_data = m_huc6270_b->next_pixel( *machine().memory().first_space(), 0, 0xffff );
62100         g_profiler.stop();
63101      }
64102
65      bitmap_line[ h ] = m_palette[ m_pixel_data ];
103      bitmap_line[ h ] = yuv2rgb( ( ( m_palette[m_pixel_data] & 0xff00 ) << 8 ) | ( ( m_palette[m_pixel_data] & 0xf0 ) << 8 ) | ( ( m_palette[m_pixel_data] & 0x0f ) << 4 ) );
66104      m_pixel_clock = ( m_pixel_clock + 1 ) % m_pixels_per_clock;
67105      h = ( h + 1 ) % HUC6261_WPF;
68106
trunk/src/emu/video/huc6261.h
r17408r17409
4646   DECLARE_READ16_MEMBER( read );
4747   DECLARE_WRITE16_MEMBER( write );
4848
49   inline UINT32 yuv2rgb(UINT32 yuv);
50
4951protected:
5052   // device-level overrides
5153   virtual void device_config_complete();
r17408r17409
7476
7577   emu_timer   *m_timer;
7678   bitmap_rgb32   *m_bmp;
79   INT32   m_uv_lookup[65536][3];
7780};
7881
7982

Previous 199869 Revisions Next


© 1997-2024 The MAME Team