mirror of
https://github.com/k4yt3x/video2x.git
synced 2026-02-13 16:44:47 +08:00
feat(rife): add support for frame interpolation and RIFE (#1244)
* feat: add RIFE files and processor/interpolator abstractions * feat: add `rife` as processor option * feat: add frame interpolation math except first frame * feat: complete motion interpolation and add scene detection * feat: improve Vulkan device validation * fix: fix casting issues and variable names * refactor: improve error-checking; add abstractions and factories * refactor: improve readability of the frames processor * docs: update changelog Signed-off-by: k4yt3x <i@k4yt3x.com>
This commit is contained in:
45
include/libvideo2x/processor.h
Normal file
45
include/libvideo2x/processor.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef PROCESSOR_H
|
||||
#define PROCESSOR_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavfilter/avfilter.h>
|
||||
#include <libavutil/buffer.h>
|
||||
}
|
||||
|
||||
#include "libvideo2x.h"
|
||||
|
||||
class Processor {
|
||||
public:
|
||||
virtual ~Processor() = default;
|
||||
virtual int init(AVCodecContext *dec_ctx, AVCodecContext *enc_ctx, AVBufferRef *hw_ctx) = 0;
|
||||
virtual int flush(std::vector<AVFrame *> &_) { return 0; }
|
||||
virtual ProcessingMode get_processing_mode() const = 0;
|
||||
virtual ProcessorType get_processor_type() const = 0;
|
||||
virtual void get_output_dimensions(
|
||||
const ProcessorConfig *processor_config,
|
||||
int in_width,
|
||||
int in_height,
|
||||
int &width,
|
||||
int &height
|
||||
) const = 0;
|
||||
};
|
||||
|
||||
// Abstract base class for filters
|
||||
class Filter : public Processor {
|
||||
public:
|
||||
ProcessingMode get_processing_mode() const override { return PROCESSING_MODE_FILTER; }
|
||||
virtual int filter(AVFrame *in_frame, AVFrame **out_frame) = 0;
|
||||
};
|
||||
|
||||
// Abstract base class for interpolators
|
||||
class Interpolator : public Processor {
|
||||
public:
|
||||
ProcessingMode get_processing_mode() const override { return PROCESSING_MODE_INTERPOLATE; }
|
||||
virtual int
|
||||
interpolate(AVFrame *prev_frame, AVFrame *in_frame, AVFrame **out_frame, float time_step) = 0;
|
||||
};
|
||||
|
||||
#endif // PROCESSOR_H
|
||||
Reference in New Issue
Block a user