mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-20 02:23:54 +08:00
* rgb to nv12
* nv12 works (w memcpy)
* correct now
* no copy
* fix nv12 with fast debayer
* reverts of unused stuff
* ui use nv12
* comment out thumbnails for now
* rebase fix
* dm read nv12
* model read nv12
* fix ffmpeg encoder
* thumbnails from nv12
* replay to nv12
* python framereader support nv12
* remove hardcoded frame/buffer sizes
* fix build
* ffmpeg encoder fix buffers
* small cleanup
* reduce power usage test
* fix cpu usage test
* fix snapshot
* fix loggerd test
* bump cereal
Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Joost Wooning <jwooning@gmail.com>
old-commit-hash: ea5b8cdfb1
38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <cstdio>
|
|
#include <cstdlib>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
extern "C" {
|
|
#include <libavcodec/avcodec.h>
|
|
#include <libavformat/avformat.h>
|
|
#include <libavutil/imgutils.h>
|
|
}
|
|
|
|
#include "selfdrive/loggerd/encoder/encoder.h"
|
|
#include "selfdrive/loggerd/loggerd.h"
|
|
|
|
class FfmpegEncoder : public VideoEncoder {
|
|
public:
|
|
FfmpegEncoder(const char* filename, CameraType type, int in_width, int in_height, int fps,
|
|
int bitrate, cereal::EncodeIndex::Type codec, int out_width, int out_height, bool write) :
|
|
VideoEncoder(filename, type, in_width, in_height, fps, bitrate, cereal::EncodeIndex::Type::BIG_BOX_LOSSLESS, out_width, out_height, write) { encoder_init(); }
|
|
~FfmpegEncoder();
|
|
void encoder_init();
|
|
int encode_frame(VisionBuf* buf, VisionIpcBufExtra *extra);
|
|
void encoder_open(const char* path);
|
|
void encoder_close();
|
|
|
|
private:
|
|
int segment_num = -1;
|
|
int counter = 0;
|
|
bool is_open = false;
|
|
|
|
AVCodecContext *codec_ctx;
|
|
AVFrame *frame = NULL;
|
|
std::vector<uint8_t> convert_buf;
|
|
std::vector<uint8_t> downscale_buf;
|
|
};
|