📄 spuhandler.cc
字号:
//// Copyright (c) 2004 by Istv醤 V醨adi//// This file is part of dxr3Player, a DVD player written specifically // for the DXR3 (aka Hollywood+) decoder card.// This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.//// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA//------------------------------------------------------------------------------#include "SPUHandler.h"#include "output/SystemTimer.h"#include "unichrome/Unichrome.h"//------------------------------------------------------------------------------using output::unichrome::SPUHandler;using output::SystemTimer;using dvd::packet::PacketQueue;using unichrome::Unichrome;//------------------------------------------------------------------------------//------------------------------------------------------------------------------SPUHandler::SPUHandler(PacketQueue& inputQueue, SystemTimer& timer, Unichrome& videoDevice) : output::SPUHandler(inputQueue, timer), videoDevice(videoDevice){}//------------------------------------------------------------------------------void SPUHandler::setPalette(const unsigned* palette){ videoDevice.setSPUPalette(palette);}//------------------------------------------------------------------------------void SPUHandler::update(){ if (!isDisplayable(PICTURE) && !isDisplayable(BUTTON)) { videoDevice.disableSPU(); return; } size_t bufferWidth = 0, bufferHeight = 0; volatile unsigned char* buffer = videoDevice.getSPUBuffer(bufferWidth, bufferHeight); if (buffer==0) return; for(size_t i = 0; i<bufferWidth*bufferHeight; ++i) { buffer[i] = 0x00; } update(PICTURE, buffer, bufferWidth); update(BUTTON, buffer, bufferWidth); videoDevice.enableSPU();}//------------------------------------------------------------------------------void SPUHandler::update(displayEntity_t displayEntity, volatile unsigned char* buffer, size_t bufferWidth){ if (!isDisplayable(displayEntity)) return; size_t pictureWidth, startX, startY, spuWidth, spuHeight; const unsigned char* pictureData = getVisiblePictureData(displayEntity, pictureWidth, startX, startY, spuWidth, spuHeight); size_t lineStart = bufferWidth * startY + startX; for(size_t i = 0; i<spuHeight; ++i, lineStart+=bufferWidth) { volatile unsigned char* bufferLine = buffer + lineStart; size_t pictureLineNo = i; if (isWideScreen()) { pictureLineNo *= 3; pictureLineNo += 2; pictureLineNo /= 4; } const unsigned char* pictureLine = pictureData + pictureLineNo * pictureWidth; for(size_t j = 0; j<spuWidth; ++j, ++pictureLine, ++bufferLine) { unsigned pixel = *pictureLine; *bufferLine = (getContrast(displayEntity, pixel)<<4) | getColorIndex(displayEntity, pixel); } }}//------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -