refactor(libvideo2x): convert the video processor into a class (#1246)

Signed-off-by: k4yt3x <i@k4yt3x.com>
This commit is contained in:
K4YT3X
2024-12-03 05:22:07 +00:00
committed by GitHub
parent a379c7481e
commit d4d1e58f8d
16 changed files with 612 additions and 665 deletions

View File

@@ -3,13 +3,51 @@
#include <cstdint>
#include <filesystem>
#include <vector>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/pixdesc.h>
}
#include "libvideo2x/libvideo2x.h"
#include "fsutils.h"
// Encoder configurations
struct EncoderConfig {
// Non-AVCodecContext options
AVCodecID codec;
bool copy_streams;
// Basic video options
int width;
int height;
int frm_rate_mul;
AVPixelFormat pix_fmt;
// Rate control and compression
int64_t bit_rate;
int rc_buffer_size;
int rc_min_rate;
int rc_max_rate;
int qmin;
int qmax;
// GOP and frame structure
int gop_size;
int max_b_frames;
int keyint_min;
int refs;
// Performance and threading
int thread_count;
// Latency and buffering
int delay;
// Extra AVOptions
std::vector<std::pair<StringType, StringType>> extra_opts;
};
class Encoder {
public:
@@ -22,7 +60,6 @@ class Encoder {
AVFormatContext *ifmt_ctx,
AVCodecContext *dec_ctx,
EncoderConfig &enc_cfg,
const ProcessorConfig &proc_cfg,
int in_vstream_idx
);