<commit_before>#ifndef OMXCAM_H
#define OMXCAM_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>
#include <IL/OMX_Broadcom.h>

#include "omxcam_version.h"

#if __GNUC__ >= 4
# define OMXCAM_EXTERN __attribute__ ((visibility ("default")))
#else
# define OMXCAM_EXTERN //Empty
#endif

//Handy way to sleep forever while recording a video
#define OMXCAM_CAPTURE_FOREVER 0

//Error definitions, expand if necessary
#define OMXCAM_ERRNO_MAP(XX)                                                   \
  XX (0, ERROR_NONE, "success")                                                \
  XX (1, ERROR_CAMERA_MODULE, "camera module is not ready to be used")         \
  XX (2, ERROR_DRIVERS, "cannot load the camera drivers")                      \
  XX (3, ERROR_INIT, "initialization error")                                   \
  XX (4, ERROR_INIT_CAMERA, "cannot initialize the 'camera' component")        \
  XX (5, ERROR_INIT_IMAGE_ENCODER, "cannot initialize the 'image_encode' "     \
      "component")                                                             \
  XX (6, ERROR_INIT_VIDEO_ENCODER, "cannot initialize the 'video_encode' "     \
      "component")                                                             \
  XX (7, ERROR_INIT_NULL_SINK, "cannot initialize the 'null_sink' component")  \
  XX (8, ERROR_DEINIT, "deinitialization error")                               \
  XX (9, ERROR_DEINIT_CAMERA, "cannot deinitialize the 'camera' component")    \
  XX (10, ERROR_DEINIT_IMAGE_ENCODER, "cannot deinitialize the 'image_encode' "\
      "component")                                                             \
  XX (11, ERROR_DEINIT_VIDEO_ENCODER, "cannot deinitialize the 'video_encode' "\
      "component")                                                             \
  XX (12, ERROR_DEINIT_NULL_SINK, "cannot deinitialize the 'null_sink' "       \
      "component")                                                             \
  XX (13, ERROR_CAPTURE, "error while capturing")                              \
  XX (14, ERROR_CAMERA_RUNNING, "camera is already running")                   \
  XX (15, ERROR_CAMERA_STOPPING, "camera is already being stopped")            \
  XX (16, ERROR_BAD_PARAMETER, "incorrect parameter value")                    \
  XX (17, ERROR_STILL, "still error")                                          \
  XX (18, ERROR_VIDEO, "video error")                                          \
  XX (19, ERROR_JPEG, "error configuring jpeg encoder")                        \
  XX (20, ERROR_H264, "error configuring h264 encoder")                        \
  XX (21, ERROR_LOADED, "cannot transition to the Loaded state")               \
  XX (22, ERROR_IDLE, "cannot transition to the Idle state")                   \
  XX (23, ERROR_EXECUTING, "cannot transition to the Executing state")         \
  XX (24, ERROR_FORMAT, "invalid encoding format")                             \
  XX (25, ERROR_SLEEP, "cannot sleep the thread")                              \
  XX (26, ERROR_WAKE, "cannot wake the thread")                                \
  XX (27, ERROR_LOCK, "cannot lock the thread")                                \
  XX (28, ERROR_UNLOCK, "cannot unlock the thread")

typedef enum {
  OMXCAM_FALSE,
  OMXCAM_TRUE
} omxcam_bool;

typedef enum {
  OMXCAM_FORMAT_RGB888,
  OMXCAM_FORMAT_RGBA8888,
  OMXCAM_FORMAT_YUV420,
  OMXCAM_FORMAT_JPEG,
  OMXCAM_FORMAT_H264
} omxcam_format;

typedef enum {
  OMXCAM_EXPOSURE_OFF = OMX_ExposureControlOff,
  OMXCAM_EXPOSURE_AUTO = OMX_ExposureControlAuto,
  OMXCAM_EXPOSURE_NIGHT = OMX_ExposureControlNight,
  OMXCAM_EXPOSURE_BLACK_LIGHT = OMX_ExposureControlBackLight,
  OMXCAM_EXPOSURE_SPOTLIGHT = OMX_ExposureControlSpotLight,
  OMXCAM_EXPOSURE_SPORTS = OMX_ExposureControlSports,
  OMXCAM_EXPOSURE_SNOW = OMX_ExposureControlSnow,
  OMXCAM_EXPOSURE_BEACH = OMX_ExposureControlBeach,
  OMXCAM_EXPOSURE_LARGE_APERTURE = OMX_ExposureControlLargeAperture,
  OMXCAM_EXPOSURE_SMALL_APERTURE = OMX_ExposureControlSmallAperture,
  OMXCAM_EXPOSURE_VERY_LONG = OMX_ExposureControlVeryLong,
  OMXCAM_EXPOSURE_FIXED_FPS = OMX_ExposureControlFixedFps,
  OMXCAM_EXPOSURE_NIGHT_WITH_PREVIEW = OMX_ExposureControlNightWithPreview,
  OMXCAM_EXPOSURE_ANTISHAKE = OMX_ExposureControlAntishake,
  OMXCAM_EXPOSURE_FIREWORKS = OMX_ExposureControlFireworks
} omxcam_exposure;

