Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Sources/MDegrainN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1948,8 +1948,10 @@ void MDegrainN::use_block_uv(
if (usable_flag)
{
const FakeBlockData &block = c_info._clip_sptr->GetBlock(0, i);
const int blx = block.GetX() * nPel + block.GetMV().x;
const int bly = block.GetY() * nPel + block.GetMV().y;
int blx = block.GetX() * nPel + block.GetMV().x;
int bly = block.GetY() * nPel + block.GetMV().y;
if (nLogxRatioUV_super == 1) blx++; // add bias for integer division for 4:2:x formats
if (nLogyRatioUV_super == 1) bly++; // add bias for integer division for 4:2:x formats
p = plane_ptr->GetPointer(blx >> nLogxRatioUV_super, bly >> nLogyRatioUV_super);
np = plane_ptr->GetPitch();
const sad_t block_sad = block.GetSAD(); // SAD of MV Block. Scaled to MVClip's bits_per_pixel;
Expand Down
92 changes: 61 additions & 31 deletions Sources/MVCompensate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,12 +678,14 @@ void MVCompensate::compensate_slice_normal(Slicer::TaskData &td)
BLITLUMA(
pDstCur[0] + xx, nDstPitches[0],
pPlanes[0]->GetPointer(blx, bly), pPlanes[0]->GetPitch()
);
);
for (int i = 1; i < planecount; i++) {
if (pPlanes[i])
{
{
int blx_uv = (nLogxRatioUVs[i] == 1) ? blx + 1 : blx; // add bias for integer division for 4:2:x formats
int bly_uv = (nLogyRatioUVs[i] == 1) ? bly + 1 : bly; // add bias for integer division for 4:2:x formats
BLITCHROMA(pDstCur[i] + (xx >> nLogxRatioUVs[i]), nDstPitches[i],
pPlanes[i]->GetPointer(blx >> nLogxRatioUVs[i], bly >> nLogyRatioUVs[i]), pPlanes[i]->GetPitch()
pPlanes[i]->GetPointer(blx_uv >> nLogxRatioUVs[i], bly_uv >> nLogyRatioUVs[i]), pPlanes[i]->GetPitch()
);
}
}
Expand All @@ -698,11 +700,15 @@ void MVCompensate::compensate_slice_normal(Slicer::TaskData &td)
pSrcPlanes[0]->GetPointer(blxsrc, blysrc), pSrcPlanes[0]->GetPitch()
);
for (int i = 1; i < planecount; i++) {
if (pSrcPlanes[i])
if (pSrcPlanes[i])
{
int blxsrc_uv = (nLogxRatioUVs[i] == 1) ? blxsrc + 1 : blxsrc; // add bias for integer division for 4:2:x formats
int blysrc_uv = (nLogyRatioUVs[i] == 1) ? blysrc + 1 : blysrc; // add bias for integer division for 4:2:x formats
BLITCHROMA(
pDstCur[i] + (xx >> nLogxRatioUVs[i]), nDstPitches[i],
pSrcPlanes[i]->GetPointer(blxsrc >> nLogxRatioUVs[i], blysrc >> nLogyRatioUVs[i]), pSrcPlanes[i]->GetPitch()
);
pSrcPlanes[i]->GetPointer(blxsrc_uv >> nLogxRatioUVs[i], blysrc_uv >> nLogyRatioUVs[i]), pSrcPlanes[i]->GetPitch()
);
}
}
}

