16#define GL_GLEXT_PROTOTYPES
17#define EGL_EGLEXT_PROTOTYPES
21#include "libcamera/internal/egl.h"
24#include "libcamera/internal/software_isp/benchmark.h"
25#include "libcamera/internal/software_isp/swstats_cpu.h"
28#include <EGL/eglext.h>
29#include <GLES3/gl32.h>
35#define DEBAYER_EGL_MIN_SIMPLE_RGB_GAIN_TEXTURE_UNITS 4
36#define DEBAYER_OPENGL_COORDS 4
45 const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs,
63 static int getInputConfig(
PixelFormat inputFormat, DebayerInputConfig &config);
64 static int getOutputConfig(
PixelFormat outputFormat, DebayerOutputConfig &config);
66 void pushEnv(std::vector<std::string> &shaderEnv,
const char *str);
69 int generateTextures();
70 int compileShaderProgram(GLuint &shaderId, GLenum shaderType,
71 unsigned char *shaderData,
int shaderDataLen,
72 std::vector<std::string> shaderEnv);
73 int linkShaderProgram(
void);
74 int getShaderVariableLocations();
76 void configureTexture(GLuint &texture);
80 GLuint vertexShaderId_ = 0;
81 GLuint fragmentShaderId_ = 0;
82 GLuint programId_ = 0;
85 std::unique_ptr<eGLImage> eglImageBayerIn_;
86 std::unique_ptr<eGLImage> eglImageBayerOut_;
91 GLint attributeVertex_;
92 GLint attributeTexture_;
93 GLint textureUniformStep_;
94 GLint textureUniformSize_;
95 GLint textureUniformStrideFactor_;
96 GLint textureUniformBayerFirstRed_;
97 GLint textureUniformProjMatrix_;
99 GLint textureUniformBayerDataIn_;
102 GLint ccmUniformDataIn_;
105 GLint blackLevelUniformDataIn_;
108 GLint gammaUniformDataIn_;
111 GLint contrastExpUniformDataIn_;
114 std::unique_ptr<SwStatsCpu> stats_;
119 unsigned int bytesPerPixel_;
120 uint32_t shaderStridePixels_;
Class for debayering using an EGL Shader.
Definition debayer_egl.h:39
std::tuple< unsigned int, unsigned int > strideAndFrameSize(const PixelFormat &outputFormat, const Size &size)
Get the stride and the frame size.
Definition debayer_egl.cpp:373
void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, DebayerParams params)
Process the bayer data into the requested format.
Definition debayer_egl.cpp:536
unsigned int frameSize()
Get the output frame size.
Definition debayer_egl.cpp:284
std::vector< PixelFormat > formats(PixelFormat input)
Get the supported output formats.
Definition debayer_egl.cpp:362
const SharedFD & getStatsFD()
Get the file descriptor for the statistics.
Definition debayer_egl.h:57
void stop()
Stop the debayering process and perform cleanup.
Definition debayer_egl.cpp:603
Size patternSize(PixelFormat inputFormat)
Get the width and height at which the bayer pattern repeats.
Definition debayer_egl.cpp:352
int start()
Execute a start signal in the debayer object from workerthread context.
Definition debayer_egl.cpp:580
SizeRange sizes(PixelFormat inputFormat, const Size &inputSize)
Get the supported output sizes for the given input format and size.
Definition debayer_egl.cpp:612
int configure(const StreamConfiguration &inputCfg, const std::vector< std::reference_wrapper< StreamConfiguration > > &outputCfgs, bool ccmEnabled)
Configure the debayer object according to the passed in parameters.
Definition debayer_egl.cpp:289
Base debayering class.
Definition debayer.h:36
Frame buffer data and its associated dynamic metadata.
Definition framebuffer.h:50
Support for global libcamera configuration.
Definition global_configuration.h:22
Map a FrameBuffer using the MappedBuffer interface.
Definition mapped_framebuffer.h:47
Describe a rectangle's position and dimensions.
Definition geometry.h:247
RAII-style wrapper for file descriptors.
Definition shared_fd.h:17
Describe a range of sizes.
Definition geometry.h:205
Describe a two-dimensional size.
Definition geometry.h:51
Helper class for managing OpenGL ES operations.
Definition egl.h:98
Internal frame buffer handling support.
Frame buffer memory mapping support.
Top-level libcamera namespace.
Definition backtrace.h:17
Base object to support automatic signal disconnection.
Struct to hold the debayer parameters.
Definition debayer_params.h:20
Configuration parameters for a stream.
Definition stream.h:40