/*
 * 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 RISP4ML_COMMON_IMAGE_H_
#define 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  // RISP4ML_COMMON_IMAGE_H_
