// Copyright 2019 The MediaPipe Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto2";

package mediapipe;

import "mediapipe/framework/calculator.proto";
import "tensorflow/core/example/feature.proto";

message PackMediaSequenceCalculatorOptions {
  extend mediapipe.CalculatorOptions {
    optional PackMediaSequenceCalculatorOptions ext = 243132285;
  }

  // Provide a map of strings to tf.Features to merge into the SequenceExample's
  // context. Use this to add new metadata.
  optional tensorflow.Features context_feature_map = 1;

  // If true, update the context for the SequenceExample features.
  // (e.g. fills in the image height, width, and number of frames.)
  optional bool reconcile_metadata = 2 [default = true];

  // If true, updates the metadata for bounding box portions of sequences. This
  // will align each bounding box annotation with the nearest frame and insert
  // empty annotations as needed to satisfy the frame rate.
  // NOTE: IF YOU DOWNSAMPLE IN TIME YOU WILL LOSE ANNOTATIONS.
  //       If two or more annotations are closest to the same frame, then only
  //       the closest annotation is saved. This matches the behavior of
  //       downsampling images in time.
  optional bool reconcile_bbox_annotations = 5 [default = false];

  // If true, updates the metadata for all regions annotations, regardless of
  // prefix, in the sequence. This will align each region annotation with the
  // nearest frame and insert empty annotations as needed to satisfy the frame
  // rate. This is particularly useful for key point annotations that are
  // represented as region points. This does not exclude bboxes.
  // NOTE: IF YOU DOWNSAMPLE IN TIME YOU WILL LOSE ANNOTATIONS.
  //       If two or more annotations are closest to the same frame, then only
  //       the closest annotation is saved. This matches the behavior of
  //       downsampling images in time.
  optional bool reconcile_region_annotations = 6 [default = true];

  // If true, the SequenceExample is output only if all input streams are
  // present.
  optional bool output_only_if_all_present = 3 [default = true];

  // If true, will remove all data from a sequence example for a corresponding
  // input stream. E.g. if images are already present and an IMAGE stream is
  // present, the previous images and timestamps will be removed before adding
  // the new images.
  optional bool replace_data_instead_of_append = 4 [default = true];

  // If true, will return an error status if an output sequence would be too
  // many bytes to serialize.
  optional bool skip_large_sequences = 7 [default = true];

  // If true/false, outputs the SequenceExample at timestamp 0/PostStream.
  optional bool output_as_zero_timestamp = 8 [default = false];
}
