/*
 * Copyright 2022 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 SAMPLES_RISP4ML_COMMON_IMAGE_H_
#define SAMPLES_RISP4ML_COMMON_IMAGE_H_

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif  // __cplusplus

typedef uint16_t pixel_type_t;

typedef struct {
  uint16_t num_channels;
  uint16_t height;
  uint16_t width;
  pixel_type_t* data;
} Image;

typedef struct {
  uint16_t num_channels;
  uint16_t height;
  uint16_t width;
  uint8_t* data;
} ImageU8;

Image* image_new(uint16_t num_channels, uint16_t height, uint16_t width);

void image_delete(Image* image);

pixel_type_t* image_pixel(Image* image, uint16_t c, uint16_t y, uint16_t x);

inline pixel_type_t image_pixel_val(Image* image, uint16_t c, uint16_t y,
                                    uint16_t x) {
  return *image_pixel(image, c, y, x);
}

pixel_type_t* image_row(Image* image, uint16_t c, uint16_t y);

#ifdef __cplusplus
}  // extern "C"
#endif  // __cplusplus

#endif  // SAMPLES_RISP4ML_COMMON_IMAGE_H_
