#include "tensorflow_lite_support/cc/task/vision/utils/frame_buffer_common_utils.h"
#include <string>
#include <vector>
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "tensorflow_lite_support/cc/port/status_macros.h"
namespace tflite {
namespace task {
namespace vision {
namespace {
StatusOr;
constexpr int kRgbaChannels = …;
constexpr int kRgbChannels = …;
constexpr int kGrayChannel = …;
StatusOr<std::unique_ptr<FrameBuffer>> CreateFromOnePlaneNVRawBuffer(
const uint8* input, FrameBuffer::Dimension dimension,
FrameBuffer::Format format, FrameBuffer::Orientation orientation,
const absl::Time timestamp) { … }
bool AreBufferDimsEqual(const FrameBuffer& buffer1,
const FrameBuffer& buffer2) { … }
bool AreBufferFormatsCompatible(const FrameBuffer& buffer1,
const FrameBuffer& buffer2) { … }
}
int GetFrameBufferByteSize(FrameBuffer::Dimension dimension,
FrameBuffer::Format format) { … }
StatusOr<int> GetPixelStrides(FrameBuffer::Format format) { … }
StatusOr<const uint8*> GetUvRawBuffer(const FrameBuffer& buffer) { … }
StatusOr<FrameBuffer::Dimension> GetUvPlaneDimension(
FrameBuffer::Dimension dimension, FrameBuffer::Format format) { … }
FrameBuffer::Dimension GetCropDimension(int x0, int x1, int y0, int y1) { … }
absl::Status ValidateBufferPlaneMetadata(const FrameBuffer& buffer) { … }
absl::Status ValidateBufferFormat(const FrameBuffer& buffer) { … }
absl::Status ValidateBufferFormats(const FrameBuffer& buffer1,
const FrameBuffer& buffer2) { … }
absl::Status ValidateResizeBufferInputs(const FrameBuffer& buffer,
const FrameBuffer& output_buffer) { … }
absl::Status ValidateRotateBufferInputs(const FrameBuffer& buffer,
const FrameBuffer& output_buffer,
int angle_deg) { … }
absl::Status ValidateCropBufferInputs(const FrameBuffer& buffer,
const FrameBuffer& output_buffer, int x0,
int y0, int x1, int y1) { … }
absl::Status ValidateFlipBufferInputs(const FrameBuffer& buffer,
const FrameBuffer& output_buffer) { … }
absl::Status ValidateConvertFormats(FrameBuffer::Format from_format,
FrameBuffer::Format to_format) { … }
std::unique_ptr<FrameBuffer> CreateFromRgbaRawBuffer(
const uint8* input, FrameBuffer::Dimension dimension,
FrameBuffer::Orientation orientation, const absl::Time timestamp,
FrameBuffer::Stride stride) { … }
std::unique_ptr<FrameBuffer> CreateFromRgbRawBuffer(
const uint8* input, FrameBuffer::Dimension dimension,
FrameBuffer::Orientation orientation, const absl::Time timestamp,
FrameBuffer::Stride stride) { … }
std::unique_ptr<FrameBuffer> CreateFromGrayRawBuffer(
const uint8* input, FrameBuffer::Dimension dimension,
FrameBuffer::Orientation orientation, const absl::Time timestamp,
FrameBuffer::Stride stride) { … }
StatusOr<std::unique_ptr<FrameBuffer>> CreateFromYuvRawBuffer(
const uint8* y_plane, const uint8* u_plane, const uint8* v_plane,
FrameBuffer::Format format, FrameBuffer::Dimension dimension,
int row_stride_y, int row_stride_uv, int pixel_stride_uv,
FrameBuffer::Orientation orientation, const absl::Time timestamp) { … }
StatusOr<std::unique_ptr<FrameBuffer>> CreateFromRawBuffer(
const uint8* buffer, FrameBuffer::Dimension dimension,
const FrameBuffer::Format target_format,
FrameBuffer::Orientation orientation, absl::Time timestamp) { … }
}
}
}