C

Qt Quick Ultralite imagedecoder Example

// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#pragma once

#include <stdint.h>
#include "r_jcua_api.h"
#include <platforminterface/imagedecoder.h>

#include <v800_ghs.h>

#define JCUA_HW_UNIT (0)

#ifndef DECODE_BUFFER_PIXEL_LINES
//must be multiple of 16
#define DECODE_BUFFER_PIXEL_LINES (16)
#endif

//must be multiple of 8 bytes
#define INPUT_SPLIT_BUFFER_SIZE 2048

#ifndef CHROMA_SUBSAMPLING
#define CHROMA_SUBSAMPLING R_JCUA_JPEG_FORMAT_YCBCR420
#endif

#ifdef RH850_JPEG_DEBUG_LOGS
#define DEBUG_PRINTF(...) qul_printf(__VA_ARGS__)
#else
#define DEBUG_PRINTF(...)
#endif

#define CALLBACK_FACTOR_DECODE_INPUT_PAUSED_EVENT_ID (0)
#define CALLBACK_FACTOR_DECODE_OUTPUT_PAUSED_EVENT_ID (1)
#define CALLBACK_FACTOR_DECODE_COMPLETE_EVENT_ID (2)
#define CALLBACK_FACTOR_DECODE_SIZEOVER_EVENT_ID (3)
#define CALLBACK_FACTOR_DECODE_ERRORED_EVENT_ID (4)
#define CALLBACK_FACTOR_FATAL_ERROR_EVENT_ID (5)
#define CALLBACK_FACTOR_HEADER_TIMEOUT_EVENT_ID (6)
#define CALLBACK_FACTOR_DECODE_TIMEOUT_EVENT_ID (7)

#define SET_EVENT_BIT(x, y) __SET1(&x, y)
#define CLEAR_EVENT_BIT(x, y) __CLR1(&x, y)
#define EVENT(x, y) __TST1(&x, y)

r_jcua_Error_t jpegDecode_Init();
r_jcua_Error_t jpegDecode_Start(Qul::PlatformInterface::ImageDecoder::RequestDataCallback &callback,
                                void *outputBufferAddr,
                                uint32_t outputBufferSize,
                                void *processBuffer,
                                uint32_t outputBufferStride,
                                r_jcua_ImageInfo_t jpegInfo);
const uint16_t decodeBuffPixelLines();