No public description
PiperOrigin-RevId: 595039397
This commit is contained in:
parent
e23fa531e1
commit
ec43bea176
|
@ -43,9 +43,9 @@ class KinematicPathSolver {
|
|||
initialized_(false),
|
||||
pixels_per_degree_(pixels_per_degree) {}
|
||||
// Add an observation (detection) at a position and time.
|
||||
absl::Status AddObservation(int position, const uint64 time_us);
|
||||
absl::Status AddObservation(int position, const uint64_t time_us);
|
||||
// Get the predicted position at a time.
|
||||
absl::Status UpdatePrediction(const int64 time_us);
|
||||
absl::Status UpdatePrediction(const int64_t time_us);
|
||||
// Get the state at a time, as an int.
|
||||
absl::Status GetState(int* position);
|
||||
// Get the state at a time, as a float.
|
||||
|
@ -63,7 +63,7 @@ class KinematicPathSolver {
|
|||
bool IsMotionTooSmall(double delta_degs);
|
||||
// Check if a position measurement will cause the camera to be in motion
|
||||
// without updating the internal state.
|
||||
absl::Status PredictMotionState(int position, const uint64 time_us,
|
||||
absl::Status PredictMotionState(int position, const uint64_t time_us,
|
||||
bool* state);
|
||||
// Clear any history buffer of positions that are used when
|
||||
// filtering_time_window_us is set to a non-zero value.
|
||||
|
@ -85,9 +85,9 @@ class KinematicPathSolver {
|
|||
double current_position_px_;
|
||||
double prior_position_px_;
|
||||
double current_velocity_deg_per_s_;
|
||||
uint64 current_time_ = 0;
|
||||
uint64_t current_time_ = 0;
|
||||
// History of observations (second) and their time (first).
|
||||
std::deque<std::pair<uint64, int>> raw_positions_at_time_;
|
||||
std::deque<std::pair<uint64_t, int>> raw_positions_at_time_;
|
||||
// Current target position.
|
||||
double target_position_px_;
|
||||
// Defines if the camera is moving to a target (true) or reached a target
|
||||
|
|
|
@ -67,7 +67,7 @@ class SceneCameraMotionAnalyzer {
|
|||
const KeyFrameCropOptions& key_frame_crop_options,
|
||||
const std::vector<KeyFrameCropResult>& key_frame_crop_results,
|
||||
const int scene_frame_width, const int scene_frame_height,
|
||||
const std::vector<int64>& scene_frame_timestamps,
|
||||
const std::vector<int64_t>& scene_frame_timestamps,
|
||||
const bool has_solid_color_background,
|
||||
SceneKeyFrameCropSummary* scene_summary,
|
||||
std::vector<FocusPointFrame>* focus_point_frames,
|
||||
|
@ -78,7 +78,7 @@ class SceneCameraMotionAnalyzer {
|
|||
// crop window in SceneKeyFrameCropSummary in the case of steady motion.
|
||||
absl::Status DecideCameraMotionType(
|
||||
const KeyFrameCropOptions& key_frame_crop_options,
|
||||
const double scene_span_sec, const int64 end_time_us,
|
||||
const double scene_span_sec, const int64_t end_time_us,
|
||||
SceneKeyFrameCropSummary* scene_summary,
|
||||
SceneCameraMotion* scene_camera_motion) const;
|
||||
|
||||
|
@ -87,7 +87,7 @@ class SceneCameraMotionAnalyzer {
|
|||
absl::Status PopulateFocusPointFrames(
|
||||
const SceneKeyFrameCropSummary& scene_summary,
|
||||
const SceneCameraMotion& scene_camera_motion,
|
||||
const std::vector<int64>& scene_frame_timestamps,
|
||||
const std::vector<int64_t>& scene_frame_timestamps,
|
||||
std::vector<FocusPointFrame>* focus_point_frames) const;
|
||||
|
||||
private:
|
||||
|
@ -118,7 +118,7 @@ class SceneCameraMotionAnalyzer {
|
|||
absl::Status PopulateFocusPointFramesForTracking(
|
||||
const SceneKeyFrameCropSummary& scene_summary,
|
||||
const FocusPointFrameType focus_point_frame_type,
|
||||
const std::vector<int64>& scene_frame_timestamps,
|
||||
const std::vector<int64_t>& scene_frame_timestamps,
|
||||
std::vector<FocusPointFrame>* focus_point_frames) const;
|
||||
|
||||
// Decide to use steady motion.
|
||||
|
@ -142,7 +142,7 @@ class SceneCameraMotionAnalyzer {
|
|||
|
||||
// Last position
|
||||
SceneCameraMotion last_scene_with_salient_region_;
|
||||
int64 time_since_last_salient_region_us_;
|
||||
int64_t time_since_last_salient_region_us_;
|
||||
|
||||
// Scene has solid color background.
|
||||
bool has_solid_color_background_;
|
||||
|
|
|
@ -62,7 +62,7 @@ class SceneCropper {
|
|||
// TODO: split this function into two separate functions.
|
||||
absl::Status CropFrames(
|
||||
const SceneKeyFrameCropSummary& scene_summary,
|
||||
const std::vector<int64>& scene_timestamps,
|
||||
const std::vector<int64_t>& scene_timestamps,
|
||||
const std::vector<bool>& is_key_frames,
|
||||
const std::vector<cv::Mat>& scene_frames_or_empty,
|
||||
const std::vector<FocusPointFrame>& focus_point_frames,
|
||||
|
@ -73,7 +73,7 @@ class SceneCropper {
|
|||
|
||||
absl::Status ProcessKinematicPathSolver(
|
||||
const SceneKeyFrameCropSummary& scene_summary,
|
||||
const std::vector<int64>& scene_timestamps,
|
||||
const std::vector<int64_t>& scene_timestamps,
|
||||
const std::vector<bool>& is_key_frames,
|
||||
const std::vector<FocusPointFrame>& focus_point_frames,
|
||||
const bool continue_last_scene, std::vector<cv::Mat>* all_xforms);
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace autoflip {
|
|||
// Packs detected features and timestamp (ms) into a KeyFrameInfo object. Scales
|
||||
// features back to the original frame size if features have been detected on a
|
||||
// different frame size.
|
||||
absl::Status PackKeyFrameInfo(const int64 frame_timestamp_ms,
|
||||
absl::Status PackKeyFrameInfo(const int64_t frame_timestamp_ms,
|
||||
const DetectionSet& detections,
|
||||
const int original_frame_width,
|
||||
const int original_frame_height,
|
||||
|
@ -71,7 +71,7 @@ absl::Status ComputeSceneStaticBordersSize(
|
|||
// interpolation functions in Lab space using input timestamps.
|
||||
absl::Status FindSolidBackgroundColor(
|
||||
const std::vector<StaticFeatures>& static_features,
|
||||
const std::vector<int64>& static_features_timestamps,
|
||||
const std::vector<int64_t>& static_features_timestamps,
|
||||
const double min_fraction_solid_background_color,
|
||||
bool* has_solid_background,
|
||||
PiecewiseLinearFunction* background_color_l_function,
|
||||
|
|
|
@ -16,11 +16,11 @@ limitations under the License.
|
|||
#ifndef MEDIAPIPE_FRAMEWORK_FORMATS_FRAME_BUFFER_H_
|
||||
#define MEDIAPIPE_FRAMEWORK_FORMATS_FRAME_BUFFER_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/log/absl_check.h"
|
||||
#include "absl/status/statusor.h"
|
||||
#include "mediapipe/framework/port/integral_types.h"
|
||||
|
||||
namespace mediapipe {
|
||||
|
||||
|
@ -76,13 +76,13 @@ class FrameBuffer {
|
|||
|
||||
// Plane encapsulates buffer and stride information.
|
||||
struct Plane {
|
||||
Plane(uint8* buffer, Stride stride) : buffer_(buffer), stride_(stride) {}
|
||||
const uint8* buffer() const { return buffer_; }
|
||||
uint8* mutable_buffer() { return buffer_; }
|
||||
Plane(uint8_t* buffer, Stride stride) : buffer_(buffer), stride_(stride) {}
|
||||
const uint8_t* buffer() const { return buffer_; }
|
||||
uint8_t* mutable_buffer() { return buffer_; }
|
||||
Stride stride() const { return stride_; }
|
||||
|
||||
private:
|
||||
uint8* buffer_;
|
||||
uint8_t* buffer_;
|
||||
Stride stride_;
|
||||
};
|
||||
|
||||
|
@ -121,9 +121,9 @@ class FrameBuffer {
|
|||
|
||||
// YUV data structure.
|
||||
struct YuvData {
|
||||
const uint8* y_buffer;
|
||||
const uint8* u_buffer;
|
||||
const uint8* v_buffer;
|
||||
const uint8_t* y_buffer;
|
||||
const uint8_t* u_buffer;
|
||||
const uint8_t* v_buffer;
|
||||
// Y buffer row stride in bytes.
|
||||
int y_row_stride;
|
||||
// U/V buffer row stride in bytes.
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#ifndef MEDIAPIPE_FRAMEWORK_FORMATS_IMAGE_H_
|
||||
#define MEDIAPIPE_FRAMEWORK_FORMATS_IMAGE_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/synchronization/mutex.h"
|
||||
|
@ -207,7 +208,7 @@ inline void Image::UnlockPixels() const {}
|
|||
// Image buf = ...
|
||||
// {
|
||||
// PixelLock lock(&buf);
|
||||
// uint8* buf_ptr = lock.Pixels();
|
||||
// uint8_t* buf_ptr = lock.Pixels();
|
||||
// ... use buf_ptr to access pixel data ...
|
||||
// ... lock released automatically at end of scope ...
|
||||
// }
|
||||
|
@ -228,7 +229,7 @@ class PixelReadLock {
|
|||
}
|
||||
PixelReadLock(const PixelReadLock&) = delete;
|
||||
|
||||
const uint8* Pixels() const {
|
||||
const uint8_t* Pixels() const {
|
||||
if (frame_) return frame_->PixelData();
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -254,7 +255,7 @@ class PixelWriteLock {
|
|||
}
|
||||
PixelWriteLock(const PixelWriteLock&) = delete;
|
||||
|
||||
uint8* Pixels() {
|
||||
uint8_t* Pixels() {
|
||||
if (frame_) return frame_->MutablePixelData();
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -35,13 +35,13 @@
|
|||
#ifndef MEDIAPIPE_FRAMEWORK_FORMATS_IMAGE_FRAME_H_
|
||||
#define MEDIAPIPE_FRAMEWORK_FORMATS_IMAGE_FRAME_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "mediapipe/framework/formats/image_format.pb.h"
|
||||
#include "mediapipe/framework/port.h"
|
||||
#include "mediapipe/framework/port/integral_types.h"
|
||||
#include "mediapipe/framework/tool/type_util.h"
|
||||
|
||||
#define IMAGE_FRAME_RAW_IMAGE MEDIAPIPE_HAS_RTTI
|
||||
|
@ -63,7 +63,7 @@ namespace mediapipe {
|
|||
// stored with row padding for alignment purposes.
|
||||
class ImageFrame {
|
||||
public:
|
||||
typedef std::function<void(uint8*)> Deleter;
|
||||
typedef std::function<void(uint8_t*)> Deleter;
|
||||
|
||||
// This class offers a few standard delete functions and retains
|
||||
// compatibility with the previous API.
|
||||
|
@ -78,13 +78,13 @@ class ImageFrame {
|
|||
// Use a default alignment boundary of 16 because Intel SSE2 instructions may
|
||||
// incur performance penalty when accessing data not aligned on a 16-byte
|
||||
// boundary. FFmpeg requires at least this level of alignment.
|
||||
static const uint32 kDefaultAlignmentBoundary = 16;
|
||||
static const uint32_t kDefaultAlignmentBoundary = 16;
|
||||
|
||||
// If the pixel data of an ImageFrame will be passed to an OpenGL function
|
||||
// such as glTexImage2D() or glReadPixels(), use a four-byte alignment
|
||||
// boundary because that is the initial value of the OpenGL GL_PACK_ALIGNMENT
|
||||
// and GL_UNPACK_ALIGNMENT parameters.
|
||||
static const uint32 kGlDefaultAlignmentBoundary = 4;
|
||||
static const uint32_t kGlDefaultAlignmentBoundary = 4;
|
||||
|
||||
// Returns number of channels for an ImageFormat.
|
||||
static int NumberOfChannelsForFormat(ImageFormat::Format format);
|
||||
|
@ -104,7 +104,7 @@ class ImageFrame {
|
|||
// must be a power of 2 (the number 1 is valid, and means the data will
|
||||
// be stored contiguously).
|
||||
ImageFrame(ImageFormat::Format format, int width, int height,
|
||||
uint32 alignment_boundary);
|
||||
uint32_t alignment_boundary);
|
||||
// Same as above, but use kDefaultAlignmentBoundary for alignment_boundary.
|
||||
ImageFrame(ImageFormat::Format format, int width, int height);
|
||||
|
||||
|
@ -115,8 +115,8 @@ class ImageFrame {
|
|||
// width*num_channels*depth. Both width_step and depth are in units
|
||||
// of bytes.
|
||||
ImageFrame(ImageFormat::Format format, int width, int height, int width_step,
|
||||
uint8* pixel_data,
|
||||
Deleter deleter = std::default_delete<uint8[]>());
|
||||
uint8_t* pixel_data,
|
||||
Deleter deleter = std::default_delete<uint8_t[]>());
|
||||
|
||||
ImageFrame(ImageFrame&& move_from);
|
||||
ImageFrame& operator=(ImageFrame&& move_from);
|
||||
|
@ -142,7 +142,7 @@ class ImageFrame {
|
|||
// alignment_boundary. If IsAligned(16) is true then so are
|
||||
// IsAligned(8), IsAligned(4), IsAligned(2), and IsAligned(1).
|
||||
// alignment_boundary must be 1 or a power of 2.
|
||||
bool IsAligned(uint32 alignment_boundary) const;
|
||||
bool IsAligned(uint32_t alignment_boundary) const;
|
||||
|
||||
// Returns the image / video format.
|
||||
ImageFormat::Format Format() const { return format_; }
|
||||
|
@ -167,13 +167,13 @@ class ImageFrame {
|
|||
// Reset the current image frame and copy the data from image_frame into
|
||||
// this image frame. The alignment_boundary must be given (and won't
|
||||
// necessarily match the alignment_boundary of the input image_frame).
|
||||
void CopyFrom(const ImageFrame& image_frame, uint32 alignment_boundary);
|
||||
void CopyFrom(const ImageFrame& image_frame, uint32_t alignment_boundary);
|
||||
|
||||
// Get a mutable pointer to the underlying image data. The ImageFrame
|
||||
// retains ownership.
|
||||
uint8* MutablePixelData() { return pixel_data_.get(); }
|
||||
uint8_t* MutablePixelData() { return pixel_data_.get(); }
|
||||
// Get a const pointer to the underlying image data.
|
||||
const uint8* PixelData() const { return pixel_data_.get(); }
|
||||
const uint8_t* PixelData() const { return pixel_data_.get(); }
|
||||
|
||||
// Returns the total size of the pixel data.
|
||||
int PixelDataSize() const { return Height() * WidthStep(); }
|
||||
|
@ -187,41 +187,41 @@ class ImageFrame {
|
|||
// ImageFrame takes ownership of pixel_data. See the Constructor
|
||||
// with the same arguments for details.
|
||||
void AdoptPixelData(ImageFormat::Format format, int width, int height,
|
||||
int width_step, uint8* pixel_data,
|
||||
Deleter deleter = std::default_delete<uint8[]>());
|
||||
int width_step, uint8_t* pixel_data,
|
||||
Deleter deleter = std::default_delete<uint8_t[]>());
|
||||
|
||||
// Resets the ImageFrame and makes it a copy of the provided pixel
|
||||
// data, which is assumed to be stored contiguously. The ImageFrame
|
||||
// will use the given alignment_boundary.
|
||||
void CopyPixelData(ImageFormat::Format format, int width, int height,
|
||||
const uint8* pixel_data, uint32 alignment_boundary);
|
||||
const uint8_t* pixel_data, uint32_t alignment_boundary);
|
||||
|
||||
// Resets the ImageFrame and makes it a copy of the provided pixel
|
||||
// data, with given width_step. The ImageFrame
|
||||
// will use the given alignment_boundary.
|
||||
void CopyPixelData(ImageFormat::Format format, int width, int height,
|
||||
int width_step, const uint8* pixel_data,
|
||||
uint32 alignment_boundary);
|
||||
int width_step, const uint8_t* pixel_data,
|
||||
uint32_t alignment_boundary);
|
||||
|
||||
// Allocates a frame of the specified format, width, height, and alignment,
|
||||
// without clearing any current pixel data. See the constructor with the same
|
||||
// argument list.
|
||||
void Reset(ImageFormat::Format format, int width, int height,
|
||||
uint32 alignment_boundary);
|
||||
uint32_t alignment_boundary);
|
||||
|
||||
// Relinquishes ownership of the pixel data. Notice that the unique_ptr
|
||||
// uses a non-standard deleter.
|
||||
std::unique_ptr<uint8[], Deleter> Release();
|
||||
std::unique_ptr<uint8_t[], Deleter> Release();
|
||||
|
||||
// Copy the 8-bit ImageFrame into a contiguous, pre-allocated buffer. Note
|
||||
// that ImageFrame does not necessarily store its data contiguously (i.e. do
|
||||
// not use copy_n to move image data).
|
||||
void CopyToBuffer(uint8* buffer, int buffer_size) const;
|
||||
void CopyToBuffer(uint8_t* buffer, int buffer_size) const;
|
||||
|
||||
// A version of CopyToBuffer for 16-bit pixel data. Note that buffer_size
|
||||
// stores the number of 16-bit elements in the buffer, not the number of
|
||||
// bytes.
|
||||
void CopyToBuffer(uint16* buffer, int buffer_size) const;
|
||||
void CopyToBuffer(uint16_t* buffer, int buffer_size) const;
|
||||
|
||||
// A version of CopyToBuffer for float pixel data. Note that buffer_size
|
||||
// stores the number of float elements in the buffer, not the number of
|
||||
|
@ -233,12 +233,12 @@ class ImageFrame {
|
|||
|
||||
private:
|
||||
// Returns true if alignment_number is 1 or a power of 2.
|
||||
static bool IsValidAlignmentNumber(uint32 alignment_boundary);
|
||||
static bool IsValidAlignmentNumber(uint32_t alignment_boundary);
|
||||
|
||||
// The internal implementation of copying data from the provided pixel data.
|
||||
// If width_step is 0, then calculates width_step assuming no padding.
|
||||
void InternalCopyFrom(int width, int height, int width_step, int channel_size,
|
||||
const uint8* pixel_data);
|
||||
const uint8_t* pixel_data);
|
||||
|
||||
// The internal implementation of copying data to the provided buffer.
|
||||
// If width_step is 0, then calculates width_step assuming no padding.
|
||||
|
@ -249,7 +249,7 @@ class ImageFrame {
|
|||
int height_;
|
||||
int width_step_;
|
||||
|
||||
std::unique_ptr<uint8[], Deleter> pixel_data_;
|
||||
std::unique_ptr<uint8_t[], Deleter> pixel_data_;
|
||||
};
|
||||
|
||||
} // namespace mediapipe
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
#include "absl/log/absl_check.h"
|
||||
|
|
|
@ -215,7 +215,7 @@ Location CreateCvMaskLocation(const cv::Mat_<T>& mask) {
|
|||
return Location(location_data);
|
||||
}
|
||||
|
||||
template Location CreateCvMaskLocation(const cv::Mat_<uint8>& mask);
|
||||
template Location CreateCvMaskLocation(const cv::Mat_<uint8_t>& mask);
|
||||
template Location CreateCvMaskLocation(const cv::Mat_<float>& mask);
|
||||
|
||||
} // namespace mediapipe
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#ifndef MEDIAPIPE_FRAMEWORK_FORMATS_YUV_IMAGE_H_
|
||||
#define MEDIAPIPE_FRAMEWORK_FORMATS_YUV_IMAGE_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
|
@ -120,12 +121,12 @@ class YUVImage {
|
|||
|
||||
// Convenience constructor
|
||||
YUVImage(libyuv::FourCC fourcc, //
|
||||
std::unique_ptr<uint8[]> data_location, //
|
||||
uint8* data0, int stride0, //
|
||||
uint8* data1, int stride1, //
|
||||
uint8* data2, int stride2, //
|
||||
std::unique_ptr<uint8_t[]> data_location, //
|
||||
uint8_t* data0, int stride0, //
|
||||
uint8_t* data1, int stride1, //
|
||||
uint8_t* data2, int stride2, //
|
||||
int width, int height, int bit_depth = 8) {
|
||||
uint8* tmp = data_location.release();
|
||||
uint8_t* tmp = data_location.release();
|
||||
std::function<void()> deallocate = [tmp]() { delete[] tmp; };
|
||||
Initialize(fourcc, //
|
||||
deallocate, //
|
||||
|
@ -138,13 +139,13 @@ class YUVImage {
|
|||
// Convenience constructor to construct the YUVImage with data stored
|
||||
// in three unique_ptrs.
|
||||
YUVImage(libyuv::FourCC fourcc, //
|
||||
std::unique_ptr<uint8[]> data0, int stride0, //
|
||||
std::unique_ptr<uint8[]> data1, int stride1, //
|
||||
std::unique_ptr<uint8[]> data2, int stride2, //
|
||||
std::unique_ptr<uint8_t[]> data0, int stride0, //
|
||||
std::unique_ptr<uint8_t[]> data1, int stride1, //
|
||||
std::unique_ptr<uint8_t[]> data2, int stride2, //
|
||||
int width, int height, int bit_depth = 8) {
|
||||
uint8* tmp0 = data0.release();
|
||||
uint8* tmp1 = data1.release();
|
||||
uint8* tmp2 = data2.release();
|
||||
uint8_t* tmp0 = data0.release();
|
||||
uint8_t* tmp1 = data1.release();
|
||||
uint8_t* tmp2 = data2.release();
|
||||
std::function<void()> deallocate = [tmp0, tmp1, tmp2]() {
|
||||
delete[] tmp0;
|
||||
delete[] tmp1;
|
||||
|
@ -177,9 +178,9 @@ class YUVImage {
|
|||
// pixel format it holds.
|
||||
void Initialize(libyuv::FourCC fourcc, //
|
||||
std::function<void()> deallocation_function, //
|
||||
uint8* data0, int stride0, //
|
||||
uint8* data1, int stride1, //
|
||||
uint8* data2, int stride2, //
|
||||
uint8_t* data0, int stride0, //
|
||||
uint8_t* data1, int stride1, //
|
||||
uint8_t* data2, int stride2, //
|
||||
int width, int height, int bit_depth = 8) {
|
||||
Clear();
|
||||
deallocation_function_ = deallocation_function;
|
||||
|
@ -214,7 +215,7 @@ class YUVImage {
|
|||
|
||||
// Getters.
|
||||
libyuv::FourCC fourcc() const { return fourcc_; }
|
||||
const uint8* data(int index) const { return data_[index]; }
|
||||
const uint8_t* data(int index) const { return data_[index]; }
|
||||
int stride(int index) const { return stride_[index]; }
|
||||
int width() const { return width_; }
|
||||
int height() const { return height_; }
|
||||
|
@ -226,7 +227,7 @@ class YUVImage {
|
|||
|
||||
// Setters.
|
||||
void set_fourcc(libyuv::FourCC fourcc) { fourcc_ = fourcc; }
|
||||
uint8* mutable_data(int index) { return data_[index]; }
|
||||
uint8_t* mutable_data(int index) { return data_[index]; }
|
||||
void set_stride(int index, int stride) { stride_[index] = stride; }
|
||||
void set_width(int width) { width_ = width; }
|
||||
void set_height(int height) { height_ = height; }
|
||||
|
@ -241,7 +242,7 @@ class YUVImage {
|
|||
std::function<void()> deallocation_function_;
|
||||
|
||||
libyuv::FourCC fourcc_ = libyuv::FOURCC_ANY;
|
||||
uint8* data_[kMaxNumPlanes];
|
||||
uint8_t* data_[kMaxNumPlanes];
|
||||
int stride_[kMaxNumPlanes];
|
||||
int width_ = 0;
|
||||
int height_ = 0;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#import <Accelerate/Accelerate.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
|
||||
#import "GTMDefines.h"
|
||||
#include "absl/memory/memory.h"
|
||||
|
@ -48,7 +49,7 @@
|
|||
std::atomic<int32_t> _framesInFlight;
|
||||
/// Used as a sequential timestamp for MediaPipe.
|
||||
mediapipe::Timestamp _frameTimestamp;
|
||||
int64 _frameNumber;
|
||||
int64_t _frameNumber;
|
||||
|
||||
// Graph config modified to expose requested output streams.
|
||||
mediapipe::CalculatorGraphConfig _config;
|
||||
|
@ -90,8 +91,8 @@
|
|||
&callbackInputName,
|
||||
/*use_std_function=*/true);
|
||||
// No matter what ownership qualifiers are put on the pointer,
|
||||
// NewPermanentCallback will still end up with a strong pointer to MPPGraph*.
|
||||
// That is why we use void* instead.
|
||||
// NewPermanentCallback will still end up with a strong pointer to
|
||||
// MPPGraph*. That is why we use void* instead.
|
||||
void* wrapperVoid = (__bridge void*)self;
|
||||
_inputSidePackets[callbackInputName] =
|
||||
mediapipe::MakePacket<std::function<void(const mediapipe::Packet&)>>(
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#import "MPPTimestampConverter.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@implementation MPPTimestampConverter {
|
||||
mediapipe::Timestamp _mediapipeTimestamp;
|
||||
mediapipe::Timestamp _lastTimestamp;
|
||||
|
@ -37,7 +39,7 @@
|
|||
- (mediapipe::Timestamp)timestampForMediaTime:(CMTime)mediaTime {
|
||||
Float64 sampleSeconds =
|
||||
CMTIME_IS_VALID(mediaTime) ? CMTimeGetSeconds(mediaTime) : 0;
|
||||
const int64 sampleUsec =
|
||||
const int64_t sampleUsec =
|
||||
sampleSeconds * mediapipe::Timestamp::kTimestampUnitsPerSecond;
|
||||
_mediapipeTimestamp = mediapipe::Timestamp(sampleUsec) + _timestampOffset;
|
||||
if (_mediapipeTimestamp <= _lastTimestamp) {
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include "mediapipe/objc/util.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "absl/base/macros.h"
|
||||
#include "absl/log/absl_check.h"
|
||||
#include "absl/log/absl_log.h"
|
||||
|
@ -639,7 +641,7 @@ std::unique_ptr<mediapipe::ImageFrame> CreateImageFrameForCVPixelBuffer(
|
|||
} else {
|
||||
frame = absl::make_unique<mediapipe::ImageFrame>(
|
||||
image_format, width, height, bytes_per_row,
|
||||
reinterpret_cast<uint8*>(base_address), [image_buffer](uint8* x) {
|
||||
reinterpret_cast<uint8_t*>(base_address), [image_buffer](uint8_t* x) {
|
||||
CVPixelBufferUnlockBaseAddress(image_buffer,
|
||||
kCVPixelBufferLock_ReadOnly);
|
||||
CVPixelBufferRelease(image_buffer);
|
||||
|
|
|
@ -90,7 +90,7 @@ class BasePacketProcessor {
|
|||
// CorrectPtsForRollover(2^33 - 1) -> 2^33 - 1
|
||||
// CorrectPtsForRollover(0) -> 2^33 // PTS in media rolls over, corrected.
|
||||
// CorrectPtsForRollover(1) -> 2^33 + 1
|
||||
int64 CorrectPtsForRollover(int64 media_pts);
|
||||
int64_t CorrectPtsForRollover(int64_t media_pts);
|
||||
|
||||
AVCodecContext* avcodec_ctx_ = nullptr;
|
||||
const AVCodec* avcodec_ = nullptr;
|
||||
|
@ -113,7 +113,7 @@ class BasePacketProcessor {
|
|||
AVRational source_frame_rate_;
|
||||
|
||||
// The number of frames that were successfully processed.
|
||||
int64 num_frames_processed_ = 0;
|
||||
int64_t num_frames_processed_ = 0;
|
||||
|
||||
int bytes_per_sample_ = 0;
|
||||
|
||||
|
@ -121,7 +121,7 @@ class BasePacketProcessor {
|
|||
bool last_frame_time_regression_detected_ = false;
|
||||
|
||||
// The last rollover corrected PTS returned by CorrectPtsForRollover.
|
||||
int64 rollover_corrected_last_pts_ = AV_NOPTS_VALUE;
|
||||
int64_t rollover_corrected_last_pts_ = AV_NOPTS_VALUE;
|
||||
|
||||
// The buffer of current frames.
|
||||
std::deque<Packet> buffer_;
|
||||
|
@ -141,16 +141,16 @@ class AudioPacketProcessor : public BasePacketProcessor {
|
|||
private:
|
||||
// Appends audio in buffer(s) to the output buffer (buffer_).
|
||||
absl::Status AddAudioDataToBuffer(const Timestamp output_timestamp,
|
||||
uint8* const* raw_audio,
|
||||
uint8_t* const* raw_audio,
|
||||
int buf_size_bytes);
|
||||
|
||||
// Converts a number of samples into an approximate stream timestamp value.
|
||||
int64 SampleNumberToTimestamp(const int64 sample_number);
|
||||
int64 TimestampToSampleNumber(const int64 timestamp);
|
||||
int64_t SampleNumberToTimestamp(const int64_t sample_number);
|
||||
int64_t TimestampToSampleNumber(const int64_t timestamp);
|
||||
|
||||
// Converts a timestamp/sample number to microseconds.
|
||||
int64 TimestampToMicroseconds(const int64 timestamp);
|
||||
int64 SampleNumberToMicroseconds(const int64 sample_number);
|
||||
int64_t TimestampToMicroseconds(const int64_t timestamp);
|
||||
int64_t SampleNumberToMicroseconds(const int64_t sample_number);
|
||||
|
||||
// Returns an error if the sample format in avformat_ctx_.sample_format
|
||||
// is not supported.
|
||||
|
@ -161,7 +161,7 @@ class AudioPacketProcessor : public BasePacketProcessor {
|
|||
absl::Status ProcessDecodedFrame(const AVPacket& packet) override;
|
||||
|
||||
// Corrects PTS for rollover if correction is enabled.
|
||||
int64 MaybeCorrectPtsForRollover(int64 media_pts);
|
||||
int64_t MaybeCorrectPtsForRollover(int64_t media_pts);
|
||||
|
||||
// Number of channels to output. This value might be different from
|
||||
// the actual number of channels for the current AVPacket, found in
|
||||
|
@ -171,7 +171,7 @@ class AudioPacketProcessor : public BasePacketProcessor {
|
|||
// Sample rate of the data to output. This value might be different
|
||||
// from the actual sample rate for the current AVPacket, found in
|
||||
// avcodec_ctx_->sample_rate.
|
||||
int64 sample_rate_ = -1;
|
||||
int64_t sample_rate_ = -1;
|
||||
|
||||
// The time base of audio samples (i.e. the reciprocal of the sample rate).
|
||||
AVRational sample_time_base_;
|
||||
|
@ -180,7 +180,7 @@ class AudioPacketProcessor : public BasePacketProcessor {
|
|||
Timestamp last_timestamp_;
|
||||
|
||||
// The expected sample number based on counting samples.
|
||||
int64 expected_sample_number_ = 0;
|
||||
int64_t expected_sample_number_ = 0;
|
||||
|
||||
// Options for the processor.
|
||||
AudioStreamOptions options_;
|
||||
|
|
|
@ -74,14 +74,14 @@ void YUVImageToImageFrameFromFormat(const YUVImage& yuv_image,
|
|||
// values used are those from ITU-R BT.601 (which are the same as ITU-R
|
||||
// BT.709). The conversion values are taken from wikipedia and cross
|
||||
// checked with other sources.
|
||||
void SrgbToMpegYCbCr(const uint8 r, const uint8 g, const uint8 b, //
|
||||
uint8* y, uint8* cb, uint8* cr);
|
||||
void SrgbToMpegYCbCr(const uint8_t r, const uint8_t g, const uint8_t b, //
|
||||
uint8_t* y, uint8_t* cb, uint8_t* cr);
|
||||
// Convert MPEG YCbCr values into sRGB values. See the SrgbToMpegYCbCr()
|
||||
// for more notes. Many MPEG YCbCr values do not correspond directly
|
||||
// to an sRGB value. If the value is invalid it will be clipped to the
|
||||
// closest valid value on a per channel basis.
|
||||
void MpegYCbCrToSrgb(const uint8 y, const uint8 cb, const uint8 cr, //
|
||||
uint8* r, uint8* g, uint8* b);
|
||||
void MpegYCbCrToSrgb(const uint8_t y, const uint8_t cb, const uint8_t cr, //
|
||||
uint8_t* r, uint8_t* g, uint8_t* b);
|
||||
|
||||
// Conversion functions to and from srgb and linear RGB in 16 bits-per-pixel
|
||||
// channel.
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace mediapipe {
|
|||
// both expected to contain one label per line.
|
||||
// Returns an error e.g. if there's a mismatch between the number of labels and
|
||||
// display names.
|
||||
absl::StatusOr<proto_ns::Map<int64, ::mediapipe::LabelMapItem>>
|
||||
absl::StatusOr<proto_ns::Map<int64_t, ::mediapipe::LabelMapItem>>
|
||||
BuildLabelMapFromFiles(absl::string_view labels_file_contents,
|
||||
absl::string_view display_names_file);
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ class TimeSeriesCalculatorTest : public ::testing::Test {
|
|||
|
||||
// Overload to allow explicit conversion from int64 to Timestamp
|
||||
template <typename T>
|
||||
void AppendInputPacket(const T* payload, const int64 timestamp,
|
||||
void AppendInputPacket(const T* payload, const int64_t timestamp,
|
||||
const size_t input_index = 0) {
|
||||
AppendInputPacket(payload, Timestamp(timestamp), input_index);
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ class TimeSeriesCalculatorTest : public ::testing::Test {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void AppendInputPacket(const T* payload, const int64 timestamp,
|
||||
void AppendInputPacket(const T* payload, const int64_t timestamp,
|
||||
const std::string& input_tag) {
|
||||
AppendInputPacket(payload, Timestamp(timestamp), input_tag);
|
||||
}
|
||||
|
@ -450,7 +450,7 @@ class MultiStreamTimeSeriesCalculatorTest
|
|||
|
||||
// Overload to allow explicit conversion from int64 to Timestamp
|
||||
void AppendInputPacket(const std::vector<Matrix>* input_vector,
|
||||
const int64 timestamp) {
|
||||
const int64_t timestamp) {
|
||||
AppendInputPacket(input_vector, Timestamp(timestamp));
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace time_series_util {
|
|||
// function.
|
||||
bool LogWarningIfTimestampIsInconsistent(const Timestamp& current_timestamp,
|
||||
const Timestamp& initial_timestamp,
|
||||
int64 cumulative_samples,
|
||||
int64_t cumulative_samples,
|
||||
double sample_rate);
|
||||
|
||||
// Returns absl::Status::OK if the header is valid. Otherwise, returns a
|
||||
|
@ -109,11 +109,11 @@ void SetExtensionInHeader(const TimeSeriesHeaderExtensionClass& extension,
|
|||
}
|
||||
|
||||
// Converts from a time_in_seconds to an integer number of samples.
|
||||
int64 SecondsToSamples(double time_in_seconds, double sample_rate);
|
||||
int64_t SecondsToSamples(double time_in_seconds, double sample_rate);
|
||||
|
||||
// Converts from an integer number of samples to a time duration in seconds
|
||||
// spanned by the samples.
|
||||
double SamplesToSeconds(int64 num_samples, double sample_rate);
|
||||
double SamplesToSeconds(int64_t num_samples, double sample_rate);
|
||||
|
||||
} // namespace time_series_util
|
||||
} // namespace mediapipe
|
||||
|
|
Loading…
Reference in New Issue
Block a user