/*
 * Copyright 2023 Google LLC
 *
 * 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.
 */

#ifndef TESTS_CV_DIFF_H_
#define TESTS_CV_DIFF_H_

#include <cstdint>

namespace kelvin::cv {

// DUT: diff.cc
// REF: diff_test.cc

// Stripmine horizontally one line.
void diff(int num_cols, const uint16_t* input0_row, const uint16_t* input1_row,
          uint16_t* output_row);

// Stripmine horizontally one line with stage pipelining.
void diffp(int num_cols, const uint16_t* input0_row, const uint16_t* input1_row,
           uint16_t* output_row);

// Stripmine vertically four lines.
void diff4(int num_cols, int stride, const uint16_t* input0_row,
           const uint16_t* input1_row, uint16_t* output_row);

// Stripmine vertically four lines with stage pipelining.
void diff4p(int num_cols, int stride, const uint16_t* input0_row,
            const uint16_t* input1_row, uint16_t* output_row);

};  // namespace kelvin::cv

#endif  // TESTS_CV_DIFF_H_
