android: jpeg: encoder_libjpeg: Allow encoding raw frame bytes

Allow encoding frames which are directly handed over to the encoder
via a span or vector i.e. a raw frame bytes. Introduce an overloaded
EncoderLibJpeg::encode() with libcamera::Span source parameter to
achieve this functionality. This makes the libjpeg-encoder a bit
flexible for use case such as compressing a thumbnail generated for
Exif.

Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Umang Jain 2020-10-28 02:54:45 +05:30 committed by Kieran Bingham
parent c1ae9055f9
commit 25202dbb7e
2 changed files with 17 additions and 8 deletions

View file

@ -24,10 +24,13 @@ public:
int encode(const libcamera::FrameBuffer &source,
libcamera::Span<uint8_t> destination,
libcamera::Span<const uint8_t> exifData) override;
int encode(libcamera::Span<const uint8_t> source,
libcamera::Span<uint8_t> destination,
libcamera::Span<const uint8_t> exifData);
private:
void compressRGB(const libcamera::MappedBuffer *frame);
void compressNV(const libcamera::MappedBuffer *frame);
void compressRGB(libcamera::Span<const uint8_t> frame);
void compressNV(libcamera::Span<const uint8_t> frame);
struct jpeg_compress_struct compress_;
struct jpeg_error_mgr jerr_;