Expand Down Expand Up @@ -831,12 +837,16 @@ void MVCompensate::compensate_slice_overlap(int y_beg, int y_end)
winOver, nBlkSizeX
);
for (int i = 1; i < planecount; i++) {
if (pPlanes[i])
if (pPlanes[i])
{
int blx_uv = (nLogxRatioUVs[i] == 1) ? blx + 1 : blx; // add bias for integer division for 4:2:x formats
int bly_uv = (nLogyRatioUVs[i] == 1) ? bly + 1 : bly; // add bias for integer division for 4:2:x formats
OVERSCHROMA(
(uint16_t *)(pDstShorts[i] + (xx >> nLogxRatioUVs[i])), dstShortPitches[i],
pPlanes[i]->GetPointer(blx >> nLogxRatioUVs[i], bly >> nLogyRatioUVs[i]), pPlanes[i]->GetPitch(),
(uint16_t*)(pDstShorts[i] + (xx >> nLogxRatioUVs[i])), dstShortPitches[i],
pPlanes[i]->GetPointer(blx_uv >> nLogxRatioUVs[i], bly_uv >> nLogyRatioUVs[i]), pPlanes[i]->GetPitch(),
winOverUV, nBlkSizeX >> nLogxRatioUVs[i]
);
);
}
}
}
else if (pixelsize_super == 2) {
Expand All @@ -848,12 +858,16 @@ void MVCompensate::compensate_slice_overlap(int y_beg, int y_end)
);
// chroma uv
for (int i = 1; i < planecount; i++) {
if (pPlanes[i])
if (pPlanes[i])
{
int blx_uv = (nLogxRatioUVs[i] == 1) ? blx + 1 : blx; // add bias for integer division for 4:2:x formats
int bly_uv = (nLogyRatioUVs[i] == 1) ? bly + 1 : bly; // add bias for integer division for 4:2:x formats
OVERSCHROMA16(
(uint16_t *)(pDstShorts[i] + (xx >> nLogxRatioUVs[i])), dstShortPitches[i],
pPlanes[i]->GetPointer(blx >> nLogxRatioUVs[i], bly >> nLogyRatioUVs[i]), pPlanes[i]->GetPitch(),
(uint16_t*)(pDstShorts[i] + (xx >> nLogxRatioUVs[i])), dstShortPitches[i],
pPlanes[i]->GetPointer(blx_uv >> nLogxRatioUVs[i], bly_uv >> nLogyRatioUVs[i]), pPlanes[i]->GetPitch(),
winOverUV, nBlkSizeX >> nLogxRatioUVs[i]
);
);
}
}
}
else { // pixelsize_super == 4
Expand All @@ -865,12 +879,16 @@ void MVCompensate::compensate_slice_overlap(int y_beg, int y_end)
);
// chroma uv
for (int i = 1; i < planecount; i++) {
if (pPlanes[i])
if (pPlanes[i])
{
int blx_uv = (nLogxRatioUVs[i] == 1) ? blx + 1 : blx; // add bias for integer division for 4:2:x formats
int bly_uv = (nLogyRatioUVs[i] == 1) ? bly + 1 : bly; // add bias for integer division for 4:2:x formats
OVERSCHROMA32(
(uint16_t *)(pDstShorts[i] + (xx >> nLogxRatioUVs[i])), dstShortPitches[i],
pPlanes[i]->GetPointer(blx >> nLogxRatioUVs[i], bly >> nLogyRatioUVs[i]), pPlanes[i]->GetPitch(),
(uint16_t*)(pDstShorts[i] + (xx >> nLogxRatioUVs[i])), dstShortPitches[i],
pPlanes[i]->GetPointer(blx_uv >> nLogxRatioUVs[i], bly_uv >> nLogyRatioUVs[i]), pPlanes[i]->GetPitch(),
winOverUV, nBlkSizeX >> nLogxRatioUVs[i]
);
);
}
}
}
}
Expand All @@ -889,12 +907,16 @@ void MVCompensate::compensate_slice_overlap(int y_beg, int y_end)
);
// chroma uv
for (int i = 1; i < planecount; i++) {
if (pSrcPlanes[i])
if (pSrcPlanes[i])
{
int blxsrc_uv = (nLogxRatioUVs[i] == 1) ? blxsrc + 1 : blxsrc; // add bias for integer division for 4:2:x formats
int blysrc_uv = (nLogyRatioUVs[i] == 1) ? blysrc + 1 : blysrc; // add bias for integer division for 4:2:x formats
OVERSCHROMA(
(uint16_t *)(pDstShorts[i] + (xx >> nLogxRatioUVs[i])), dstShortPitches[i],
pSrcPlanes[i]->GetPointer(blxsrc >> nLogxRatioUVs[i], blysrc >> nLogyRatioUVs[i]), pSrcPlanes[i]->GetPitch(),
(uint16_t*)(pDstShorts[i] + (xx >> nLogxRatioUVs[i])), dstShortPitches[i],
pSrcPlanes[i]->GetPointer(blxsrc_uv >> nLogxRatioUVs[i], blysrc_uv >> nLogyRatioUVs[i]), pSrcPlanes[i]->GetPitch(),
winOverUV, nBlkSizeX >> nLogxRatioUVs[i]
);
);
}
}
}
else if (pixelsize_super == 2){
Expand All @@ -906,12 +928,16 @@ void MVCompensate::compensate_slice_overlap(int y_beg, int y_end)
);
// chroma uv
for (int i = 1; i < planecount; i++) {
if (pSrcPlanes[i])
if (pSrcPlanes[i])
{
int blxsrc_uv = (nLogxRatioUVs[i] == 1) ? blxsrc + 1 : blxsrc; // add bias for integer division for 4:2:x formats
int blysrc_uv = (nLogyRatioUVs[i] == 1) ? blysrc + 1 : blysrc; // add bias for integer division for 4:2:x formats
OVERSCHROMA16(
(uint16_t *)(pDstShorts[i] + (xx >> nLogxRatioUVs[i])), dstShortPitches[i],
pSrcPlanes[i]->GetPointer(blxsrc >> nLogxRatioUVs[i], blysrc >> nLogyRatioUVs[i]), pSrcPlanes[i]->GetPitch(),
(uint16_t*)(pDstShorts[i] + (xx >> nLogxRatioUVs[i])), dstShortPitches[i],
pSrcPlanes[i]->GetPointer(blxsrc_uv >> nLogxRatioUVs[i], blysrc_uv >> nLogyRatioUVs[i]), pSrcPlanes[i]->GetPitch(),
winOverUV, nBlkSizeX >> nLogxRatioUVs[i]
);
);
}
}
}
else { // if (pixelsize_super == 4)
Expand All @@ -922,12 +948,16 @@ void MVCompensate::compensate_slice_overlap(int y_beg, int y_end)
);
// chroma uv
for (int i = 1; i < planecount; i++) {
if (pSrcPlanes[i])
if (pSrcPlanes[i])
{
int blxsrc_uv = (nLogxRatioUVs[i] == 1) ? blxsrc + 1 : blxsrc; // add bias for integer division for 4:2:x formats
int blysrc_uv = (nLogyRatioUVs[i] == 1) ? blysrc + 1 : blysrc; // add bias for integer division for 4:2:x formats
OVERSCHROMA32(
(uint16_t *)(pDstShorts[i] + (xx >> nLogxRatioUVs[i])), dstShortPitches[i],
pSrcPlanes[i]->GetPointer(blxsrc >> nLogxRatioUVs[i], blysrc >> nLogyRatioUVs[i]), pSrcPlanes[i]->GetPitch(),
winOverUV, nBlkSizeX >> nLogxRatioUVs[i]
);
(uint16_t*)(pDstShorts[i] + (xx >> nLogxRatioUVs[i])), dstShortPitches[i],
pSrcPlanes[i]->GetPointer(blxsrc_uv >> nLogxRatioUVs[i], blysrc_uv >> nLogyRatioUVs[i]), pSrcPlanes[i]->GetPitch(),
winOverUV, nBlkSizeX >> nLogxRatioUVs[i]
);
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion Sources/MVDegrain3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,9 @@ MV_FORCEINLINE void MVDegrainX::use_block_uv(const BYTE * &p, int &np, int &WRef
{
const FakeBlockData &block = mvclip.GetBlock(0, i);
int blx = block.GetX() * nPel + block.GetMV().x;
int bly = block.GetY() * nPel + block.GetMV().y;
int bly = block.GetY() * nPel + block.GetMV().y;
if (nLogxRatioUV_super == 1) blx++; // add bias for integer division for 4:2:x formats
if (nLogyRatioUV_super == 1) bly++; // add bias for integer division for 4:2:x formats
p = pPlane->GetPointer(blx >> nLogxRatioUV_super, bly >> nLogyRatioUV_super); // pixelsize - aware
np = pPlane->GetPitch();
sad_t blockSAD = block.GetSAD(); // SAD of MV Block. Scaled to MVClip's bits_per_pixel;
Expand Down
17 changes: 11 additions & 6 deletions Sources/PlaneOfBlocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,18 +409,23 @@ class PlaneOfBlocks

MV_FORCEINLINE const uint8_t* GetRefBlockU(WorkingArea& workarea, int nVx, int nVy)
{
int nVx1 = (nLogxRatioUV == 1) ? nVx + 1 : nVx;
int nVy1 = (nLogyRatioUV == 1) ? nVy + 1 : nVy;
return
(nPel == 2) ? pRefFrame->GetPlane(UPLANE)->GetAbsolutePointerPel <1>((workarea.x[1] << 1) + (nVx >> nLogxRatioUV), (workarea.y[1] << 1) + (nVy >> nLogyRatioUV)) :
(nPel == 1) ? pRefFrame->GetPlane(UPLANE)->GetAbsolutePointerPel <0>((workarea.x[1]) + (nVx >> nLogxRatioUV), (workarea.y[1]) + (nVy >> nLogyRatioUV)) :
pRefFrame->GetPlane(UPLANE)->GetAbsolutePointerPel <2>((workarea.x[1] << 2) + (nVx >> nLogxRatioUV), (workarea.y[1] << 2) + (nVy >> nLogyRatioUV));
(nPel == 2) ? pRefFrame->GetPlane(UPLANE)->GetAbsolutePointerPel <1>((workarea.x[1] << 1) + (nVx1 >> nLogxRatioUV), (workarea.y[1] << 1) + (nVy1 >> nLogyRatioUV)) :
(nPel == 1) ? pRefFrame->GetPlane(UPLANE)->GetAbsolutePointerPel <0>((workarea.x[1]) + (nVx1 >> nLogxRatioUV), (workarea.y[1]) + (nVy1 >> nLogyRatioUV)) :
pRefFrame->GetPlane(UPLANE)->GetAbsolutePointerPel <2>((workarea.x[1] << 2) + (nVx1 >> nLogxRatioUV), (workarea.y[1] << 2) + (nVy1 >> nLogyRatioUV));

}

MV_FORCEINLINE const uint8_t* GetRefBlockV(WorkingArea& workarea, int nVx, int nVy)
{
int nVx1 = (nLogxRatioUV == 1) ? nVx + 1 : nVx;
int nVy1 = (nLogyRatioUV == 1) ? nVy + 1 : nVy;
return
(nPel == 2) ? pRefFrame->GetPlane(VPLANE)->GetAbsolutePointerPel <1>((workarea.x[2] << 1) + (nVx >> nLogxRatioUV), (workarea.y[2] << 1) + (nVy >> nLogyRatioUV)) :
(nPel == 1) ? pRefFrame->GetPlane(VPLANE)->GetAbsolutePointerPel <0>((workarea.x[2]) + (nVx >> nLogxRatioUV), (workarea.y[2]) + (nVy >> nLogyRatioUV)) :
pRefFrame->GetPlane(VPLANE)->GetAbsolutePointerPel <2>((workarea.x[2] << 2) + (nVx >> nLogxRatioUV), (workarea.y[2] << 2) + (nVy >> nLogyRatioUV));
(nPel == 2) ? pRefFrame->GetPlane(VPLANE)->GetAbsolutePointerPel <1>((workarea.x[2] << 1) + (nVx1 >> nLogxRatioUV), (workarea.y[2] << 1) + (nVy1 >> nLogyRatioUV)) :
(nPel == 1) ? pRefFrame->GetPlane(VPLANE)->GetAbsolutePointerPel <0>((workarea.x[2]) + (nVx1 >> nLogxRatioUV), (workarea.y[2]) + (nVy1 >> nLogyRatioUV)) :
pRefFrame->GetPlane(VPLANE)->GetAbsolutePointerPel <2>((workarea.x[2] << 2) + (nVx1 >> nLogxRatioUV), (workarea.y[2] << 2) + (nVy1 >> nLogyRatioUV));
}

MV_FORCEINLINE const uint8_t* GetSrcBlock(int nX, int nY)
Expand Down