typedef enum {
  OMXCAM_IMAGE_FILTER_NONE = OMX_ImageFilterNone,
  OMXCAM_IMAGE_FILTER_NOISE = OMX_ImageFilterNoise,
  OMXCAM_IMAGE_FILTER_EMBOSS = OMX_ImageFilterEmboss,
  OMXCAM_IMAGE_FILTER_NEGATIVE = OMX_ImageFilterNegative,
  OMXCAM_IMAGE_FILTER_SKETCH = OMX_ImageFilterSketch,
  OMXCAM_IMAGE_FILTER_OILPAINT = OMX_ImageFilterOilPaint,
  OMXCAM_IMAGE_FILTER_HATCH = OMX_ImageFilterHatch,
  OMXCAM_IMAGE_FILTER_GPEN = OMX_ImageFilterGpen,
  OMXCAM_IMAGE_FILTER_ANTIALIAS = OMX_ImageFilterAntialias,
  OMXCAM_IMAGE_FILTER_DERING = OMX_ImageFilterDeRing,
  OMXCAM_IMAGE_FILTER_SOLARIZE = OMX_ImageFilterSolarize,
  OMXCAM_IMAGE_FILTER_WATERCOLOR = OMX_ImageFilterWatercolor,
  OMXCAM_IMAGE_FILTER_PASTEL = OMX_ImageFilterPastel,
  OMXCAM_IMAGE_FILTER_SHARPEN = OMX_ImageFilterSharpen,
  OMXCAM_IMAGE_FILTER_FILM = OMX_ImageFilterFilm,
  OMXCAM_IMAGE_FILTER_BLUR = OMX_ImageFilterBlur,
  OMXCAM_IMAGE_FILTER_SATURATION = OMX_ImageFilterSaturation,
  OMXCAM_IMAGE_FILTER_DEINTERLACE_LINE_DOUBLE =
      OMX_ImageFilterDeInterlaceLineDouble,
  OMXCAM_IMAGE_FILTER_DEINTERLACE_ADVANCED = OMX_ImageFilterDeInterlaceAdvanced,
  OMXCAM_IMAGE_FILTER_COLOUR_SWAP = OMX_ImageFilterColourSwap,
  OMXCAM_IMAGE_FILTER_WASHED_OUT = OMX_ImageFilterWashedOut,
  OMXCAM_IMAGE_FILTER_COLOUR_POINT = OMX_ImageFilterColourPoint,
  OMXCAM_IMAGE_FILTER_POSTERISE = OMX_ImageFilterPosterise,
  OMXCAM_IMAGE_FILTER_COLOUR_BALANCE = OMX_ImageFilterColourBalance,
  OMXCAM_IMAGE_FILTER_CARTOON = OMX_ImageFilterCartoon
} omxcam_image_filter;

typedef enum {
  OMXCAM_METERING_AVERAGE = OMX_MeteringModeAverage,
  OMXCAM_METERING_SPOT = OMX_MeteringModeSpot,
  OMXCAM_METERING_MATRIX = OMX_MeteringModeMatrix,
  OMXCAM_METERING_BACKLIT = OMX_MeteringModeBacklit
} omxcam_metering;

typedef enum {
  OMXCAM_MIRROR_NONE = OMX_MirrorNone,
  OMXCAM_MIRROR_VERTICAL = OMX_MirrorVertical,
  OMXCAM_MIRROR_HORIZONTAL = OMX_MirrorHorizontal,
  OMXCAM_MIRROR_BOTH = OMX_MirrorBoth
} omxcam_mirror;

typedef enum {
  OMXCAM_ROTATION_NONE = 0,
  OMXCAM_ROTATION_90 = 90,
  OMXCAM_ROTATION_180 = 180,
  OMXCAM_ROTATION_270 = 270
} omxcam_rotation;

