Skip to content

Commit

Permalink
make overlap9windows float
Browse files Browse the repository at this point in the history
  • Loading branch information
IFeelBloated committed May 15, 2020
1 parent f3c0644 commit e5db0f3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions src/MVBlockFPS.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,8 @@ static const VSFrameRef *VS_CC mvblockfpsGetFrame(int32_t n, int32_t activationR
int32_t xxUV = 0;
for (int bx = 0; bx < nBlkX; bx++) {
int32_t wbx = (bx + nBlkX - 3) / (nBlkX - 2);
int32_t *winOver = OverWins->GetWindow(wby + wbx);
int32_t *winOverUV = nullptr;
auto winOver = OverWins->GetWindow(wby + wbx);
auto winOverUV = static_cast<double*>(nullptr);
if (nSuperModeYUV & UVPLANES)
winOverUV = OverWinsUV->GetWindow(wby + wbx);
int32_t i = by * nBlkX + bx;
Expand Down
4 changes: 2 additions & 2 deletions src/MVCompensate.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ static const VSFrameRef *VS_CC mvcompensateGetFrame(int32_t n, int32_t activatio
int32_t xx = 0;
for (int32_t bx = 0; bx<nBlkX; bx++) {
int32_t wbx = (bx + nBlkX - 3) / (nBlkX - 2);
int32_t *winOver = OverWins->GetWindow(wby + wbx);
int32_t *winOverUV = nullptr;
auto winOver = OverWins->GetWindow(wby + wbx);
auto winOverUV = static_cast<double*>(nullptr);
if (nSuperModeYUV & UVPLANES)
winOverUV = OverWinsUV->GetWindow(wby + wbx);
int32_t i = by*nBlkX + bx;
Expand Down
2 changes: 1 addition & 1 deletion src/MVDegrain.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ static const VSFrameRef* VS_CC mvdegrainGetFrame(int32_t n, int32_t activationRe
int32_t xx = 0;
for (int32_t bx = 0; bx < nBlkX; bx++) {
int32_t wbx = (bx + nBlkX - 3) / (nBlkX - 2);
int32_t* winOver = OverWins[plane]->GetWindow(wby + wbx);
auto winOver = OverWins[plane]->GetWindow(wby + wbx);
int32_t i = by * nBlkX + bx;
auto pointers = d->CreateArray<const uint8_t*>();
auto strides = d->CreateArray<int32_t>();
Expand Down
48 changes: 24 additions & 24 deletions src/Overlap.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class OverlapWindows {
int32_t ox;
int32_t oy;
int32_t size;
int32_t * Overlap9Windows;
double *Overlap9Windows;
double *fWin1UVx;
double *fWin1UVxfirst;
double *fWin1UVxlast;
Expand Down Expand Up @@ -82,31 +82,31 @@ class OverlapWindows {
}


Overlap9Windows = new int32_t[size * 9];
Overlap9Windows = new double[size * 9];

int32_t* winOverUVTL = Overlap9Windows;
int32_t* winOverUVTM = Overlap9Windows + size;
int32_t* winOverUVTR = Overlap9Windows + size * 2;
int32_t* winOverUVML = Overlap9Windows + size * 3;
int32_t* winOverUVMM = Overlap9Windows + size * 4;
int32_t* winOverUVMR = Overlap9Windows + size * 5;
int32_t* winOverUVBL = Overlap9Windows + size * 6;
int32_t* winOverUVBM = Overlap9Windows + size * 7;
int32_t* winOverUVBR = Overlap9Windows + size * 8;
auto winOverUVTL = Overlap9Windows;
auto winOverUVTM = Overlap9Windows + size;
auto winOverUVTR = Overlap9Windows + size * 2;
auto winOverUVML = Overlap9Windows + size * 3;
auto winOverUVMM = Overlap9Windows + size * 4;
auto winOverUVMR = Overlap9Windows + size * 5;
auto winOverUVBL = Overlap9Windows + size * 6;
auto winOverUVBM = Overlap9Windows + size * 7;
auto winOverUVBR = Overlap9Windows + size * 8;

for (int32_t j = 0; j < ny; j++)
{
for (int32_t i = 0; i < nx; i++)
{
winOverUVTL[i] = (int32_t)(fWin1UVyfirst[j] * fWin1UVxfirst[i] * 2048 + 0.5f);
winOverUVTM[i] = (int32_t)(fWin1UVyfirst[j] * fWin1UVx[i] * 2048 + 0.5f);
winOverUVTR[i] = (int32_t)(fWin1UVyfirst[j] * fWin1UVxlast[i] * 2048 + 0.5f);
winOverUVML[i] = (int32_t)(fWin1UVy[j] * fWin1UVxfirst[i] * 2048 + 0.5f);
winOverUVMM[i] = (int32_t)(fWin1UVy[j] * fWin1UVx[i] * 2048 + 0.5f);
winOverUVMR[i] = (int32_t)(fWin1UVy[j] * fWin1UVxlast[i] * 2048 + 0.5f);
winOverUVBL[i] = (int32_t)(fWin1UVylast[j] * fWin1UVxfirst[i] * 2048 + 0.5f);
winOverUVBM[i] = (int32_t)(fWin1UVylast[j] * fWin1UVx[i] * 2048 + 0.5f);
winOverUVBR[i] = (int32_t)(fWin1UVylast[j] * fWin1UVxlast[i] * 2048 + 0.5f);
winOverUVTL[i] = fWin1UVyfirst[j] * fWin1UVxfirst[i] * 2048;
winOverUVTM[i] = fWin1UVyfirst[j] * fWin1UVx[i] * 2048;
winOverUVTR[i] = fWin1UVyfirst[j] * fWin1UVxlast[i] * 2048;
winOverUVML[i] = fWin1UVy[j] * fWin1UVxfirst[i] * 2048;
winOverUVMM[i] = fWin1UVy[j] * fWin1UVx[i] * 2048;
winOverUVMR[i] = fWin1UVy[j] * fWin1UVxlast[i] * 2048;
winOverUVBL[i] = fWin1UVylast[j] * fWin1UVxfirst[i] * 2048;
winOverUVBM[i] = fWin1UVylast[j] * fWin1UVx[i] * 2048;
winOverUVBR[i] = fWin1UVylast[j] * fWin1UVxlast[i] * 2048;
}
winOverUVTL += nx;
winOverUVTM += nx;
Expand All @@ -131,20 +131,20 @@ class OverlapWindows {
inline int32_t Getnx() const { return nx; }
inline int32_t Getny() const { return ny; }
inline int32_t GetSize() const { return size; }
inline int32_t *GetWindow(int32_t i) const { return Overlap9Windows + size*i; }
auto GetWindow(int32_t i) const { return Overlap9Windows + size*i; }
};

using OverlapsFunction = auto(*)(uint8_t *pDst, intptr_t nDstPitch,
const uint8_t *pSrc, intptr_t nSrcPitch,
int32_t *pWin, intptr_t nWinPitch)->void;
double *pWin, intptr_t nWinPitch)->void;

template <int32_t blockWidth, int32_t blockHeight, typename PixelType2, typename PixelType>
void Overlaps_C(uint8_t *pDst8, intptr_t nDstPitch, const uint8_t *pSrc8, intptr_t nSrcPitch, int32_t *pWin, intptr_t nWinPitch) {
void Overlaps_C(uint8_t *pDst8, intptr_t nDstPitch, const uint8_t *pSrc8, intptr_t nSrcPitch, double *pWin, intptr_t nWinPitch) {
for (int32_t j = 0; j<blockHeight; j++) {
for (int32_t i = 0; i<blockWidth; i++) {
PixelType2 *pDst = (PixelType2 *)pDst8;
const PixelType *pSrc = (const PixelType *)pSrc8;
pDst[i] += ((static_cast<PixelType2>(pSrc[i]) * pWin[i]) / 64);
pDst[i] += (static_cast<PixelType2>(pSrc[i]) * pWin[i]) / 64.;
}
pDst8 += nDstPitch;
pSrc8 += nSrcPitch;
Expand Down

0 comments on commit e5db0f3

Please sign in to comment.