Fix T41785: The combination of movie-distortion and lens-distortion leads to artifacts
This commit is contained in:
parent
89b62804dc
commit
4bbe0c8cde
Notes:
blender-bot
2023-02-14 10:06:00 +01:00
Referenced by issue #41785, The combination of movie-distortion and lens-distortion leads to artifacts
|
@ -68,13 +68,10 @@ void MovieDistortionOperation::initExecution()
|
|||
{
|
||||
this->m_cache = c;
|
||||
this->m_cache->updateLastUsage();
|
||||
this->m_cache->getMargin(this->m_margin);
|
||||
return;
|
||||
}
|
||||
}
|
||||
DistortionCache *newC = new DistortionCache(this->m_movieClip, this->m_width, this->m_height,
|
||||
calibration_width, calibration_height, this->m_distortion);
|
||||
s_cache.push_back(newC);
|
||||
this->m_cache = newC;
|
||||
|
||||
if (this->m_distortion) {
|
||||
float delta[2];
|
||||
|
@ -96,6 +93,14 @@ void MovieDistortionOperation::initExecution()
|
|||
*/
|
||||
m_margin[0] = m_margin[1] = 0;
|
||||
}
|
||||
|
||||
DistortionCache *newC = new DistortionCache(this->m_movieClip,
|
||||
this->m_width, this->m_height,
|
||||
calibration_width, calibration_height,
|
||||
this->m_distortion,
|
||||
this->m_margin);
|
||||
s_cache.push_back(newC);
|
||||
this->m_cache = newC;
|
||||
}
|
||||
else {
|
||||
this->m_cache = NULL;
|
||||
|
|
|
@ -50,9 +50,14 @@ private:
|
|||
float *m_buffer;
|
||||
int *m_bufferCalculated;
|
||||
double timeLastUsage;
|
||||
int m_margin[2];
|
||||
|
||||
public:
|
||||
DistortionCache(MovieClip *movieclip, int width, int height, int calibration_width, int calibration_height, bool inverted) {
|
||||
DistortionCache(MovieClip *movieclip,
|
||||
int width, int height,
|
||||
int calibration_width, int calibration_height,
|
||||
bool inverted,
|
||||
const int margin[2]) {
|
||||
this->m_k1 = movieclip->tracking.camera.k1;
|
||||
this->m_k2 = movieclip->tracking.camera.k2;
|
||||
this->m_k3 = movieclip->tracking.camera.k3;
|
||||
|
@ -66,6 +71,7 @@ public:
|
|||
this->m_inverted = inverted;
|
||||
this->m_bufferCalculated = (int *)MEM_callocN(sizeof(int) * this->m_width * this->m_height, __func__);
|
||||
this->m_buffer = (float *)MEM_mallocN(sizeof(float) * this->m_width * this->m_height * 2, __func__);
|
||||
copy_v2_v2_int(this->m_margin, margin);
|
||||
this->updateLastUsage();
|
||||
}
|
||||
|
||||
|
@ -89,7 +95,10 @@ public:
|
|||
return this->timeLastUsage;
|
||||
}
|
||||
|
||||
bool isCacheFor(MovieClip *movieclip, int width, int height, int calibration_width, int claibration_height, bool inverted) {
|
||||
bool isCacheFor(MovieClip *movieclip,
|
||||
int width, int height,
|
||||
int calibration_width, int claibration_height,
|
||||
bool inverted) {
|
||||
return this->m_k1 == movieclip->tracking.camera.k1 &&
|
||||
this->m_k2 == movieclip->tracking.camera.k2 &&
|
||||
this->m_k3 == movieclip->tracking.camera.k3 &&
|
||||
|
@ -141,6 +150,11 @@ public:
|
|||
*v = this->m_buffer[offset2 + 1];
|
||||
}
|
||||
}
|
||||
|
||||
void getMargin(int margin[2])
|
||||
{
|
||||
copy_v2_v2_int(margin, m_margin);
|
||||
}
|
||||
};
|
||||
|
||||
class MovieDistortionOperation : public NodeOperation {
|
||||
|
|
Loading…
Reference in New Issue