mirror of https://github.com/snes9xgit/snes9x.git
Win32: update xbrz
This commit is contained in:
parent
ddb1527236
commit
26914fa9b0
|
@ -1,6 +1,6 @@
|
||||||
// ****************************************************************************
|
// ****************************************************************************
|
||||||
// * This file is part of the HqMAME project. It is distributed under *
|
// * This file is part of the HqMAME project. It is distributed under *
|
||||||
// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
|
// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 *
|
||||||
// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
|
// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
|
||||||
// * *
|
// * *
|
||||||
// * Additionally and as a special exception, the author gives permission *
|
// * Additionally and as a special exception, the author gives permission *
|
||||||
|
@ -22,18 +22,11 @@ namespace xbrz
|
||||||
{
|
{
|
||||||
struct ScalerCfg
|
struct ScalerCfg
|
||||||
{
|
{
|
||||||
ScalerCfg() :
|
double luminanceWeight = 1;
|
||||||
luminanceWeight_(1),
|
double equalColorTolerance = 30;
|
||||||
equalColorTolerance_(30),
|
double dominantDirectionThreshold = 3.6;
|
||||||
dominantDirectionThreshold(3.6),
|
double steepDirectionThreshold = 2.2;
|
||||||
steepDirectionThreshold(2.2),
|
double newTestAttribute = 0; //unused; test new parameters
|
||||||
newTestAttribute_(0) {}
|
|
||||||
|
|
||||||
double luminanceWeight_;
|
|
||||||
double equalColorTolerance_;
|
|
||||||
double dominantDirectionThreshold;
|
|
||||||
double steepDirectionThreshold;
|
|
||||||
double newTestAttribute_; //unused; test new parameters
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
747
filter/xbrz.cpp
747
filter/xbrz.cpp
File diff suppressed because it is too large
Load Diff
|
@ -36,12 +36,13 @@ http://board.byuu.org/viewtopic.php?f=10&t=2248
|
||||||
- support multithreading
|
- support multithreading
|
||||||
- support 64-bit architectures
|
- support 64-bit architectures
|
||||||
- support processing image slices
|
- support processing image slices
|
||||||
|
- support scaling up to 6xBRZ
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum ColorFormat //from high bits -> low bits, 8 bit per channel
|
enum class ColorFormat //from high bits -> low bits, 8 bit per channel
|
||||||
{
|
{
|
||||||
ARGB, //including alpha channel, BGRA byte order on little-endian machines
|
|
||||||
RGB, //8 bit for each red, green, blue, upper 8 bits unused
|
RGB, //8 bit for each red, green, blue, upper 8 bits unused
|
||||||
|
ARGB, //including alpha channel, BGRA byte order on little-endian machines
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -53,9 +54,9 @@ enum ColorFormat //from high bits -> low bits, 8 bit per channel
|
||||||
in the target image data if you are using multiple threads for processing each enlarged slice!
|
in the target image data if you are using multiple threads for processing each enlarged slice!
|
||||||
|
|
||||||
THREAD-SAFETY: - parts of the same image may be scaled by multiple threads as long as the [yFirst, yLast) ranges do not overlap!
|
THREAD-SAFETY: - parts of the same image may be scaled by multiple threads as long as the [yFirst, yLast) ranges do not overlap!
|
||||||
- there is a minor inefficiency for the first row of a slice, so avoid processing single rows only; suggestion: process 6 rows at least
|
- there is a minor inefficiency for the first row of a slice, so avoid processing single rows only; suggestion: process 8-16 rows at least
|
||||||
*/
|
*/
|
||||||
void scale(size_t factor, //valid range: 2 - 5
|
void scale(size_t factor, //valid range: 2 - 6
|
||||||
const uint32_t* src, uint32_t* trg, int srcWidth, int srcHeight,
|
const uint32_t* src, uint32_t* trg, int srcWidth, int srcHeight,
|
||||||
ColorFormat colFmt,
|
ColorFormat colFmt,
|
||||||
const ScalerCfg& cfg = ScalerCfg(),
|
const ScalerCfg& cfg = ScalerCfg(),
|
||||||
|
|
|
@ -219,6 +219,8 @@ void RenderHQ4X (SSurface Src, SSurface Dst, RECT *rect);
|
||||||
void Render2xBRZ(SSurface Src, SSurface Dst, RECT* rect);
|
void Render2xBRZ(SSurface Src, SSurface Dst, RECT* rect);
|
||||||
void Render3xBRZ(SSurface Src, SSurface Dst, RECT* rect);
|
void Render3xBRZ(SSurface Src, SSurface Dst, RECT* rect);
|
||||||
void Render4xBRZ(SSurface Src, SSurface Dst, RECT* rect);
|
void Render4xBRZ(SSurface Src, SSurface Dst, RECT* rect);
|
||||||
|
void Render5xBRZ(SSurface Src, SSurface Dst, RECT* rect);
|
||||||
|
void Render6xBRZ(SSurface Src, SSurface Dst, RECT* rect);
|
||||||
void RenderEPXA (SSurface Src, SSurface Dst, RECT *);
|
void RenderEPXA (SSurface Src, SSurface Dst, RECT *);
|
||||||
void RenderEPXB (SSurface Src, SSurface Dst, RECT *);
|
void RenderEPXB (SSurface Src, SSurface Dst, RECT *);
|
||||||
void RenderEPXC (SSurface Src, SSurface Dst, RECT *);
|
void RenderEPXC (SSurface Src, SSurface Dst, RECT *);
|
||||||
|
@ -319,6 +321,8 @@ TRenderMethod FilterToMethod(RenderFilter filterID)
|
||||||
case FILTER_SIMPLE4X: return RenderSimple4X;
|
case FILTER_SIMPLE4X: return RenderSimple4X;
|
||||||
case FILTER_HQ4X: return RenderHQ4X;
|
case FILTER_HQ4X: return RenderHQ4X;
|
||||||
case FILTER_4XBRZ: return Render4xBRZ;
|
case FILTER_4XBRZ: return Render4xBRZ;
|
||||||
|
case FILTER_5XBRZ: return Render5xBRZ;
|
||||||
|
case FILTER_6XBRZ: return Render6xBRZ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,6 +361,8 @@ const char* GetFilterName(RenderFilter filterID)
|
||||||
case FILTER_SIMPLE4X: return "Simple 4X";
|
case FILTER_SIMPLE4X: return "Simple 4X";
|
||||||
case FILTER_HQ4X: return "hq4x";
|
case FILTER_HQ4X: return "hq4x";
|
||||||
case FILTER_4XBRZ: return "4xBRZ";
|
case FILTER_4XBRZ: return "4xBRZ";
|
||||||
|
case FILTER_5XBRZ: return "5xBRZ";
|
||||||
|
case FILTER_6XBRZ: return "6xBRZ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,6 +394,10 @@ int GetFilterScale(RenderFilter filterID)
|
||||||
case FILTER_HQ4X:
|
case FILTER_HQ4X:
|
||||||
case FILTER_4XBRZ:
|
case FILTER_4XBRZ:
|
||||||
return 4;
|
return 4;
|
||||||
|
case FILTER_5XBRZ:
|
||||||
|
return 5;
|
||||||
|
case FILTER_6XBRZ:
|
||||||
|
return 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,6 +419,8 @@ bool GetFilterHiResSupport(RenderFilter filterID)
|
||||||
case FILTER_2XBRZ:
|
case FILTER_2XBRZ:
|
||||||
case FILTER_3XBRZ:
|
case FILTER_3XBRZ:
|
||||||
case FILTER_4XBRZ:
|
case FILTER_4XBRZ:
|
||||||
|
case FILTER_5XBRZ:
|
||||||
|
case FILTER_6XBRZ:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -2746,6 +2758,16 @@ void Render4xBRZ(SSurface Src, SSurface Dst, RECT* rect)
|
||||||
RenderxBRZ(Src, Dst, rect, 4);
|
RenderxBRZ(Src, Dst, rect, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Render5xBRZ(SSurface Src, SSurface Dst, RECT* rect)
|
||||||
|
{
|
||||||
|
RenderxBRZ(Src, Dst, rect, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Render6xBRZ(SSurface Src, SSurface Dst, RECT* rect)
|
||||||
|
{
|
||||||
|
RenderxBRZ(Src, Dst, rect, 6);
|
||||||
|
}
|
||||||
|
|
||||||
void RenderxBRZ(SSurface Src, SSurface Dst, RECT* rect, int scalingFactor)
|
void RenderxBRZ(SSurface Src, SSurface Dst, RECT* rect, int scalingFactor)
|
||||||
{
|
{
|
||||||
xbrz_thread_data::scalingFactor = scalingFactor;
|
xbrz_thread_data::scalingFactor = scalingFactor;
|
||||||
|
|
|
@ -7541,6 +7541,7 @@ checkUpdateFilterBox2:
|
||||||
default: case 2: filter = FILTER_SIMPLE2X; break;
|
default: case 2: filter = FILTER_SIMPLE2X; break;
|
||||||
case 3: filter = FILTER_SIMPLE3X; break;
|
case 3: filter = FILTER_SIMPLE3X; break;
|
||||||
case 4: filter = FILTER_SIMPLE4X; break;
|
case 4: filter = FILTER_SIMPLE4X; break;
|
||||||
|
case 5: case 6: filter = FILTER_SIMPLE4X; break;
|
||||||
}
|
}
|
||||||
strcpy(textOriginal, GetFilterName(filter));
|
strcpy(textOriginal, GetFilterName(filter));
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,6 +271,8 @@ enum RenderFilter{
|
||||||
FILTER_2XBRZ,
|
FILTER_2XBRZ,
|
||||||
FILTER_3XBRZ,
|
FILTER_3XBRZ,
|
||||||
FILTER_4XBRZ,
|
FILTER_4XBRZ,
|
||||||
|
FILTER_5XBRZ,
|
||||||
|
FILTER_6XBRZ,
|
||||||
|
|
||||||
NUM_FILTERS
|
NUM_FILTERS
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue