#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/gpu/vaapi/vaapi_jpeg_encoder.h"
#include <stddef.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <type_traits>
#include "base/check_op.h"
#include "base/numerics/safe_conversions.h"
#include "media/gpu/macros.h"
#include "media/gpu/vaapi/vaapi_wrapper.h"
#include "media/parsers/jpeg_parser.h"
namespace media {
namespace {
void FillPictureParameters(const gfx::Size& input_size,
int quality,
VABufferID output_buffer_id,
VAEncPictureParameterBufferJPEG* pic_param) { … }
void FillQMatrix(VAQMatrixBufferJPEG* q_matrix) { … }
void FillHuffmanTableParameters(
VAHuffmanTableBufferJPEGBaseline* huff_table_param) { … }
void FillSliceParameters(VAEncSliceParameterBufferJPEG* slice_param) { … }
size_t FillJpegHeader(const gfx::Size& input_size,
const uint8_t* exif_buffer,
size_t exif_buffer_size,
int quality,
uint8_t* header,
size_t* exif_offset) { … }
}
VaapiJpegEncoder::VaapiJpegEncoder(scoped_refptr<VaapiWrapper> vaapi_wrapper)
: … { … }
VaapiJpegEncoder::~VaapiJpegEncoder() { … }
size_t VaapiJpegEncoder::GetMaxCodedBufferSize(const gfx::Size& size) { … }
bool VaapiJpegEncoder::Encode(const gfx::Size& input_size,
const uint8_t* exif_buffer,
size_t exif_buffer_size,
int quality,
VASurfaceID surface_id,
VABufferID output_buffer_id,
size_t* exif_offset) { … }
}