#define SURFACE_NUM 16 /* 16 surfaces for source YUV */
#define MAX_NUM_REF1 16 // Seemingly a hardware-fixed value, not related to SURFACE_NUM
#define SURFACE_NUM 16 /* 16 surfaces for source YUV */
#define MAX_NUM_REF1 16 // Seemingly a hardware-fixed value, not related to SURFACE_NUM
class QuickSyncEncoderImpl {
public:
QuickSyncEncoderImpl(const std::string &filename, movit::ResourcePool *resource_pool, QSurface *surface, const std::string &va_display, int width, int height, AVOutputFormat *oformat, X264Encoder *x264_encoder, DiskSpaceEstimator *disk_space_estimator);
~QuickSyncEncoderImpl();
void add_audio(int64_t pts, std::vector<float> audio);
class QuickSyncEncoderImpl {
public:
QuickSyncEncoderImpl(const std::string &filename, movit::ResourcePool *resource_pool, QSurface *surface, const std::string &va_display, int width, int height, AVOutputFormat *oformat, X264Encoder *x264_encoder, DiskSpaceEstimator *disk_space_estimator);
~QuickSyncEncoderImpl();
void add_audio(int64_t pts, std::vector<float> audio);
- bool begin_frame(int64_t pts, int64_t duration, const std::vector<RefCountedFrame> &input_frames, GLuint *y_tex, GLuint *cbcr_tex);
+ bool is_zerocopy() const;
+ bool begin_frame(int64_t pts, int64_t duration, movit::YCbCrLumaCoefficients ycbcr_coefficients, const std::vector<RefCountedFrame> &input_frames, GLuint *y_tex, GLuint *cbcr_tex);
int frame_type;
std::vector<float> audio;
int64_t pts, dts, duration;
int frame_type;
std::vector<float> audio;
int64_t pts, dts, duration;
EGLImage y_egl_image, cbcr_egl_image;
// Only if use_zerocopy == false.
EGLImage y_egl_image, cbcr_egl_image;
// Only if use_zerocopy == false.
void add_packet_for_uncompressed_frame(int64_t pts, int64_t duration, const uint8_t *data);
void pass_frame(PendingFrame frame, int display_frame_num, int64_t pts, int64_t duration);
void encode_frame(PendingFrame frame, int encoding_frame_num, int display_frame_num, int gop_start_display_frame_num,
void add_packet_for_uncompressed_frame(int64_t pts, int64_t duration, const uint8_t *data);
void pass_frame(PendingFrame frame, int display_frame_num, int64_t pts, int64_t duration);
void encode_frame(PendingFrame frame, int encoding_frame_num, int display_frame_num, int gop_start_display_frame_num,
- int frame_type, int64_t pts, int64_t dts, int64_t duration);
+ int frame_type, int64_t pts, int64_t dts, int64_t duration, movit::YCbCrLumaCoefficients ycbcr_coefficients);
void storage_task_thread();
void storage_task_enqueue(storage_task task);
void save_codeddata(GLSurface *surf, storage_task task);
void storage_task_thread();
void storage_task_enqueue(storage_task task);
void save_codeddata(GLSurface *surf, storage_task task);
int render_packedpicture();
void render_packedslice();
int render_sequence();
int render_picture(GLSurface *surf, int frame_type, int display_frame_num, int gop_start_display_frame_num);
int render_packedpicture();
void render_packedslice();
int render_sequence();
int render_picture(GLSurface *surf, int frame_type, int display_frame_num, int gop_start_display_frame_num);
void pps_rbsp(bitstream *bs);
int build_packed_pic_buffer(unsigned char **header_buffer);
int render_slice(int encoding_frame_num, int display_frame_num, int gop_start_display_frame_num, int frame_type);
void slice_header(bitstream *bs);
void pps_rbsp(bitstream *bs);
int build_packed_pic_buffer(unsigned char **header_buffer);
int render_slice(int encoding_frame_num, int display_frame_num, int gop_start_display_frame_num, int frame_type);
void slice_header(bitstream *bs);
int build_packed_slice_buffer(unsigned char **header_buffer);
int init_va(const std::string &va_display);
int build_packed_slice_buffer(unsigned char **header_buffer);
int init_va(const std::string &va_display);
std::map<int, PendingFrame> reorder_buffer;
int quicksync_encoding_frame_num = 0;
std::map<int, PendingFrame> reorder_buffer;
int quicksync_encoding_frame_num = 0;
std::unique_ptr<AudioEncoder> file_audio_encoder;
X264Encoder *x264_encoder; // nullptr if not using x264.
std::unique_ptr<AudioEncoder> file_audio_encoder;
X264Encoder *x264_encoder; // nullptr if not using x264.
VAProfile h264_profile = (VAProfile)~0;
VAConfigAttrib config_attrib[VAConfigAttribTypeMax];
int config_attrib_num = 0, enc_packed_header_idx;
VAProfile h264_profile = (VAProfile)~0;
VAConfigAttrib config_attrib[VAConfigAttribTypeMax];
int config_attrib_num = 0, enc_packed_header_idx;