Project import generated by Copybara.

GitOrigin-RevId: 1138530ad1578c5d6615b3e3d041775c75d310c4
This commit is contained in:
MediaPipe Team
2019-09-11 14:29:38 -07:00
committed by jqtang
parent 423c21b454
commit 61bc4556af
173 changed files with 1806 additions and 1824 deletions
+2 -2
View File
@@ -37,7 +37,7 @@ mediapipe_cc_proto_library(
name = "flow_to_image_calculator_cc_proto",
srcs = ["flow_to_image_calculator.proto"],
cc_deps = ["//mediapipe/framework:calculator_cc_proto"],
visibility = ["//mediapipe:__subpackages__"],
visibility = ["//visibility:public"],
deps = [":flow_to_image_calculator_proto"],
)
@@ -45,7 +45,7 @@ mediapipe_cc_proto_library(
name = "opencv_video_encoder_calculator_cc_proto",
srcs = ["opencv_video_encoder_calculator.proto"],
cc_deps = ["//mediapipe/framework:calculator_cc_proto"],
visibility = ["//mediapipe:__subpackages__"],
visibility = ["//visibility:public"],
deps = [":opencv_video_encoder_calculator_proto"],
)
@@ -41,13 +41,13 @@ TEST(OpenCvVideoDecoderCalculatorTest, TestMp4Avc720pVideo) {
file::JoinPath("./",
"/mediapipe/calculators/video/"
"testdata/format_MP4_AVC720P_AAC.video"));
MEDIAPIPE_EXPECT_OK(runner.Run());
MP_EXPECT_OK(runner.Run());
EXPECT_EQ(runner.Outputs().Tag("VIDEO_PRESTREAM").packets.size(), 1);
MEDIAPIPE_EXPECT_OK(runner.Outputs()
.Tag("VIDEO_PRESTREAM")
.packets[0]
.ValidateAsType<VideoHeader>());
MP_EXPECT_OK(runner.Outputs()
.Tag("VIDEO_PRESTREAM")
.packets[0]
.ValidateAsType<VideoHeader>());
const mediapipe::VideoHeader& header =
runner.Outputs().Tag("VIDEO_PRESTREAM").packets[0].Get<VideoHeader>();
EXPECT_EQ(ImageFormat::SRGB, header.format);
@@ -83,13 +83,13 @@ TEST(OpenCvVideoDecoderCalculatorTest, TestFlvH264Video) {
file::JoinPath("./",
"/mediapipe/calculators/video/"
"testdata/format_FLV_H264_AAC.video"));
MEDIAPIPE_EXPECT_OK(runner.Run());
MP_EXPECT_OK(runner.Run());
EXPECT_EQ(runner.Outputs().Tag("VIDEO_PRESTREAM").packets.size(), 1);
MEDIAPIPE_EXPECT_OK(runner.Outputs()
.Tag("VIDEO_PRESTREAM")
.packets[0]
.ValidateAsType<VideoHeader>());
MP_EXPECT_OK(runner.Outputs()
.Tag("VIDEO_PRESTREAM")
.packets[0]
.ValidateAsType<VideoHeader>());
const mediapipe::VideoHeader& header =
runner.Outputs().Tag("VIDEO_PRESTREAM").packets[0].Get<VideoHeader>();
EXPECT_EQ(ImageFormat::SRGB, header.format);
@@ -127,13 +127,13 @@ TEST(OpenCvVideoDecoderCalculatorTest, TestMkvVp8Video) {
file::JoinPath("./",
"/mediapipe/calculators/video/"
"testdata/format_MKV_VP8_VORBIS.video"));
MEDIAPIPE_EXPECT_OK(runner.Run());
MP_EXPECT_OK(runner.Run());
EXPECT_EQ(runner.Outputs().Tag("VIDEO_PRESTREAM").packets.size(), 1);
MEDIAPIPE_EXPECT_OK(runner.Outputs()
.Tag("VIDEO_PRESTREAM")
.packets[0]
.ValidateAsType<VideoHeader>());
MP_EXPECT_OK(runner.Outputs()
.Tag("VIDEO_PRESTREAM")
.packets[0]
.ValidateAsType<VideoHeader>());
const mediapipe::VideoHeader& header =
runner.Outputs().Tag("VIDEO_PRESTREAM").packets[0].Get<VideoHeader>();
EXPECT_EQ(ImageFormat::SRGB, header.format);
@@ -66,17 +66,17 @@ TEST(OpenCvVideoEncoderCalculatorTest, DISABLED_TestMp4Avc720pVideo) {
input_side_packets["output_file_path"] =
MakePacket<std::string>(output_file_path);
CalculatorGraph graph;
MEDIAPIPE_ASSERT_OK(graph.Initialize(config, input_side_packets));
MP_ASSERT_OK(graph.Initialize(config, input_side_packets));
StatusOrPoller status_or_poller =
graph.AddOutputStreamPoller("video_prestream");
ASSERT_TRUE(status_or_poller.ok());
OutputStreamPoller poller = std::move(status_or_poller.ValueOrDie());
MEDIAPIPE_ASSERT_OK(graph.StartRun({}));
MP_ASSERT_OK(graph.StartRun({}));
Packet packet;
while (poller.Next(&packet)) {
}
MEDIAPIPE_ASSERT_OK(graph.WaitUntilDone());
MP_ASSERT_OK(graph.WaitUntilDone());
const VideoHeader& video_header = packet.Get<VideoHeader>();
// Checks the generated video file has the same width, height, fps, and
@@ -125,17 +125,17 @@ TEST(OpenCvVideoEncoderCalculatorTest, TestFlvH264Video) {
input_side_packets["output_file_path"] =
MakePacket<std::string>(output_file_path);
CalculatorGraph graph;
MEDIAPIPE_ASSERT_OK(graph.Initialize(config, input_side_packets));
MP_ASSERT_OK(graph.Initialize(config, input_side_packets));
StatusOrPoller status_or_poller =
graph.AddOutputStreamPoller("video_prestream");
ASSERT_TRUE(status_or_poller.ok());
OutputStreamPoller poller = std::move(status_or_poller.ValueOrDie());
MEDIAPIPE_ASSERT_OK(graph.StartRun({}));
MP_ASSERT_OK(graph.StartRun({}));
Packet packet;
while (poller.Next(&packet)) {
}
MEDIAPIPE_ASSERT_OK(graph.WaitUntilDone());
MP_ASSERT_OK(graph.WaitUntilDone());
const VideoHeader& video_header = packet.Get<VideoHeader>();
// Checks the generated video file has the same width, height, fps, and
@@ -186,17 +186,17 @@ TEST(OpenCvVideoEncoderCalculatorTest, TestMkvVp8Video) {
input_side_packets["output_file_path"] =
MakePacket<std::string>(output_file_path);
CalculatorGraph graph;
MEDIAPIPE_ASSERT_OK(graph.Initialize(config, input_side_packets));
MP_ASSERT_OK(graph.Initialize(config, input_side_packets));
StatusOrPoller status_or_poller =
graph.AddOutputStreamPoller("video_prestream");
ASSERT_TRUE(status_or_poller.ok());
OutputStreamPoller poller = std::move(status_or_poller.ValueOrDie());
MEDIAPIPE_ASSERT_OK(graph.StartRun({}));
MP_ASSERT_OK(graph.StartRun({}));
Packet packet;
while (poller.Next(&packet)) {
}
MEDIAPIPE_ASSERT_OK(graph.WaitUntilDone());
MP_ASSERT_OK(graph.WaitUntilDone());
const VideoHeader& video_header = packet.Get<VideoHeader>();
// Checks the generated video file has the same width, height, fps, and
+1
View File
@@ -24,6 +24,7 @@ load("//mediapipe/framework/port:build_config.bzl", "mediapipe_cc_proto_library"
proto_library(
name = "flow_quantizer_model_proto",
srcs = ["flow_quantizer_model.proto"],
visibility = ["//mediapipe:__subpackages__"],
)
mediapipe_cc_proto_library(
@@ -133,16 +133,16 @@ class Tvl1OpticalFlowCalculator : public CalculatorBase {
cc->Inputs().Tag("SECOND_FRAME").Value().Get<ImageFrame>();
if (forward_requested_) {
auto forward_optical_flow_field = absl::make_unique<OpticalFlowField>();
RETURN_IF_ERROR(CalculateOpticalFlow(first_frame, second_frame,
forward_optical_flow_field.get()));
MP_RETURN_IF_ERROR(CalculateOpticalFlow(first_frame, second_frame,
forward_optical_flow_field.get()));
cc->Outputs()
.Tag("FORWARD_FLOW")
.Add(forward_optical_flow_field.release(), cc->InputTimestamp());
}
if (backward_requested_) {
auto backward_optical_flow_field = absl::make_unique<OpticalFlowField>();
RETURN_IF_ERROR(CalculateOpticalFlow(second_frame, first_frame,
backward_optical_flow_field.get()));
MP_RETURN_IF_ERROR(CalculateOpticalFlow(second_frame, first_frame,
backward_optical_flow_field.get()));
cc->Outputs()
.Tag("BACKWARD_FLOW")
.Add(backward_optical_flow_field.release(), cc->InputTimestamp());
@@ -49,12 +49,12 @@ void AddInputPackets(int num_packets, CalculatorGraph* graph) {
}
for (int i = 0; i < num_packets; ++i) {
MEDIAPIPE_ASSERT_OK(graph->AddPacketToInputStream(
"first_frames", packet1.At(Timestamp(i))));
MEDIAPIPE_ASSERT_OK(graph->AddPacketToInputStream(
"second_frames", packet2.At(Timestamp(i))));
MP_ASSERT_OK(graph->AddPacketToInputStream("first_frames",
packet1.At(Timestamp(i))));
MP_ASSERT_OK(graph->AddPacketToInputStream("second_frames",
packet2.At(Timestamp(i))));
}
MEDIAPIPE_ASSERT_OK(graph->CloseAllInputStreams());
MP_ASSERT_OK(graph->CloseAllInputStreams());
}
void RunTest(int num_input_packets, int max_in_flight) {
@@ -74,7 +74,7 @@ void RunTest(int num_input_packets, int max_in_flight) {
)",
max_in_flight));
CalculatorGraph graph;
MEDIAPIPE_ASSERT_OK(graph.Initialize(config));
MP_ASSERT_OK(graph.Initialize(config));
StatusOrPoller status_or_poller1 =
graph.AddOutputStreamPoller("forward_flow");
ASSERT_TRUE(status_or_poller1.ok());
@@ -84,7 +84,7 @@ void RunTest(int num_input_packets, int max_in_flight) {
ASSERT_TRUE(status_or_poller2.ok());
OutputStreamPoller poller2 = std::move(status_or_poller2.ValueOrDie());
MEDIAPIPE_ASSERT_OK(graph.StartRun({}));
MP_ASSERT_OK(graph.StartRun({}));
AddInputPackets(num_input_packets, &graph);
Packet packet;
std::vector<Packet> forward_optical_flow_packets;
@@ -95,7 +95,7 @@ void RunTest(int num_input_packets, int max_in_flight) {
while (poller2.Next(&packet)) {
backward_optical_flow_packets.emplace_back(packet);
}
MEDIAPIPE_ASSERT_OK(graph.WaitUntilDone());
MP_ASSERT_OK(graph.WaitUntilDone());
EXPECT_EQ(num_input_packets, forward_optical_flow_packets.size());
int count = 0;