Author: ArcRiley Date: 2009-01-11 00:26:23 -0500 (Sun, 11 Jan 2009) New Revision: 1462
Modified: trunk/pysoy/src/textures/Video.pym Log: Ticket #968 : * finished, closing ticket Modified: trunk/pysoy/src/textures/Video.pym =================================================================== --- trunk/pysoy/src/textures/Video.pym 2009-01-10 16:03:01 UTC (rev 1461) +++ trunk/pysoy/src/textures/Video.pym 2009-01-11 05:26:23 UTC (rev 1462) @@ -30,8 +30,7 @@ # cdef int _load(self, void* _data, int _size) nogil : - cdef int x, y, _cx, _cy, _tx, _ty, _yl, _yc - cdef int _py, _pu, _pv, _pr, _pg, _pb + cdef int _y cdef ogg.ogg_page* _page cdef ogg.yuv_buffer _yuv cdef ogg.ogg_packet _packet @@ -80,8 +79,11 @@ self._stage = -1 return 0 if ogg.ogg_page_pageno(_page) == 0 : - self._resize(1, 3, self._squareup(self._info.frame_width), + # + # Resize for RGBX then set self._chans to RGB to ignore the X + self._resize(1, 4, self._squareup(self._info.frame_width), self._squareup(self._info.frame_height), 1) + self._chans = 3 self._scaleX = <float> self._info.frame_width / <float> self._width self._scaleY = <float> self._info.frame_height / <float> self._height self._aspect = ( <float> self._info.frame_width / \ @@ -99,41 +101,15 @@ ogg.ogg_page_granulepos(_page)) ogg.theora_decode_YUVout(&self._decode, &_yuv) # - # cx/cy = chroma x/y due to 4:2:0 - # tx/ty = texels x/y offset - # yl/yc = yuv l/c offsets - # # This can and should be optimized further #_start = _time() - _cx = self._info.frame_width - _cy = self._info.frame_height - for y from 0 <= y < _cy : - _ty = (self._info.frame_height - y) * self._width - _yl = y * _yuv.y_stride - _yc = (y/2) * _yuv.uv_stride - for x from 0 <= x < _cx : - _tx = (_ty + x) * 3 - _py = _yuv.y[_yl + x] - _pu = _yuv.u[_yc + (x/2)] - _pv = _yuv.v[_yc + (x/2)] - _pr = _py + _tableRV[_pv] - _pg = _py - _tableGV[_pv] - _tableGU[_pu] - _pb = _py + _tableBU[_pu] - if _pr < 0 : - _pr = 0 - if _pg < 0 : - _pg = 0 - if _pb < 0 : - _pb = 0 - if _pr > 255 : - _pr = 255 - if _pg > 255 : - _pg = 255 - if _pb > 255 : - _pb = 255 - self._texels[_tx ] = _pr - self._texels[_tx+1] = _pg - self._texels[_tx+2] = _pb + for _y from 0 <= _y < self._info.frame_height : + oil.oil_yuv2rgbx_sub2_u8( + self._texels + ((self._info.frame_height - _y) * self._width * 4), + _yuv.y + ( _y * _yuv.y_stride), + _yuv.u + ((_y / 2) * _yuv.uv_stride), + _yuv.v + ((_y / 2) * _yuv.uv_stride), + self._info.frame_width) self._update = 1 return 1 _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn