CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/GPU/Common/TextureScalerCommon.h
Views: 1401
// Copyright (c) 2012- PPSSPP Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official git repository and contact information can be found at15// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.1617#pragma once1819#include "Common/CommonTypes.h"20#include "Common/MemoryUtil.h"2122static const int MIN_TEXSCALE_LINES_PER_THREAD = 4;2324// The texture scaler requires input to be in R8G8B8A8.25// (It's OK if you flip R and B as they are not treated very differently from each other.26// They will of course not unflip during the operation so be aware of that).27class TextureScalerCommon {28public:29TextureScalerCommon();30~TextureScalerCommon();3132void ScaleAlways(u32 *out, u32 *src, int width, int height, int *scaledWidth, int *scaledHeight, int factor);33bool Scale(u32 *&data, int width, int height, int *scaledWidth, int *scaledHeight, int factor);34bool ScaleInto(u32 *out, u32 *src, int width, int height, int *scaledWidth, int *scaledHeight, int factor);3536enum { XBRZ = 0, HYBRID = 1, BICUBIC = 2, HYBRID_BICUBIC = 3 };3738protected:39static void ScaleXBRZ(int factor, u32* source, u32* dest, int width, int height);40void ScaleBilinear(int factor, u32* source, u32* dest, int width, int height);41static void ScaleBicubicBSpline(int factor, u32* source, u32* dest, int width, int height);42static void ScaleBicubicMitchell(int factor, u32* source, u32* dest, int width, int height);43void ScaleHybrid(int factor, u32* source, u32* dest, int width, int height, bool bicubic = false);4445void DePosterize(u32* source, u32* dest, int width, int height);4647static bool IsEmptyOrFlat(const u32 *data, int pixels) ;4849// depending on the factor and texture sizes, these can get pretty large50// maximum is (100 MB total for a 512 by 512 texture with scaling factor 5 and hybrid scaling)51// of course, scaling factor 5 is totally silly anyway52AlignedVector<u32, 16> bufDeposter, bufOutput, bufTmp1, bufTmp2, bufTmp3;53};545556