typedef enum {
  OMXCAM_WHITE_BALANCE_OFF = OMX_WhiteBalControlOff,
  OMXCAM_WHITE_BALANCE_AUTO = OMX_WhiteBalControlAuto,
  OMXCAM_WHITE_BALANCE_SUNLIGHT = OMX_WhiteBalControlSunLight,
  OMXCAM_WHITE_BALANCE_CLOUDY = OMX_WhiteBalControlCloudy,
  OMXCAM_WHITE_BALANCE_SHADE = OMX_WhiteBalControlShade,
  OMXCAM_WHITE_BALANCE_TUNGSTEN = OMX_WhiteBalControlTungsten,
  OMXCAM_WHITE_BALANCE_FLUORESCENT = OMX_WhiteBalControlFluorescent,
  OMXCAM_WHITE_BALANCE_INCANDESCENT = OMX_WhiteBalControlIncandescent,
  OMXCAM_WHITE_BALANCE_FLASH = OMX_WhiteBalControlFlash,
  OMXCAM_WHITE_BALANCE_HORIZON = OMX_WhiteBalControlHorizon
} omxcam_white_balance;

typedef enum {
#define XX(errno, name, _) OMXCAM_ ## name = errno,
  OMXCAM_ERRNO_MAP (XX)
#undef XX
} omxcam_errno;

