void BinkDecoder::videoPacket(VideoFrame &video) { assert(video.bits); if (_hasAlpha) { if (_id == kBIKiID) video.bits->skip(32); decodePlane(video, 3, false); } if (_id == kBIKiID) video.bits->skip(32); for (int i = 0; i < 3; i++) { int planeIdx = ((i == 0) || !_swapPlanes) ? i : (i ^ 3); decodePlane(video, planeIdx, i != 0); if (video.bits->pos() >= video.bits->size()) break; } // Convert the YUV data we have to our format // We're ignoring alpha for now assert(_curPlanes[0] && _curPlanes[1] && _curPlanes[2]); Graphics::convertYUV420ToRGB(&_surface, _curPlanes[0], _curPlanes[1], _curPlanes[2], _surface.w, _surface.h, _surface.w, _surface.w >> 1); // And swap the planes with the reference planes for (int i = 0; i < 4; i++) SWAP(_curPlanes[i], _oldPlanes[i]); }
void Bink::videoPacket(VideoFrame &video) { assert(video.bits); if (_hasAlpha) { if (_id == kBIKiID) video.bits->skip(32); decodePlane(video, 3, false); } if (_id == kBIKiID) video.bits->skip(32); for (int i = 0; i < 3; i++) { int planeIdx = ((i == 0) || !_swapPlanes) ? i : (i ^ 3); decodePlane(video, planeIdx, i != 0); if (video.bits->pos() >= video.bits->size()) break; } // Convert the YUVA data we have to BGRA assert(_surface && _curPlanes[0] && _curPlanes[1] && _curPlanes[2] && _curPlanes[3]); Graphics::convertYUVA420ToRGBA(_surface->getData(), _surface->getWidth() * 4, _curPlanes[0], _curPlanes[1], _curPlanes[2], _curPlanes[3], _width, _height, _width, _width >> 1); // And swap the planes with the reference planes for (int i = 0; i < 4; i++) SWAP(_curPlanes[i], _oldPlanes[i]); }