summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Expand)Author
2020-03-06test: Add Span testLaurent Pinchart
2020-02-24tests: Remove IPA_MODULE_PATH environment variableKieran Bingham
2020-02-24libcamera: utils: Add a C++ dirname implementationKieran Bingham
2020-02-18test: camera: buffer_import: Don't include <random>Laurent Pinchart
2020-02-14test: thread: Test waiting on a thread that is not runningLaurent Pinchart
2020-02-14test: threads: Add wait() timeout testLaurent Pinchart
2020-02-13test: Add a utils::split() testLaurent Pinchart
2020-01-22test: signal: Add additional disconnection tests for ObjectLaurent Pinchart
2020-01-20libcamera: bound_method: Avoid deadlock with ConnectionTypeBlockingLaurent Pinchart
2020-01-20test: buffer_import: Propagate status code from buffer allocationLaurent Pinchart
2020-01-14libcamera: Switch from utils::make_unique to std::make_uniqueLaurent Pinchart
2020-01-13rkisp1: add pipeline test for rkisp1Show Liu
2020-01-12libcamera: camera: Remove the prepared stateNiklas Söderlund
2020-01-12libcamera: v4l2_videodevice: Remove Buffer interfaceNiklas Söderlund
2020-01-12libcamera: Switch to FrameBuffer interfaceNiklas Söderlund
2020-01-12test: camera: buffer_import: Update to FrameBuffer restrictionsNiklas Söderlund
2020-01-12test: v4l2_videodevice: Switch to FrameBuffer interfaceNiklas Söderlund
2020-01-12libcamera: buffer: Move captured metadata to FrameMetadataNiklas Söderlund
2020-01-12libcamera: request: In addBuffer() do not fetch stream from BufferNiklas Söderlund
2020-01-12libcamera: buffer: Switch from Plane to FrameBuffer::PlaneNiklas Söderlund
2020-01-12ipa: Switch to FrameBuffer interfaceNiklas Söderlund
2020-01-12test: file_descriptor: Add testNiklas Söderlund
2020-01-07test: signal: Test connecting to non-void slotsLaurent Pinchart
2020-01-07test: object-invoke: Test invoking a non-void methodLaurent Pinchart
2020-01-07test: object-invoke: Test direct invocationLaurent Pinchart
2020-01-03test: object-invoke: Test invocation of method taking a reference argumentLaurent Pinchart
2019-12-16libcamera: Remove buffer index from loggingNiklas Söderlund
2019-11-27test: object-invoke: Delete InvokeObject after thread terminationLaurent Pinchart
2019-11-27test: message: Add slow receiver testLaurent Pinchart
2019-11-27test: message: Fix message handling in MessageReceiverLaurent Pinchart
2019-11-25test: controls: control_list: Add status checkJacopo Mondi
2019-11-20test: ipa: Add IPA wrappers testLaurent Pinchart
2019-11-20test: Add control serialization testJacopo Mondi
2019-11-20test: Add ByteStreamBuffer testLaurent Pinchart
2019-11-20test: controls: Add ControlInfoMap testLaurent Pinchart
2019-11-20test: Extract CameraTest class out of camera tests to libtestLaurent Pinchart
2019-11-19libcamera: camera: Remove explicit stream to buffer map in requestCompleted s...Niklas Söderlund
2019-11-18libcamera: Remove space between empty curly bracketsLaurent Pinchart
2019-11-08libcamera: Remove unneeded semicolonsLaurent Pinchart
2019-10-29test: object-invoke: Invoke method in blocking modeJacopo Mondi
2019-10-29libcamera: object: Add connection type parameter to invokeMethod()Jacopo Mondi
2019-10-28libcamera: Switch PixelFormat to DRM FourCC valuesJacopo Mondi
2019-10-23libcamera: Standardise on C compatibility headersLaurent Pinchart
2019-10-15libcamera: v4l2_controls: Remove V4L2ControlList classLaurent Pinchart
2019-10-15libcamera: controls: Merge ControlInfoMap and V4L2ControlInfoMapLaurent Pinchart
2019-10-15libcamera: v4l2_controls: Store a ControlRange in V4L2ControlInfoMapLaurent Pinchart
2019-10-15libcamera: v4l2_controls: Replace V4L2ControlInfo with V4L2ControlRangeLaurent Pinchart
2019-10-15test: v4l2_videodevice: controls: Use correct control range in checkLaurent Pinchart
2019-10-15libcamera: utils: Add hex stream output helperLaurent Pinchart
2019-10-13libcamera: v4l2_device: Replace V4L2ControlList with ControlListLaurent Pinchart
atConverter::configure(const libcamera::PixelFormat &format, const QSize &size, unsigned int stride) { switch (format) { case libcamera::formats::NV12: formatFamily_ = YUVSemiPlanar; horzSubSample_ = 2; vertSubSample_ = 2; nvSwap_ = false; break; case libcamera::formats::NV21: formatFamily_ = YUVSemiPlanar; horzSubSample_ = 2; vertSubSample_ = 2; nvSwap_ = true; break; case libcamera::formats::NV16: formatFamily_ = YUVSemiPlanar; horzSubSample_ = 2; vertSubSample_ = 1; nvSwap_ = false; break; case libcamera::formats::NV61: formatFamily_ = YUVSemiPlanar; horzSubSample_ = 2; vertSubSample_ = 1; nvSwap_ = true; break; case libcamera::formats::NV24: formatFamily_ = YUVSemiPlanar; horzSubSample_ = 1; vertSubSample_ = 1; nvSwap_ = false; break; case libcamera::formats::NV42: formatFamily_ = YUVSemiPlanar; horzSubSample_ = 1; vertSubSample_ = 1; nvSwap_ = true; break; case libcamera::formats::R8: formatFamily_ = RGB; r_pos_ = 0; g_pos_ = 0; b_pos_ = 0; bpp_ = 1; break; case libcamera::formats::RGB888: formatFamily_ = RGB; r_pos_ = 2; g_pos_ = 1; b_pos_ = 0; bpp_ = 3; break; case libcamera::formats::BGR888: formatFamily_ = RGB; r_pos_ = 0; g_pos_ = 1; b_pos_ = 2; bpp_ = 3; break; case libcamera::formats::ARGB8888: case libcamera::formats::XRGB8888: formatFamily_ = RGB; r_pos_ = 2; g_pos_ = 1; b_pos_ = 0; bpp_ = 4; break; case libcamera::formats::RGBA8888: case libcamera::formats::RGBX8888: formatFamily_ = RGB; r_pos_ = 3; g_pos_ = 2; b_pos_ = 1; bpp_ = 4; break; case libcamera::formats::ABGR8888: case libcamera::formats::XBGR8888: formatFamily_ = RGB; r_pos_ = 0; g_pos_ = 1; b_pos_ = 2; bpp_ = 4; break; case libcamera::formats::BGRA8888: case libcamera::formats::BGRX8888: formatFamily_ = RGB; r_pos_ = 1; g_pos_ = 2; b_pos_ = 3; bpp_ = 4; break; case libcamera::formats::VYUY: formatFamily_ = YUVPacked; y_pos_ = 1; cb_pos_ = 2; break; case libcamera::formats::YVYU: formatFamily_ = YUVPacked; y_pos_ = 0; cb_pos_ = 3; break; case libcamera::formats::UYVY: formatFamily_ = YUVPacked; y_pos_ = 1; cb_pos_ = 0; break; case libcamera::formats::YUYV: formatFamily_ = YUVPacked; y_pos_ = 0; cb_pos_ = 1; break; case libcamera::formats::YUV420: formatFamily_ = YUVPlanar; horzSubSample_ = 2; vertSubSample_ = 2; nvSwap_ = false; break; case libcamera::formats::YVU420: formatFamily_ = YUVPlanar; horzSubSample_ = 2; vertSubSample_ = 2; nvSwap_ = true; break; case libcamera::formats::YUV422: formatFamily_ = YUVPlanar; horzSubSample_ = 2; vertSubSample_ = 1; nvSwap_ = false; break; case libcamera::formats::MJPEG: formatFamily_ = MJPEG; break; default: return -EINVAL; }; format_ = format; width_ = size.width(); height_ = size.height(); stride_ = stride; return 0; } void FormatConverter::convert(const Image *src, size_t size, QImage *dst) { switch (formatFamily_) { case MJPEG: dst->loadFromData(src->data(0).data(), size, "JPEG"); break; case RGB: convertRGB(src, dst->bits()); break; case YUVPacked: convertYUVPacked(src, dst->bits()); break; case YUVSemiPlanar: convertYUVSemiPlanar(src, dst->bits()); break; case YUVPlanar: convertYUVPlanar(src, dst->bits()); break; }; } static void yuv_to_rgb(int y, int u, int v, int *r, int *g, int *b) { int c = y - 16; int d = u - 128; int e = v - 128; *r = CLIP(( 298 * c + 409 * e + 128) >> RGBSHIFT); *g = CLIP(( 298 * c - 100 * d - 208 * e + 128) >> RGBSHIFT); *b = CLIP(( 298 * c + 516 * d + 128) >> RGBSHIFT); } void FormatConverter::convertRGB(const Image *srcImage, unsigned char *dst) { const unsigned char *src = srcImage->data(0).data(); unsigned int x, y; int r, g, b; for (y = 0; y < height_; y++) { for (x = 0; x < width_; x++) { r = src[bpp_ * x + r_pos_]; g = src[bpp_ * x + g_pos_]; b = src[bpp_ * x + b_pos_]; dst[4 * x + 0] = b; dst[4 * x + 1] = g; dst[4 * x + 2] = r; dst[4 * x + 3] = 0xff; } src += stride_; dst += width_ * 4; } } void FormatConverter::convertYUVPacked(const Image *srcImage, unsigned char *dst) { const unsigned char *src = srcImage->data(0).data(); unsigned int src_x, src_y, dst_x, dst_y; unsigned int src_stride; unsigned int dst_stride; unsigned int cr_pos; int r, g, b, y, cr, cb; cr_pos = (cb_pos_ + 2) % 4; src_stride = stride_; dst_stride = width_ * 4; for (src_y = 0, dst_y = 0; dst_y < height_; src_y++, dst_y++) { for (src_x = 0, dst_x = 0; dst_x < width_; ) { cb = src[src_y * src_stride + src_x * 4 + cb_pos_]; cr = src[src_y * src_stride + src_x * 4 + cr_pos]; y = src[src_y * src_stride + src_x * 4 + y_pos_]; yuv_to_rgb(y, cb, cr, &r, &g, &b); dst[dst_y * dst_stride + 4 * dst_x + 0] = b; dst[dst_y * dst_stride + 4 * dst_x + 1] = g; dst[dst_y * dst_stride + 4 * dst_x + 2] = r; dst[dst_y * dst_stride + 4 * dst_x + 3] = 0xff; dst_x++; y = src[src_y * src_stride + src_x * 4 + y_pos_ + 2]; yuv_to_rgb(y, cb, cr, &r, &g, &b); dst[dst_y * dst_stride + 4 * dst_x + 0] = b; dst[dst_y * dst_stride + 4 * dst_x + 1] = g; dst[dst_y * dst_stride + 4 * dst_x + 2] = r; dst[dst_y * dst_stride + 4 * dst_x + 3] = 0xff; dst_x++; src_x++; } } } void FormatConverter::convertYUVPlanar(const Image *srcImage, unsigned char *dst) { unsigned int c_stride = stride_ / horzSubSample_; unsigned int c_inc = horzSubSample_ == 1 ? 1 : 0; const unsigned char *src_y = srcImage->data(0).data(); const unsigned char *src_cb = srcImage->data(1).data(); const unsigned char *src_cr = srcImage->data(2).data(); int r, g, b; if (nvSwap_) std::swap(src_cb, src_cr); for (unsigned int y = 0; y < height_; y++) { const unsigned char *line_y = src_y + y * stride_; const unsigned char *line_cb = src_cb + (y / vertSubSample_) * c_stride; const unsigned char *line_cr = src_cr + (y / vertSubSample_) * c_stride; for (unsigned int x = 0; x < width_; x += 2) { yuv_to_rgb(*line_y, *line_cb, *line_cr, &r, &g, &b); dst[0] = b; dst[1] = g; dst[2] = r; dst[3] = 0xff; line_y++; line_cb += c_inc; line_cr += c_inc; dst += 4; yuv_to_rgb(*line_y, *line_cb, *line_cr, &r, &g, &b); dst[0] = b; dst[1] = g; dst[2] = r; dst[3] = 0xff; line_y++; line_cb += 1; line_cr += 1; dst += 4; } } } void FormatConverter::convertYUVSemiPlanar(const Image *srcImage, unsigned char *dst) { unsigned int c_stride = stride_ * (2 / horzSubSample_); unsigned int c_inc = horzSubSample_ == 1 ? 2 : 0;