2014-12-14 14:26:59 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <utils/VideoMode.h>
|
|
|
|
#include <utils/PixelFormat.h>
|
|
|
|
#include <utils/Image.h>
|
|
|
|
#include <utils/ColorRgb.h>
|
|
|
|
|
|
|
|
class ImageResampler
|
|
|
|
{
|
|
|
|
public:
|
2016-05-26 23:44:27 +02:00
|
|
|
ImageResampler();
|
|
|
|
~ImageResampler();
|
2014-12-14 14:26:59 +01:00
|
|
|
|
2016-05-26 23:44:27 +02:00
|
|
|
void setHorizontalPixelDecimation(int decimator);
|
2014-12-14 14:26:59 +01:00
|
|
|
|
2016-05-26 23:44:27 +02:00
|
|
|
void setVerticalPixelDecimation(int decimator);
|
2014-12-14 14:26:59 +01:00
|
|
|
|
2016-05-26 23:44:27 +02:00
|
|
|
void setCropping(int cropLeft,
|
|
|
|
int cropRight,
|
|
|
|
int cropTop,
|
|
|
|
int cropBottom);
|
2014-12-14 14:26:59 +01:00
|
|
|
|
2016-05-26 23:44:27 +02:00
|
|
|
void set3D(VideoMode mode);
|
2014-12-14 14:26:59 +01:00
|
|
|
|
2016-05-26 23:44:27 +02:00
|
|
|
void processImage(const uint8_t * data, int width, int height, int lineLength, PixelFormat pixelFormat, Image<ColorRgb> & outputImage) const;
|
2014-12-14 14:26:59 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
static inline uint8_t clamp(int x);
|
|
|
|
static void yuv2rgb(uint8_t y, uint8_t u, uint8_t v, uint8_t & r, uint8_t & g, uint8_t & b);
|
|
|
|
|
|
|
|
private:
|
|
|
|
int _horizontalDecimation;
|
|
|
|
int _verticalDecimation;
|
|
|
|
int _cropLeft;
|
|
|
|
int _cropRight;
|
|
|
|
int _cropTop;
|
|
|
|
int _cropBottom;
|
|
|
|
VideoMode _videoMode;
|
|
|
|
};
|