Skip to content

Commit

Permalink
r6
Browse files Browse the repository at this point in the history
  • Loading branch information
IFeelBloated committed Oct 24, 2016
1 parent e549759 commit 3c70356
Show file tree
Hide file tree
Showing 14 changed files with 142 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/FakePlaneOfBlocks.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "FakePlaneOfBlocks.h"
#include "SADFunctions.h"
#include "SADFunctions.hpp"
#include "CommonFunctions.h"

FakePlaneOfBlocks::FakePlaneOfBlocks(int32_t sizeX, int32_t sizeY, int32_t lv, int32_t pel, int32_t _nOverlapX, int32_t _nOverlapY, int32_t _nBlkX, int32_t _nBlkY) {
Expand Down
13 changes: 10 additions & 3 deletions src/MVAnalyze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,22 @@ static void VS_CC mvanalyzeCreate(const VSMap *in, VSMap *out, void *userData, V
}
d.analysisData.nBlkSizeX = d.blksize;
d.analysisData.nBlkSizeY = d.blksizev;
if ((d.analysisData.nBlkSizeX != 4 || d.analysisData.nBlkSizeY != 4) &&
if ((d.analysisData.nBlkSizeX != 2 || d.analysisData.nBlkSizeY != 2) &&
(d.analysisData.nBlkSizeX != 4 || d.analysisData.nBlkSizeY != 4) &&
(d.analysisData.nBlkSizeX != 8 || d.analysisData.nBlkSizeY != 4) &&
(d.analysisData.nBlkSizeX != 8 || d.analysisData.nBlkSizeY != 8) &&
(d.analysisData.nBlkSizeX != 16 || d.analysisData.nBlkSizeY != 2) &&
(d.analysisData.nBlkSizeX != 16 || d.analysisData.nBlkSizeY != 8) &&
(d.analysisData.nBlkSizeX != 16 || d.analysisData.nBlkSizeY != 16) &&
(d.analysisData.nBlkSizeX != 32 || d.analysisData.nBlkSizeY != 32) &&
(d.analysisData.nBlkSizeX != 32 || d.analysisData.nBlkSizeY != 16)) {
vsapi->setError(out, "Analyze: the block size must be 4x4, 8x4, 8x8, 16x2, 16x8, 16x16, 32x16, or 32x32.");
(d.analysisData.nBlkSizeX != 32 || d.analysisData.nBlkSizeY != 16) &&
(d.analysisData.nBlkSizeX != 64 || d.analysisData.nBlkSizeY != 32) &&
(d.analysisData.nBlkSizeX != 64 || d.analysisData.nBlkSizeY != 64) &&
(d.analysisData.nBlkSizeX != 128 || d.analysisData.nBlkSizeY != 64) &&
(d.analysisData.nBlkSizeX != 128 || d.analysisData.nBlkSizeY != 128) &&
(d.analysisData.nBlkSizeX != 256 || d.analysisData.nBlkSizeY != 128) &&
(d.analysisData.nBlkSizeX != 256 || d.analysisData.nBlkSizeY != 256)) {
vsapi->setError(out, "Analyze: the block size must be 2x2, 4x4, 8x4, 8x8, 16x2, 16x8, 16x16, 32x16, 32x32, 64x32, 64x64, 128x64, 128x128, 256x128, or 256x256.");
return;
}
d.analysisData.nDeltaFrame = d.delta;
Expand Down
14 changes: 13 additions & 1 deletion src/MVBlockFPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ static void selectFunctions(MVBlockFPSData *d) {
const int32_t yRatioUV = d->bleh->yRatioUV;
const int32_t nBlkSizeX = d->bleh->nBlkSizeX;
const int32_t nBlkSizeY = d->bleh->nBlkSizeY;
OverlapsFunction overs[33][33];
static OverlapsFunction overs[257][257];
overs[2][2] = Overlaps_C<2, 2, double, float>;
overs[2][4] = Overlaps_C<2, 4, double, float>;
overs[4][2] = Overlaps_C<4, 2, double, float>;
Expand All @@ -746,6 +746,18 @@ static void selectFunctions(MVBlockFPSData *d) {
overs[32][8] = Overlaps_C<32, 8, double, float>;
overs[32][16] = Overlaps_C<32, 16, double, float>;
overs[32][32] = Overlaps_C<32, 32, double, float>;
overs[32][64] = Overlaps_C<32, 64, double, float>;
overs[64][16] = Overlaps_C<64, 16, double, float>;
overs[64][32] = Overlaps_C<64, 32, double, float>;
overs[64][64] = Overlaps_C<64, 64, double, float>;
overs[64][128] = Overlaps_C<64, 128, double, float>;
overs[128][32] = Overlaps_C<128, 32, double, float>;
overs[128][64] = Overlaps_C<128, 64, double, float>;
overs[128][128] = Overlaps_C<128, 128, double, float>;
overs[128][256] = Overlaps_C<128, 256, double, float>;
overs[256][64] = Overlaps_C<256, 64, double, float>;
overs[256][128] = Overlaps_C<256, 128, double, float>;
overs[256][256] = Overlaps_C<256, 256, double, float>;
d->ToPixels = ToPixels<double, float>;
d->OVERSLUMA = overs[nBlkSizeX][nBlkSizeY];
d->OVERSCHROMA = overs[nBlkSizeX / xRatioUV][nBlkSizeY / yRatioUV];
Expand Down
4 changes: 2 additions & 2 deletions src/MVClip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ MVClipDicks::MVClipDicks(VSNodeRef *vectors, double _nSCD1, double _nSCD2, const
nBlkX = pAnalyzeFilter->GetBlkX();
nBlkY = pAnalyzeFilter->GetBlkY();
nBlkCount = nBlkX * nBlkY;
double maxSAD = 8. * 8. * 255.;
auto maxSAD = 256. * 256. * 255.;
if (_nSCD1 > maxSAD)
throw MVException(std::string("thscd1 can be at most ").append(std::to_string(maxSAD)).append("."));
int32_t referenceBlockSize = 8 * 8;
auto referenceBlockSize = 8 * 8;
nSCD1 = _nSCD1 * (nBlkSizeX * nBlkSizeY) / referenceBlockSize;
if (pAnalyzeFilter->IsChromaMotion())
nSCD1 += nSCD1 / (xRatioUV * yRatioUV) * 2;
Expand Down
30 changes: 27 additions & 3 deletions src/MVCompensate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "Overlap.h"
#include "MVClip.h"
#include "MVFrame.h"
#include "SADFunctions.h"
#include "SADFunctions.hpp"

struct MVCompensateData {
VSNodeRef *node;
Expand Down Expand Up @@ -353,8 +353,8 @@ static void selectFunctions(MVCompensateData *d) {
const int32_t yRatioUV = d->bleh->yRatioUV;
const int32_t nBlkSizeX = d->bleh->nBlkSizeX;
const int32_t nBlkSizeY = d->bleh->nBlkSizeY;
OverlapsFunction overs[33][33];
COPYFunction copys[33][33];
static OverlapsFunction overs[257][257];
static COPYFunction copys[257][257];
overs[2][2] = Overlaps_C<2, 2, double, float>;
copys[2][2] = Copy_C<2, 2, float>;
overs[2][4] = Overlaps_C<2, 4, double, float>;
Expand Down Expand Up @@ -393,6 +393,30 @@ static void selectFunctions(MVCompensateData *d) {
copys[32][16] = Copy_C<32, 16, float>;
overs[32][32] = Overlaps_C<32, 32, double, float>;
copys[32][32] = Copy_C<32, 32, float>;
overs[32][64] = Overlaps_C<32, 64, double, float>;
copys[32][64] = Copy_C<32, 64, float>;
overs[64][16] = Overlaps_C<64, 16, double, float>;
copys[64][16] = Copy_C<64, 16, float>;
overs[64][32] = Overlaps_C<64, 32, double, float>;
copys[64][32] = Copy_C<64, 32, float>;
overs[64][64] = Overlaps_C<64, 64, double, float>;
copys[64][64] = Copy_C<64, 64, float>;
overs[64][128] = Overlaps_C<64, 128, double, float>;
copys[64][128] = Copy_C<64, 128, float>;
overs[128][32] = Overlaps_C<128, 32, double, float>;
copys[128][32] = Copy_C<128, 32, float>;
overs[128][64] = Overlaps_C<128, 64, double, float>;
copys[128][64] = Copy_C<128, 64, float>;
overs[128][128] = Overlaps_C<128, 128, double, float>;
copys[128][128] = Copy_C<128, 128, float>;
overs[128][256] = Overlaps_C<128, 256, double, float>;
copys[128][256] = Copy_C<128, 256, float>;
overs[256][64] = Overlaps_C<256, 64, double, float>;
copys[256][64] = Copy_C<256, 64, float>;
overs[256][128] = Overlaps_C<256, 128, double, float>;
copys[256][128] = Copy_C<256, 128, float>;
overs[256][256] = Overlaps_C<256, 256, double, float>;
copys[256][256] = Copy_C<256, 256, float>;
d->ToPixels = ToPixels<double, float>;
d->OVERSLUMA = overs[nBlkSizeX][nBlkSizeY];
d->BLITLUMA = copys[nBlkSizeX][nBlkSizeY];
Expand Down
32 changes: 28 additions & 4 deletions src/MVDegrains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ static const VSFrameRef *VS_CC mvdegrainGetFrame(int32_t n, int32_t activationRe
return nullptr;
}

template <int32_t radius>
template <int radius>
static void VS_CC mvdegrainFree(void *instanceData, VSCore *core, const VSAPI *vsapi) {
MVDegrainData *d = reinterpret_cast<MVDegrainData *>(instanceData);
if (d->nOverlapX[0] || d->nOverlapY[0]) {
Expand All @@ -570,14 +570,14 @@ static void VS_CC mvdegrainFree(void *instanceData, VSCore *core, const VSAPI *v
delete d;
}

template <int32_t radius>
template <int radius>
static void selectFunctions(MVDegrainData *d) {
const int32_t xRatioUV = d->bleh->xRatioUV;
const int32_t yRatioUV = d->bleh->yRatioUV;
const int32_t nBlkSizeX = d->bleh->nBlkSizeX;
const int32_t nBlkSizeY = d->bleh->nBlkSizeY;
OverlapsFunction overs[33][33];
DenoiseFunction degs[33][33];
static OverlapsFunction overs[257][257];
static DenoiseFunction degs[257][257];
overs[2][2] = Overlaps_C<2, 2, double, float>;
degs[2][2] = Degrain_C<radius, 2, 2, float>;
overs[2][4] = Overlaps_C<2, 4, double, float>;
Expand Down Expand Up @@ -616,6 +616,30 @@ static void selectFunctions(MVDegrainData *d) {
degs[32][16] = Degrain_C<radius, 32, 16, float>;
overs[32][32] = Overlaps_C<32, 32, double, float>;
degs[32][32] = Degrain_C<radius, 32, 32, float>;
overs[32][64] = Overlaps_C<32, 64, double, float>;
degs[32][64] = Degrain_C<radius, 32, 64, float>;
overs[64][16] = Overlaps_C<64, 16, double, float>;
degs[64][16] = Degrain_C<radius, 64, 16, float>;
overs[64][32] = Overlaps_C<64, 32, double, float>;
degs[64][32] = Degrain_C<radius, 64, 32, float>;
overs[64][64] = Overlaps_C<64, 64, double, float>;
degs[64][64] = Degrain_C<radius, 64, 64, float>;
overs[64][128] = Overlaps_C<64, 128, double, float>;
degs[64][128] = Degrain_C<radius, 64, 128, float>;
overs[128][32] = Overlaps_C<128, 32, double, float>;
degs[128][32] = Degrain_C<radius, 128, 32, float>;
overs[128][64] = Overlaps_C<128, 64, double, float>;
degs[128][64] = Degrain_C<radius, 128, 64, float>;
overs[128][128] = Overlaps_C<128, 128, double, float>;
degs[128][128] = Degrain_C<radius, 128, 128, float>;
overs[128][256] = Overlaps_C<128, 256, double, float>;
degs[128][256] = Degrain_C<radius, 128, 256, float>;
overs[256][64] = Overlaps_C<256, 64, double, float>;
degs[256][64] = Degrain_C<radius, 256, 64, float>;
overs[256][128] = Overlaps_C<256, 128, double, float>;
degs[256][128] = Degrain_C<radius, 256, 128, float>;
overs[256][256] = Overlaps_C<256, 256, double, float>;
degs[256][256] = Degrain_C<radius, 256, 256, float>;
d->LimitChanges = LimitChanges_C<float>;
d->ToPixels = ToPixels<double, float>;
d->OVERS[0] = overs[nBlkSizeX][nBlkSizeY];
Expand Down
2 changes: 1 addition & 1 deletion src/MVDegrains.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <cstdint>
#include <cstring>
#include "MVFrame.h"
#include "SADFunctions.h"
#include "SADFunctions.hpp"

enum VectorOrder {
Backward1 = 0,
Expand Down
13 changes: 10 additions & 3 deletions src/MVRecalculate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,22 @@ static void VS_CC mvrecalculateCreate(const VSMap *in, VSMap *out, void *userDat
}
d.analysisData.nBlkSizeX = d.blksize;
d.analysisData.nBlkSizeY = d.blksizev;
if ((d.analysisData.nBlkSizeX != 4 || d.analysisData.nBlkSizeY != 4) &&
if ((d.analysisData.nBlkSizeX != 2 || d.analysisData.nBlkSizeY != 2) &&
(d.analysisData.nBlkSizeX != 4 || d.analysisData.nBlkSizeY != 4) &&
(d.analysisData.nBlkSizeX != 8 || d.analysisData.nBlkSizeY != 4) &&
(d.analysisData.nBlkSizeX != 8 || d.analysisData.nBlkSizeY != 8) &&
(d.analysisData.nBlkSizeX != 16 || d.analysisData.nBlkSizeY != 2) &&
(d.analysisData.nBlkSizeX != 16 || d.analysisData.nBlkSizeY != 8) &&
(d.analysisData.nBlkSizeX != 16 || d.analysisData.nBlkSizeY != 16) &&
(d.analysisData.nBlkSizeX != 32 || d.analysisData.nBlkSizeY != 32) &&
(d.analysisData.nBlkSizeX != 32 || d.analysisData.nBlkSizeY != 16)) {
vsapi->setError(out, "Recalculate: the block size must be 4x4, 8x4, 8x8, 16x2, 16x8, 16x16, 32x16, or 32x32.");
(d.analysisData.nBlkSizeX != 32 || d.analysisData.nBlkSizeY != 16) &&
(d.analysisData.nBlkSizeX != 64 || d.analysisData.nBlkSizeY != 32) &&
(d.analysisData.nBlkSizeX != 64 || d.analysisData.nBlkSizeY != 64) &&
(d.analysisData.nBlkSizeX != 128 || d.analysisData.nBlkSizeY != 64) &&
(d.analysisData.nBlkSizeX != 128 || d.analysisData.nBlkSizeY != 128) &&
(d.analysisData.nBlkSizeX != 256 || d.analysisData.nBlkSizeY != 128) &&
(d.analysisData.nBlkSizeX != 256 || d.analysisData.nBlkSizeY != 256)) {
vsapi->setError(out, "Recalculate: the block size must be 2x2, 4x4, 8x4, 8x8, 16x2, 16x8, 16x16, 32x16, or 32x32.");
return;
}
if (d.pnew < 0 || d.pnew > 256) {
Expand Down
2 changes: 1 addition & 1 deletion src/MaskFun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <algorithm>
#include <cstdint>
#include "MaskFun.h"
#include "SADFunctions.h"
#include "SADFunctions.hpp"

template <typename PixelType>
void RealMerge4PlanesToBig(uint8_t *pel2Plane_u8, int32_t pel2Pitch, const uint8_t *pPlane0_u8, const uint8_t *pPlane1_u8,
Expand Down
48 changes: 44 additions & 4 deletions src/PlaneOfBlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ PlaneOfBlocks::PlaneOfBlocks(int32_t _nBlkX, int32_t _nBlkY, int32_t _nBlkSizeX,
globalMVPredictor.sad = zeroMV.sad;
vectors = new VECTOR[nBlkCount];
memset(vectors, 0, nBlkCount*sizeof(VECTOR));
SADFunction sads[33][33];
LUMAFunction lumas[33][33];
COPYFunction blits[33][33];
SADFunction satds[33][33];
static SADFunction sads[257][257];
static LUMAFunction lumas[257][257];
static COPYFunction blits[257][257];
static SADFunction satds[257][257];
sads[2][2] = Sad_C<2, 2, float>;
lumas[2][2] = Luma_C<2, 2, float>;
blits[2][2] = Copy_C<2, 2, float>;
sads[2][4] = Sad_C<2, 4, float>;
blits[2][4] = Copy_C<2, 4, float>;
Expand Down Expand Up @@ -82,6 +83,45 @@ PlaneOfBlocks::PlaneOfBlocks(int32_t _nBlkX, int32_t _nBlkY, int32_t _nBlkSizeX,
lumas[32][32] = Luma_C<32, 32, float>;
blits[32][32] = Copy_C<32, 32, float>;
satds[32][32] = Satd_C<32, 32, float>;
sads[32][64] = Sad_C<32, 64, float>;
sads[64][16] = Sad_C<64, 16, float>;
sads[64][32] = Sad_C<64, 32, float>;
sads[64][64] = Sad_C<64, 64, float>;
sads[64][128] = Sad_C<64, 128, float>;
sads[128][32] = Sad_C<128, 32, float>;
sads[128][64] = Sad_C<128, 64, float>;
sads[128][128] = Sad_C<128, 128, float>;
sads[128][256] = Sad_C<128, 256, float>;
sads[256][64] = Sad_C<256, 64, float>;
sads[256][128] = Sad_C<256, 128, float>;
sads[256][256] = Sad_C<256, 256, float>;
lumas[32][64] = Luma_C<32, 64, float>;
lumas[64][16] = Luma_C<64, 16, float>;
lumas[64][32] = Luma_C<64, 32, float>;
lumas[64][64] = Luma_C<64, 64, float>;
lumas[64][128] = Luma_C<64, 128, float>;
lumas[128][32] = Luma_C<128, 32, float>;
lumas[128][64] = Luma_C<128, 64, float>;
lumas[128][128] = Luma_C<128, 128, float>;
lumas[128][256] = Luma_C<128, 256, float>;
lumas[256][64] = Luma_C<256, 64, float>;
lumas[256][128] = Luma_C<256, 128, float>;
lumas[256][256] = Luma_C<256, 256, float>;
blits[32][64] = Copy_C<32, 64, float>;
blits[64][16] = Copy_C<64, 16, float>;
blits[64][32] = Copy_C<64, 32, float>;
blits[64][64] = Copy_C<64, 64, float>;
blits[64][128] = Copy_C<64, 128, float>;
blits[128][32] = Copy_C<128, 32, float>;
blits[128][64] = Copy_C<128, 64, float>;
blits[128][128] = Copy_C<128, 128, float>;
blits[128][256] = Copy_C<128, 256, float>;
blits[256][64] = Copy_C<256, 64, float>;
blits[256][128] = Copy_C<256, 128, float>;
blits[256][256] = Copy_C<256, 256, float>;
satds[64][64] = Satd_C<64, 64, float>;
satds[128][128] = Satd_C<128, 128, float>;
satds[256][256] = Satd_C<256, 256, float>;
SAD = sads[nBlkSizeX][nBlkSizeY];
LUMA = lumas[nBlkSizeX][nBlkSizeY];
BLITLUMA = blits[nBlkSizeX][nBlkSizeY];
Expand Down
2 changes: 1 addition & 1 deletion src/PlaneOfBlocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "MVFrame.h"
#include "Interpolation.h"
#include "CopyCode.h"
#include "SADFunctions.h"
#include "SADFunctions.hpp"
#include "CommonFunctions.h"
#include "Variance.h"
#include "DCT.h"
Expand Down
File renamed without changes.
7 changes: 4 additions & 3 deletions src/fftw3.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ typedef enum fftw_r2r_kind_do_not_use_me X(r2r_kind); \
\
typedef fftw_write_char_func_do_not_use_me X(write_char_func); \
typedef fftw_read_char_func_do_not_use_me X(read_char_func); \
\
FFTW_EXTERN void X(execute)(const X(plan) p); \
\
FFTW_EXTERN void X(execute)(const X(plan) p); \
\
FFTW_EXTERN X(plan) X(plan_dft)(int rank, const int *n, \
C *in, C *out, int sign, unsigned flags); \
Expand Down Expand Up @@ -320,6 +320,7 @@ FFTW_EXTERN void X(set_timelimit)(double t); \
FFTW_EXTERN void X(plan_with_nthreads)(int nthreads); \
FFTW_EXTERN int X(init_threads)(void); \
FFTW_EXTERN void X(cleanup_threads)(void); \
FFTW_EXTERN void X(make_planner_thread_safe)(void); \
\
FFTW_EXTERN int X(export_wisdom_to_filename)(const char *filename); \
FFTW_EXTERN void X(export_wisdom_to_file)(FILE *output_file); \
Expand Down Expand Up @@ -361,7 +362,7 @@ FFTW_DEFINE_API(FFTW_MANGLE_LONG_DOUBLE, long double, fftwl_complex)
/* __float128 (quad precision) is a gcc extension on i386, x86_64, and ia64
for gcc >= 4.6 (compiled in FFTW with --enable-quad-precision) */
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) \
&& !(defined(__ICC) || defined(__INTEL_COMPILER)) \
&& !(defined(__ICC) || defined(__INTEL_COMPILER) || defined(__CUDACC__) || defined(__PGI)) \
&& (defined(__i386__) || defined(__x86_64__) || defined(__ia64__))
# if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
/* note: __float128 is a typedef, which is not supported with the _Complex
Expand Down
Binary file modified src/libfftw3-3.lib
Binary file not shown.

0 comments on commit 3c70356

Please sign in to comment.