typedef struct {
  uint32_t width;
  uint32_t height;
  uint32_t sharpness;
  uint32_t contrast;
  uint32_t brightness;
  uint32_t saturation;
  omxcam_bool shutter_speed_auto;
  uint32_t shutter_speed;
  omxcam_bool iso_auto;
  uint32_t iso;
  omxcam_exposure exposure;
  int32_t exposure_compensation;
  omxcam_mirror mirror;
  omxcam_rotation rotation;
  omxcam_bool color_enhancement;
  uint32_t color_u;
  uint32_t color_v;
  omxcam_bool noise_reduction;
  omxcam_metering metering;
  omxcam_white_balance white_balance;
  //The gains are used if the white balance is set to off
  uint32_t white_balance_red_gain;
  uint32_t white_balance_blue_gain;<commit_msg>fixed camera parameters with signed type<commit_after>#ifndef OMXCAM_H
#define OMXCAM_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>
#include <IL/OMX_Broadcom.h>

#include "omxcam_version.h"

#if __GNUC__ >= 4
# define OMXCAM_EXTERN __attribute__ ((visibility ("default")))
#else
# define OMXCAM_EXTERN //Empty
#endif

//Handy way to sleep forever while recording a video
#define OMXCAM_CAPTURE_FOREVER 0

//Error definitions, expand if necessary
#define OMXCAM_ERRNO_MAP(XX)                                                   \
  XX (0, ERROR_NONE, "success")                                                \
  XX (1, ERROR_CAMERA_MODULE, "camera module is not ready to be used")         \
  XX (2, ERROR_DRIVERS, "cannot load the camera drivers")                      \
  XX (3, ERROR_INIT, "initialization error")                                   \
  XX (4, ERROR_INIT_CAMERA, "cannot initialize the 'camera' component")        \
  XX (5, ERROR_INIT_IMAGE_ENCODER, "cannot initialize the 'image_encode' "     \
      "component")                                                             \
  XX (6, ERROR_INIT_VIDEO_ENCODER, "cannot initialize the 'video_encode' "     \
      "component")                                                             \
  XX (7, ERROR_INIT_NULL_SINK, "cannot initialize the 'null_sink' component")  \
  XX (8, ERROR_DEINIT, "deinitialization error")                               \
  XX (9, ERROR_DEINIT_CAMERA, "cannot deinitialize the 'camera' component")    \
  XX (10, ERROR_DEINIT_IMAGE_ENCODER, "cannot deinitialize the 'image_encode' "\
      "component")                                                             \
  XX (11, ERROR_DEINIT_VIDEO_ENCODER, "cannot deinitialize the 'video_encode' "\
      "component")                                                             \
  XX (12, ERROR_DEINIT_NULL_SINK, "cannot deinitialize the 'null_sink' "       \
      "component")                                                             \
  XX (13, ERROR_CAPTURE, "error while capturing")                              \
  XX (14, ERROR_CAMERA_RUNNING, "camera is already running")                   \
  XX (15, ERROR_CAMERA_STOPPING, "camera is already being stopped")            \
  XX (16, ERROR_BAD_PARAMETER, "incorrect parameter value")                    \
  XX (17, ERROR_STILL, "still error")                                          \
  XX (18, ERROR_VIDEO, "video error")                                          \
  XX (19, ERROR_JPEG, "error configuring jpeg encoder")                        \
  XX (20, ERROR_H264, "error configuring h264 encoder")                        \
  XX (21, ERROR_LOADED, "cannot transition to the Loaded state")               \
  XX (22, ERROR_IDLE, "cannot transition to the Idle state")                   \
  XX (23, ERROR_EXECUTING, "cannot transition to the Executing state")         \
  XX (24, ERROR_FORMAT, "invalid encoding format")                             \
  XX (25, ERROR_SLEEP, "cannot sleep the thread")                              \
  XX (26, ERROR_WAKE, "cannot wake the thread")                                \
  XX (27, ERROR_LOCK, "cannot lock the thread")                                \
  XX (28, ERROR_UNLOCK, "cannot unlock the thread")

typedef enum {
  OMXCAM_FALSE,
  OMXCAM_TRUE
} omxcam_bool;

typedef enum {
  OMXCAM_FORMAT_RGB888,
  OMXCAM_FORMAT_RGBA8888,
  OMXCAM_FORMAT_YUV420,
  OMXCAM_FORMAT_JPEG,
  OMXCAM_FORMAT_H264
} omxcam_format;

typedef enum {
  OMXCAM_EXPOSURE_OFF = OMX_ExposureControlOff,
  OMXCAM_EXPOSURE_AUTO = OMX_ExposureControlAuto,
  OMXCAM_EXPOSURE_NIGHT = OMX_ExposureControlNight,
  OMXCAM_EXPOSURE_BLACK_LIGHT = OMX_ExposureControlBackLight,
  OMXCAM_EXPOSURE_SPOTLIGHT = OMX_ExposureControlSpotLight,
  OMXCAM_EXPOSURE_SPORTS = OMX_ExposureControlSports,
  OMXCAM_EXPOSURE_SNOW = OMX_ExposureControlSnow,
  OMXCAM_EXPOSURE_BEACH = OMX_ExposureControlBeach,
  OMXCAM_EXPOSURE_LARGE_APERTURE = OMX_ExposureControlLargeAperture,
  OMXCAM_EXPOSURE_SMALL_APERTURE = OMX_ExposureControlSmallAperture,
  OMXCAM_EXPOSURE_VERY_LONG = OMX_ExposureControlVeryLong,
  OMXCAM_EXPOSURE_FIXED_FPS = OMX_ExposureControlFixedFps,
  OMXCAM_EXPOSURE_NIGHT_WITH_PREVIEW = OMX_ExposureControlNightWithPreview,
  OMXCAM_EXPOSURE_ANTISHAKE = OMX_ExposureControlAntishake,
  OMXCAM_EXPOSURE_FIREWORKS = OMX_ExposureControlFireworks
} omxcam_exposure;

typedef enum {
  OMXCAM_IMAGE_FILTER_NONE = OMX_ImageFilterNone,
  OMXCAM_IMAGE_FILTER_NOISE = OMX_ImageFilterNoise,
  OMXCAM_IMAGE_FILTER_EMBOSS = OMX_ImageFilterEmboss,
  OMXCAM_IMAGE_FILTER_NEGATIVE = OMX_ImageFilterNegative,
  OMXCAM_IMAGE_FILTER_SKETCH = OMX_ImageFilterSketch,
  OMXCAM_IMAGE_FILTER_OILPAINT = OMX_ImageFilterOilPaint,
  OMXCAM_IMAGE_FILTER_HATCH = OMX_ImageFilterHatch,
  OMXCAM_IMAGE_FILTER_GPEN = OMX_ImageFilterGpen,
  OMXCAM_IMAGE_FILTER_ANTIALIAS = OMX_ImageFilterAntialias,
  OMXCAM_IMAGE_FILTER_DERING = OMX_ImageFilterDeRing,
  OMXCAM_IMAGE_FILTER_SOLARIZE = OMX_ImageFilterSolarize,
  OMXCAM_IMAGE_FILTER_WATERCOLOR = OMX_ImageFilterWatercolor,
  OMXCAM_IMAGE_FILTER_PASTEL = OMX_ImageFilterPastel,
  OMXCAM_IMAGE_FILTER_SHARPEN = OMX_ImageFilterSharpen,
  OMXCAM_IMAGE_FILTER_FILM = OMX_ImageFilterFilm,
  OMXCAM_IMAGE_FILTER_BLUR = OMX_ImageFilterBlur,
  OMXCAM_IMAGE_FILTER_SATURATION = OMX_ImageFilterSaturation,
  OMXCAM_IMAGE_FILTER_DEINTERLACE_LINE_DOUBLE =
      OMX_ImageFilterDeInterlaceLineDouble,
  OMXCAM_IMAGE_FILTER_DEINTERLACE_ADVANCED = OMX_ImageFilterDeInterlaceAdvanced,
  OMXCAM_IMAGE_FILTER_COLOUR_SWAP = OMX_ImageFilterColourSwap,
  OMXCAM_IMAGE_FILTER_WASHED_OUT = OMX_ImageFilterWashedOut,
  OMXCAM_IMAGE_FILTER_COLOUR_POINT = OMX_ImageFilterColourPoint,
  OMXCAM_IMAGE_FILTER_POSTERISE = OMX_ImageFilterPosterise,
  OMXCAM_IMAGE_FILTER_COLOUR_BALANCE = OMX_ImageFilterColourBalance,
  OMXCAM_IMAGE_FILTER_CARTOON = OMX_ImageFilterCartoon
} omxcam_image_filter;

typedef enum {
  OMXCAM_METERING_AVERAGE = OMX_MeteringModeAverage,
  OMXCAM_METERING_SPOT = OMX_MeteringModeSpot,
  OMXCAM_METERING_MATRIX = OMX_MeteringModeMatrix,
  OMXCAM_METERING_BACKLIT = OMX_MeteringModeBacklit
} omxcam_metering;

typedef enum {
  OMXCAM_MIRROR_NONE = OMX_MirrorNone,
  OMXCAM_MIRROR_VERTICAL = OMX_MirrorVertical,
  OMXCAM_MIRROR_HORIZONTAL = OMX_MirrorHorizontal,
  OMXCAM_MIRROR_BOTH = OMX_MirrorBoth
} omxcam_mirror;

typedef enum {
  OMXCAM_ROTATION_NONE = 0,
  OMXCAM_ROTATION_90 = 90,
  OMXCAM_ROTATION_180 = 180,
  OMXCAM_ROTATION_270 = 270
} omxcam_rotation;

typedef enum {
  OMXCAM_WHITE_BALANCE_OFF = OMX_WhiteBalControlOff,
  OMXCAM_WHITE_BALANCE_AUTO = OMX_WhiteBalControlAuto,
  OMXCAM_WHITE_BALANCE_SUNLIGHT = OMX_WhiteBalControlSunLight,
  OMXCAM_WHITE_BALANCE_CLOUDY = OMX_WhiteBalControlCloudy,
  OMXCAM_WHITE_BALANCE_SHADE = OMX_WhiteBalControlShade,
  OMXCAM_WHITE_BALANCE_TUNGSTEN = OMX_WhiteBalControlTungsten,
  OMXCAM_WHITE_BALANCE_FLUORESCENT = OMX_WhiteBalControlFluorescent,
  OMXCAM_WHITE_BALANCE_INCANDESCENT = OMX_WhiteBalControlIncandescent,
  OMXCAM_WHITE_BALANCE_FLASH = OMX_WhiteBalControlFlash,
  OMXCAM_WHITE_BALANCE_HORIZON = OMX_WhiteBalControlHorizon
} omxcam_white_balance;

typedef enum {
#define XX(errno, name, _) OMXCAM_ ## name = errno,
  OMXCAM_ERRNO_MAP (XX)
#undef XX
} omxcam_errno;

typedef struct {
  uint32_t width;
  uint32_t height;
  int32_t sharpness;
  int32_t contrast;
  uint32_t brightness;
  int32_t saturation;
  omxcam_bool shutter_speed_auto;
  uint32_t shutter_speed;
  omxcam_bool iso_auto;
  uint32_t iso;
  omxcam_exposure exposure;
  int32_t exposure_compensation;
  omxcam_mirror mirror;
  omxcam_rotation rotation;
  omxcam_bool color_enhancement;
  uint32_t color_u;
  uint32_t color_v;
  omxcam_bool noise_reduction;
  omxcam_metering metering;
  omxcam_white_balance white_balance;
  //The gains are used if the white balance is set to off
  uint32_t white_balance_red_gain;
  uint32_t white_balance_blue_gain;
{'fraction_non_alphanumeric': 0.05941094678296043, 'fraction_numerical': 0.014157502212109721, 'mean_word_length': 3.323224043715847, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 34, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3049256', 'n_tokens_mistral': 5894, 'n_tokens_neox': 5500, 'n_words': 1000}