Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 595830742
  • Loading branch information
gribozavr authored and copybara-github committed Jan 5, 2024
1 parent bbefa07 commit d6c7aaa
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class AudioClassifier : tasks::audio::core::BaseAudioTaskApi {
// into multiple chunks. For this reason, the callback may be called multiple
// times (once per chunk) for each call to this function.
absl::Status ClassifyAsync(mediapipe::Matrix audio_block,
double audio_sample_rate, int64 timestamp_ms);
double audio_sample_rate, int64_t timestamp_ms);

// Shuts down the AudioClassifier when all works are done.
absl::Status Close() { return runner_->Close(); }
Expand Down
2 changes: 1 addition & 1 deletion mediapipe/tasks/cc/audio/audio_embedder/audio_embedder.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class AudioEmbedder : core::BaseAudioTaskApi {
// into multiple chunks. For this reason, the callback may be called multiple
// times (once per chunk) for each call to this function.
absl::Status EmbedAsync(Matrix audio_block, double audio_sample_rate,
int64 timestamp_ms);
int64_t timestamp_ms);

// Shuts down the AudioEmbedder when all works are done.
absl::Status Close() { return runner_->Close(); }
Expand Down
8 changes: 4 additions & 4 deletions mediapipe/tasks/cc/core/external_file_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ class ExternalFileHandler {
void* buffer_{};

// The mapped memory buffer offset, if any.
int64 buffer_offset_{};
int64_t buffer_offset_{};
// The size in bytes of the mapped memory buffer, if any.
int64 buffer_size_{};
int64_t buffer_size_{};

// As mmap(2) requires the offset to be a multiple of sysconf(_SC_PAGE_SIZE):

// The aligned mapped memory buffer offset, if any.
int64 buffer_aligned_offset_{};
int64_t buffer_aligned_offset_{};
// The aligned mapped memory buffer size in bytes taking into account the
// offset shift introduced by buffer_aligned_memory_offset_, if any.
int64 buffer_aligned_size_{};
int64_t buffer_aligned_size_{};
};

} // namespace core
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ limitations under the License.

#include "mediapipe/tasks/cc/text/custom_ops/ragged/ragged_tensor_to_tensor_tflite.h"

