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<const StreamConfiguration>> &outputCfgs,
62 static int getInputConfig(
PixelFormat inputFormat, DebayerInputConfig &config);
63 static int getOutputConfig(
PixelFormat outputFormat, DebayerOutputConfig &config);
65 void pushEnv(std::vector<std::string> &shaderEnv,
const char *str);
68 int generateTextures();
69 int compileShaderProgram(GLuint &shaderId, GLenum shaderType,
70 unsigned char *shaderData,
int shaderDataLen,
71 std::vector<std::string> shaderEnv);
72 int linkShaderProgram(
void);
73 int getShaderVariableLocations();
75 void configureTexture(GLuint &texture);
79 GLuint vertexShaderId_ = 0;
80 GLuint fragmentShaderId_ = 0;
81 GLuint programId_ = 0;
84 std::unique_ptr<eGLImage> eglImageBayerIn_;
85 std::unique_ptr<eGLImage> eglImageBayerOut_;
90 GLint attributeVertex_;
91 GLint attributeTexture_;
92 GLint textureUniformStep_;
93 GLint textureUniformSize_;
94 GLint textureUniformStrideFactor_;
95 GLint textureUniformBayerFirstRed_;
96 GLint textureUniformProjMatrix_;
98 GLint textureUniformBayerDataIn_;
101 GLint ccmUniformDataIn_;
104 GLint blackLevelUniformDataIn_;
107 GLint gammaUniformDataIn_;
110 GLint contrastExpUniformDataIn_;
113 std::unique_ptr<SwStatsCpu> stats_;
118 unsigned int bytesPerPixel_;
119 uint32_t shaderStridePixels_;
Class for debayering using an EGL Shader.
Definition debayer_egl.h:39
void process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms)
Process the bayer data into the requested format.
Definition debayer_egl.cpp:526
std::tuple< unsigned int, unsigned int > strideAndFrameSize(const PixelFormat &outputFormat, const Size &size)
Get the stride and the frame size.
Definition debayer_egl.cpp:363
std::vector< PixelFormat > formats(PixelFormat input)
Get the supported output formats.
Definition debayer_egl.cpp:352
int configure(const StreamConfiguration &inputCfg, const std::vector< std::reference_wrapper< const StreamConfiguration > > &outputCfgs, bool ccmEnabled)
Configure the debayer object according to the passed in parameters.
Definition debayer_egl.cpp:279
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:593
Size patternSize(PixelFormat inputFormat)
Get the width and height at which the bayer pattern repeats.
Definition debayer_egl.cpp:342
int start()
Execute a start signal in the debayer object from workerthread context.
Definition debayer_egl.cpp:570
SizeRange sizes(PixelFormat inputFormat, const Size &inputSize)
Get the supported output sizes for the given input format and size.
Definition debayer_egl.cpp:602
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