Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #484 #486

Merged
merged 1 commit into from
Apr 24, 2020
Merged
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: 1 addition & 5 deletions tools/ld-analyse/ld-analyse.pro
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ SOURCES += \
../ld-chroma-decoder/transformpal2d.cpp \
../ld-chroma-decoder/transformpal3d.cpp \
../ld-chroma-decoder/framecanvas.cpp \
../ld-chroma-decoder/opticalflow.cpp \
../ld-chroma-decoder/sourcefield.cpp \
../library/tbc/lddecodemetadata.cpp \
../library/tbc/sourcevideo.cpp \
Expand Down Expand Up @@ -77,7 +76,6 @@ HEADERS += \
../ld-chroma-decoder/transformpal3d.h \
../ld-chroma-decoder/framecanvas.h \
../ld-chroma-decoder/yiqbuffer.h \
../ld-chroma-decoder/opticalflow.h \
../ld-chroma-decoder/sourcefield.h \
../library/filter/firfilter.h \
../library/tbc/lddecodemetadata.h \
Expand Down Expand Up @@ -126,15 +124,13 @@ RESOURCES += \
# Additional include paths to support MacOS compilation
macx {
ICON = Graphics/ld-analyse.icns
INCLUDEPATH += "/usr/local/opt/opencv@2/include"
LIBS += -L"/usr/local/opt/opencv@2/lib"
INCLUDEPATH += "/usr/local/include"
}

# Normal open-source OS goodness
INCLUDEPATH += "/usr/local/include/opencv"
LIBS += -L"/usr/local/lib"
LIBS += -lopencv_core -lopencv_imgcodecs -lopencv_highgui -lopencv_imgproc -lopencv_video -lfftw3
LIBS += -lfftw3

# Include the QWT library (used for charting)
unix:!macx {
Expand Down
82 changes: 19 additions & 63 deletions tools/ld-chroma-decoder/comb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,76 +94,32 @@ RGBFrame Comb::decodeFrame(const SourceField &firstField, const SourceField &sec
currentFrameBuffer.firstFieldPhaseID = firstField.field.fieldPhaseID;
currentFrameBuffer.secondFieldPhaseID = secondField.field.fieldPhaseID;

// 2D or 3D comb filter processing?
if (!configuration.use3D) {
// 2D comb filter processing
// Note: Only 2D processing is currently supported, requests for 3D processing result in the
// same output. This needs to be replaced with a real 3D process

// Perform 1D processing
split1D(&currentFrameBuffer);
// 2D comb filter processing

// Perform 2D processing
split2D(&currentFrameBuffer);
// Perform 1D processing
split1D(&currentFrameBuffer);

// Split the IQ values
splitIQ(&currentFrameBuffer);
// Perform 2D processing
split2D(&currentFrameBuffer);

// Copy the current frame to a temporary buffer, so operations on the frame do not
// alter the original data
tempYiqBuffer = currentFrameBuffer.yiqBuffer;
// Split the IQ values
splitIQ(&currentFrameBuffer);

// Process the copy of the current frame
adjustY(&currentFrameBuffer, tempYiqBuffer);
if (configuration.colorlpf) filterIQ(currentFrameBuffer.yiqBuffer);
doYNR(tempYiqBuffer);
doCNR(tempYiqBuffer);
// Copy the current frame to a temporary buffer, so operations on the frame do not
// alter the original data
tempYiqBuffer = currentFrameBuffer.yiqBuffer;

// Convert the YIQ result to RGB
rgbOutputBuffer = yiqToRgbFrame(tempYiqBuffer);
} else {
// 3D comb filter processing
// Process the copy of the current frame
adjustY(&currentFrameBuffer, tempYiqBuffer);
if (configuration.colorlpf) filterIQ(currentFrameBuffer.yiqBuffer);
doYNR(tempYiqBuffer);
doCNR(tempYiqBuffer);

// Perform 1D processing
split1D(&currentFrameBuffer);

// Perform 2D processing
split2D(&currentFrameBuffer);

// Split the IQ values (populates Y)
splitIQ(&currentFrameBuffer);

tempYiqBuffer = currentFrameBuffer.yiqBuffer;

// Process the copy of the current frame (needed for the Y image used by the optical flow)
adjustY(&currentFrameBuffer, tempYiqBuffer);
if (configuration.colorlpf) filterIQ(currentFrameBuffer.yiqBuffer);
doYNR(tempYiqBuffer);
doCNR(tempYiqBuffer);

opticalFlow.denseOpticalFlow(currentFrameBuffer.yiqBuffer, currentFrameBuffer.kValues);

// Perform 3D processing
split3D(&currentFrameBuffer, &previousFrameBuffer);

// Split the IQ values
splitIQ(&currentFrameBuffer);

tempYiqBuffer = currentFrameBuffer.yiqBuffer;

// Process the copy of the current frame (for final output now flow detection has been performed)
adjustY(&currentFrameBuffer, tempYiqBuffer);
if (configuration.colorlpf) filterIQ(currentFrameBuffer.yiqBuffer);
doYNR(tempYiqBuffer);
doCNR(tempYiqBuffer);

// Convert the YIQ result to RGB
rgbOutputBuffer = yiqToRgbFrame(tempYiqBuffer);

// Overlay the optical flow map if required
if (configuration.showOpticalFlowMap) overlayOpticalFlowMap(currentFrameBuffer, rgbOutputBuffer);

// Store the current frame
previousFrameBuffer = currentFrameBuffer;
}
// Convert the YIQ result to RGB
rgbOutputBuffer = yiqToRgbFrame(tempYiqBuffer);

// Return the output frame
return rgbOutputBuffer;
Expand Down
4 changes: 0 additions & 4 deletions tools/ld-chroma-decoder/comb.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

#include "lddecodemetadata.h"

#include "opticalflow.h"
#include "rgb.h"
#include "rgbframe.h"
#include "sourcefield.h"
Expand Down Expand Up @@ -95,9 +94,6 @@ class Comb
qint32 secondFieldPhaseID; // The phase of the frame's second field
};

// Optical flow processor
OpticalFlow opticalFlow;

// Previous and next frame for 3D processing
FrameBuffer previousFrameBuffer;

Expand Down
7 changes: 1 addition & 6 deletions tools/ld-chroma-decoder/ld-chroma-decoder.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ SOURCES += \
main.cpp \
monodecoder.cpp \
ntscdecoder.cpp \
opticalflow.cpp \
palcolour.cpp \
paldecoder.cpp \
rgb.cpp \
Expand All @@ -43,7 +42,6 @@ HEADERS += \
framecanvas.h \
monodecoder.h \
ntscdecoder.h \
opticalflow.h \
palcolour.h \
paldecoder.h \
rgb.h \
Expand Down Expand Up @@ -86,12 +84,9 @@ unix:!android: target.path = $$PREFIX/bin/

# Additional include paths to support MacOS compilation
macx {
INCLUDEPATH += "/usr/local/opt/opencv@2/include"
LIBS += -L"/usr/local/opt/opencv@2/lib"
INCLUDEPATH += "/usr/local/include"
}

# Normal open-source OS goodness
INCLUDEPATH += "/usr/local/include/opencv"
LIBS += -L"/usr/local/lib"
LIBS += -lopencv_core -lopencv_imgproc -lopencv_video -lfftw3
LIBS += -lfftw3
98 changes: 0 additions & 98 deletions tools/ld-chroma-decoder/opticalflow.cpp

This file was deleted.

60 changes: 0 additions & 60 deletions tools/ld-chroma-decoder/opticalflow.h

This file was deleted.