#include <cstdint>
#include <initializer_list>
#include <string>
#include <vector>
Expand Down Expand Up @@ -79,7 +80,9 @@ class RaggedTensorToTensorOpModel : public tflite::SingleOpModel {
std::vector<int> GetOutputShape() { return GetTensorShape(output_); }

std::vector<float> GetOutputFloat() { return ExtractVector<float>(output_); }
std::vector<int32> GetOutputInt() { return ExtractVector<int32>(output_); }
std::vector<int32_t> GetOutputInt() {
return ExtractVector<int32_t>(output_);
}

void InvokeFloat(const std::vector<int>& shape,
const std::vector<float>& values, float default_value,
Expand All @@ -93,7 +96,7 @@ class RaggedTensorToTensorOpModel : public tflite::SingleOpModel {
SingleOpModel::Invoke();
}
void InvokeInt(const std::vector<int>& shape,
const std::vector<int32>& values, int32 default_value,
const std::vector<int32_t>& values, int32_t default_value,
const std::vector<std::vector<int>>& partition_values) {
PopulateTensor(input_shape_, shape);
PopulateTensor(input_values_, values);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ limitations under the License.

#include "mediapipe/tasks/cc/text/custom_ops/sentencepiece/sentencepiece_tokenizer_tflite.h"

#include <cstdint>

#include "flatbuffers/flexbuffers.h"
#include "mediapipe/tasks/cc/text/custom_ops/sentencepiece/optimized_encoder.h"
#include "tensorflow/lite/c/common.h"
Expand Down Expand Up @@ -85,8 +87,8 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
context->tensors[node->inputs->data[kReverseInput]];
const bool reverse = reverse_tensor.data.b[0];

std::vector<int32> encoded;
std::vector<int32> splits;
std::vector<int32_t> encoded;
std::vector<int32_t> splits;
const int num_strings = tflite::GetStringCount(&input_text);
for (int i = 0; i < num_strings; ++i) {
const auto strref = tflite::GetString(&input_text, i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct GestureRecognizerOptions {
// The result callback should only be specified when the running mode is set
// to RunningMode::LIVE_STREAM.
std::function<void(absl::StatusOr<GestureRecognizerResult>, const Image&,
int64)>
int64_t)>
result_callback = nullptr;
};

Expand Down Expand Up @@ -157,7 +157,7 @@ class GestureRecognizer : tasks::vision::core::BaseVisionTaskApi {
// provide the video frame's timestamp (in milliseconds). The input timestamps
// must be monotonically increasing.
absl::StatusOr<GestureRecognizerResult> RecognizeForVideo(
Image image, int64 timestamp_ms,
Image image, int64_t timestamp_ms,
std::optional<core::ImageProcessingOptions> image_processing_options =
std::nullopt);

Expand Down Expand Up @@ -185,7 +185,7 @@ class GestureRecognizer : tasks::vision::core::BaseVisionTaskApi {
// longer be valid when the callback returns. To access the image data
// outside of the callback, callers need to make a copy of the image.
// - The input timestamp in milliseconds.
absl::Status RecognizeAsync(Image image, int64 timestamp_ms,
absl::Status RecognizeAsync(Image image, int64_t timestamp_ms,
std::optional<core::ImageProcessingOptions>
image_processing_options = std::nullopt);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#include <cstdint>
#include <memory>
#include <utility>
#include <vector>
Expand Down Expand Up @@ -161,7 +162,7 @@ class HandAssociationCalculator : public CalculatorBase {
// Note: This rect_id_ is local to an instance of this calculator. And it is
// expected that the hand tracking graph to have only one instance of
// this association calculator.
int64 rect_id_ = 1;
int64_t rect_id_ = 1;

inline int GetNextRectId() { return rect_id_++; }
};
Expand Down
7 changes: 4 additions & 3 deletions mediapipe/tasks/cc/vision/hand_landmarker/hand_landmarker.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ struct HandLandmarkerOptions {
// The user-defined result callback for processing live stream data.
// The result callback should only be specified when the running mode is set
// to RunningMode::LIVE_STREAM.
std::function<void(absl::StatusOr<HandLandmarkerResult>, const Image&, int64)>
std::function<void(absl::StatusOr<HandLandmarkerResult>, const Image&,
int64_t)>
result_callback = nullptr;
};

Expand Down Expand Up @@ -146,7 +147,7 @@ class HandLandmarker : tasks::vision::core::BaseVisionTaskApi {
// provide the video frame's timestamp (in milliseconds). The input timestamps
// must be monotonically increasing.
absl::StatusOr<HandLandmarkerResult> DetectForVideo(
Image image, int64 timestamp_ms,
Image image, int64_t timestamp_ms,
std::optional<core::ImageProcessingOptions> image_processing_options =
std::nullopt);

Expand Down Expand Up @@ -174,7 +175,7 @@ class HandLandmarker : tasks::vision::core::BaseVisionTaskApi {
// longer be valid when the callback returns. To access the image data
// outside of the callback, callers need to make a copy of the image.
// - The input timestamp in milliseconds.
absl::Status DetectAsync(Image image, int64 timestamp_ms,
absl::Status DetectAsync(Image image, int64_t timestamp_ms,
std::optional<core::ImageProcessingOptions>
image_processing_options = std::nullopt);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#include <cstdint>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -55,7 +56,7 @@ using ::mediapipe::api2::builder::Source;
using ::mediapipe::tasks::components::utils::AllowIf;
using ::mediapipe::tasks::vision::hand_landmarker::proto::
HandLandmarksDetectorGraphOptions;
using LabelItems = mediapipe::proto_ns::Map<int64, ::mediapipe::LabelMapItem>;
using LabelItems = mediapipe::proto_ns::Map<int64_t, ::mediapipe::LabelMapItem>;

constexpr char kImageTag[] = "IMAGE";
constexpr char kHandRectTag[] = "HAND_RECT";
Expand Down
6 changes: 3 additions & 3 deletions mediapipe/tasks/cc/vision/image_classifier/image_classifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct ImageClassifierOptions {
// The result callback should only be specified when the running mode is set
// to RunningMode::LIVE_STREAM.
std::function<void(absl::StatusOr<ImageClassifierResult>, const Image&,
int64)>
int64_t)>
result_callback = nullptr;
};

Expand Down Expand Up @@ -148,7 +148,7 @@ class ImageClassifier : tasks::vision::core::BaseVisionTaskApi {
// provide the video frame's timestamp (in milliseconds). The input timestamps
// must be monotonically increasing.
absl::StatusOr<ImageClassifierResult> ClassifyForVideo(
mediapipe::Image image, int64 timestamp_ms,
mediapipe::Image image, int64_t timestamp_ms,
std::optional<core::ImageProcessingOptions> image_processing_options =
std::nullopt);

Expand Down Expand Up @@ -179,7 +179,7 @@ class ImageClassifier : tasks::vision::core::BaseVisionTaskApi {
// longer be valid when the callback returns. To access the image data
// outside of the callback, callers need to make a copy of the image.
// - The input timestamp in milliseconds.
absl::Status ClassifyAsync(mediapipe::Image image, int64 timestamp_ms,
absl::Status ClassifyAsync(mediapipe::Image image, int64_t timestamp_ms,
std::optional<core::ImageProcessingOptions>
image_processing_options = std::nullopt);

Expand Down
7 changes: 4 additions & 3 deletions mediapipe/tasks/cc/vision/image_embedder/image_embedder.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ struct ImageEmbedderOptions {
// The user-defined result callback for processing live stream data.
// The result callback should only be specified when the running mode is set
// to RunningMode::LIVE_STREAM.
std::function<void(absl::StatusOr<ImageEmbedderResult>, const Image&, int64)>
std::function<void(absl::StatusOr<ImageEmbedderResult>, const Image&,
int64_t)>
result_callback = nullptr;
};

Expand Down Expand Up @@ -130,7 +131,7 @@ class ImageEmbedder : core::BaseVisionTaskApi {
// provide the video frame's timestamp (in milliseconds). The input timestamps
// must be monotonically increasing.
absl::StatusOr<ImageEmbedderResult> EmbedForVideo(
mediapipe::Image image, int64 timestamp_ms,
mediapipe::Image image, int64_t timestamp_ms,
std::optional<core::ImageProcessingOptions> image_processing_options =
std::nullopt);

Expand Down Expand Up @@ -163,7 +164,7 @@ class ImageEmbedder : core::BaseVisionTaskApi {
// longer be valid when the callback returns. To access the image data
// outside of the callback, callers need to make a copy of the image.
// - The input timestamp in milliseconds.
absl::Status EmbedAsync(mediapipe::Image image, int64 timestamp_ms,
absl::Status EmbedAsync(mediapipe::Image image, int64_t timestamp_ms,
std::optional<core::ImageProcessingOptions>
image_processing_options = std::nullopt);

Expand Down
7 changes: 4 additions & 3 deletions mediapipe/tasks/cc/vision/object_detector/object_detector.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ struct ObjectDetectorOptions {
// The user-defined result callback for processing live stream data.
// The result callback should only be specified when the running mode is set
// to RunningMode::LIVE_STREAM.
std::function<void(absl::StatusOr<ObjectDetectorResult>, const Image&, int64)>
std::function<void(absl::StatusOr<ObjectDetectorResult>, const Image&,
int64_t)>
result_callback = nullptr;
};

Expand Down Expand Up @@ -206,7 +207,7 @@ class ObjectDetector : public tasks::vision::core::BaseVisionTaskApi {
// image_width) x [0, image_height)`, which are the dimensions of the
// underlying image data.
absl::StatusOr<ObjectDetectorResult> DetectForVideo(
mediapipe::Image image, int64 timestamp_ms,
mediapipe::Image image, int64_t timestamp_ms,
std::optional<core::ImageProcessingOptions> image_processing_options =
std::nullopt);

Expand Down Expand Up @@ -236,7 +237,7 @@ class ObjectDetector : public tasks::vision::core::BaseVisionTaskApi {
// longer be valid when the callback returns. To access the image data
// outside of the callback, callers need to make a copy of the image.
// - The input timestamp in milliseconds.
absl::Status DetectAsync(mediapipe::Image image, int64 timestamp_ms,
absl::Status DetectAsync(mediapipe::Image image, int64_t timestamp_ms,
std::optional<core::ImageProcessingOptions>
image_processing_options = std::nullopt);

Expand Down
7 changes: 4 additions & 3 deletions mediapipe/tasks/cc/vision/pose_landmarker/pose_landmarker.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ struct PoseLandmarkerOptions {
// The user-defined result callback for processing live stream data.
// The result callback should only be specified when the running mode is set
// to RunningMode::LIVE_STREAM.
std::function<void(absl::StatusOr<PoseLandmarkerResult>, const Image&, int64)>
std::function<void(absl::StatusOr<PoseLandmarkerResult>, const Image&,
int64_t)>
result_callback = nullptr;

// Whether to output segmentation masks.
Expand Down Expand Up @@ -146,7 +147,7 @@ class PoseLandmarker : tasks::vision::core::BaseVisionTaskApi {
// provide the video frame's timestamp (in milliseconds). The input timestamps
// must be monotonically increasing.
absl::StatusOr<PoseLandmarkerResult> DetectForVideo(
Image image, int64 timestamp_ms,
Image image, int64_t timestamp_ms,
std::optional<core::ImageProcessingOptions> image_processing_options =
std::nullopt);

Expand Down Expand Up @@ -174,7 +175,7 @@ class PoseLandmarker : tasks::vision::core::BaseVisionTaskApi {
// longer be valid when the callback returns. To access the image data
// outside of the callback, callers need to make a copy of the image.
// - The input timestamp in milliseconds.
absl::Status DetectAsync(Image image, int64 timestamp_ms,
absl::Status DetectAsync(Image image, int64_t timestamp_ms,
std::optional<core::ImageProcessingOptions>
image_processing_options = std::nullopt);

Expand Down

0 comments on commit d6c7aaa

Please sign in to comment.