y2r.h
Go to the documentation of this file.
/**
* @file y2r.h
* @brief Y2R service for hardware YUV->RGB conversions
*/
#pragma once
#include <3ds/types.h>
/**
* @brief Input color formats
*
* For the 16-bit per component formats, bits 15-8 are padding and 7-0 contains the value.
*/
typedef enum
{
INPUT_YUV422_INDIV_8 = 0x0, ///< 8-bit per component, planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples).\n Usually named YUV422P.
INPUT_YUV420_INDIV_8 = 0x1, ///< 8-bit per component, planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples).\n Usually named YUV420P.
INPUT_YUV422_INDIV_16 = 0x2, ///< 16-bit per component, planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples).\n Usually named YUV422P16.
INPUT_YUV420_INDIV_16 = 0x3, ///< 16-bit per component, planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples).\n Usually named YUV420P16.
INPUT_YUV422_BATCH = 0x4, ///< 8-bit per component, packed YUV 4:2:2, 16bpp, (Y0 Cb Y1 Cr).\n Usually named YUYV422.
} Y2RU_InputFormat;
/**
* @brief Output color formats
*
* Those are the same as the framebuffer and GPU texture formats.
*/
typedef enum
{
OUTPUT_RGB_32 = 0x0, ///< 32-bit RGBA8888. The alpha component is the 8-bit value set by @ref Y2RU_SetAlpha
OUTPUT_RGB_24 = 0x1, ///< 24-bit RGB888.
OUTPUT_RGB_16_555 = 0x2, ///< 16-bit RGBA5551. The alpha bit is the 7th bit of the alpha value set by @ref Y2RU_SetAlpha
OUTPUT_RGB_16_565 = 0x3, ///< 16-bit RGB565.
} Y2RU_OutputFormat;
/// Rotation to be applied to the output.
typedef enum
{
ROTATION_NONE = 0x0, ///< No rotation.
ROTATION_CLOCKWISE_90 = 0x1, ///< Clockwise 90 degrees.
ROTATION_CLOCKWISE_180 = 0x2, ///< Clockwise 180 degrees.
ROTATION_CLOCKWISE_270 = 0x3, ///< Clockwise 270 degrees.
} Y2RU_Rotation;
/**
* @brief Block alignment of output
*
* Defines the way the output will be laid out in memory.
*/
typedef enum
{
BLOCK_LINE = 0x0, ///< The result buffer will be laid out in linear format, the usual way.
BLOCK_8_BY_8 = 0x1, ///< The result will be stored as 8x8 blocks in Z-order.\n Useful for textures since it is the format used by the PICA200.
} Y2RU_BlockAlignment;
/**
* @brief Coefficients of the YUV->RGB conversion formula.
*
* A set of coefficients configuring the RGB to YUV conversion. Coefficients 0-4 are unsigned 2.8
* fixed pointer numbers representing entries on the conversion matrix, while coefficient 5-7 are
* signed 11.5 fixed point numbers added as offsets to the RGB result.
*
* The overall conversion process formula is:
* @code
* R = trunc((rgb_Y * Y + r_V * V) + 0.75 + r_offset)
* G = trunc((rgb_Y * Y - g_U * U - g_V * V) + 0.75 + g_offset)
* B = trunc((rgb_Y * Y + b_U * U ) + 0.75 + b_offset)
* @endcode
*/
typedef struct
{
u16 rgb_Y; ///< RGB per unit Y.
u16 r_V; ///< Red per unit V.
u16 g_V; ///< Green per unit V.
u16 g_U; ///< Green per unit U.
u16 b_U; ///< Blue per unit U.
u16 r_offset; ///< Red offset.
u16 g_offset; ///< Green offset.
u16 b_offset; ///< Blue offset.
} Y2RU_ColorCoefficients;
/**
* @brief Preset conversion coefficients based on ITU standards for the YUV->RGB formula.
*
* For more details refer to @ref Y2RU_ColorCoefficients
*/
typedef enum
{
COEFFICIENT_ITU_R_BT_601 = 0x0, ///< Coefficients from the ITU-R BT.601 standard with PC ranges.
COEFFICIENT_ITU_R_BT_709 = 0x1, ///< Coefficients from the ITU-R BT.709 standard with PC ranges.
COEFFICIENT_ITU_R_BT_601_SCALING = 0x2, ///< Coefficients from the ITU-R BT.601 standard with TV ranges.
COEFFICIENT_ITU_R_BT_709_SCALING = 0x3, ///< Coefficients from the ITU-R BT.709 standard with TV ranges.
} Y2RU_StandardCoefficient;
/**
* @brief Structure used to configure all parameters at once.
*
* You can send a batch of configuration parameters using this structure and @ref Y2RU_SetConversionParams.
*/
typedef struct
{
Y2RU_InputFormat input_format : 8; ///< Value passed to @ref Y2RU_SetInputFormat
Y2RU_OutputFormat output_format : 8; ///< Value passed to @ref Y2RU_SetOutputFormat
Y2RU_Rotation rotation : 8; ///< Value passed to @ref Y2RU_SetRotation
Y2RU_BlockAlignment block_alignment : 8; ///< Value passed to @ref Y2RU_SetBlockAlignment
s16 input_line_width; ///< Value passed to @ref Y2RU_SetInputLineWidth
s16 input_lines; ///< Value passed to @ref Y2RU_SetInputLines
Y2RU_StandardCoefficient standard_coefficient : 8; ///< Value passed to @ref Y2RU_SetStandardCoefficient
u8 unused; ///< Unused.
u16 alpha; ///< Value passed to @ref Y2RU_SetAlpha
} Y2RU_ConversionParams;
/// Dithering weights.
typedef struct
{
u16 w0_xEven_yEven; ///< Weight 0 for even X, even Y.
u16 w0_xOdd_yEven; ///< Weight 0 for odd X, even Y.
u16 w0_xEven_yOdd; ///< Weight 0 for even X, odd Y.
u16 w0_xOdd_yOdd; ///< Weight 0 for odd X, odd Y.
u16 w1_xEven_yEven; ///< Weight 1 for even X, even Y.
u16 w1_xOdd_yEven; ///< Weight 1 for odd X, even Y.
u16 w1_xEven_yOdd; ///< Weight 1 for even X, odd Y.
u16 w1_xOdd_yOdd; ///< Weight 1 for odd X, odd Y.
u16 w2_xEven_yEven; ///< Weight 2 for even X, even Y.
u16 w2_xOdd_yEven; ///< Weight 2 for odd X, even Y.
u16 w2_xEven_yOdd; ///< Weight 2 for even X, odd Y.
u16 w2_xOdd_yOdd; ///< Weight 2 for odd X, odd Y.
u16 w3_xEven_yEven; ///< Weight 3 for even X, even Y.
u16 w3_xOdd_yEven; ///< Weight 3 for odd X, even Y.
u16 w3_xEven_yOdd; ///< Weight 3 for even X, odd Y.
u16 w3_xOdd_yOdd; ///< Weight 3 for odd X, odd Y.
} Y2RU_DitheringWeightParams;
/**
* @brief Initializes the y2r service.
*
* This will internally get the handle of the service, and on success call Y2RU_DriverInitialize.
*/
Result y2rInit(void);
/**
* @brief Closes the y2r service.
*
* This will internally call Y2RU_DriverFinalize and close the handle of the service.
*/
void y2rExit(void);
/**
* @brief Used to configure the input format.
* @param format Input format to use.
*
* @note Prefer using @ref Y2RU_SetConversionParams if you have to set multiple parameters.
*/
Result Y2RU_SetInputFormat(Y2RU_InputFormat format);
/**
* @brief Gets the configured input format.
* @param format Pointer to output the input format to.
*/
Result Y2RU_GetInputFormat(Y2RU_InputFormat* format);
/**
* @brief Used to configure the output format.
* @param format Output format to use.
*
* @note Prefer using @ref Y2RU_SetConversionParams if you have to set multiple parameters.
*/
Result Y2RU_SetOutputFormat(Y2RU_OutputFormat format);
/**
* @brief Gets the configured output format.
* @param format Pointer to output the output format to.
*/
Result Y2RU_GetOutputFormat(Y2RU_OutputFormat* format);
/**
* @brief Used to configure the rotation of the output.
* @param rotation Rotation to use.
*
* It seems to apply the rotation per batch of 8 lines, so the output will be (height/8) images of size 8 x width.
*
* @note Prefer using @ref Y2RU_SetConversionParams if you have to set multiple parameters.
*/
Result Y2RU_SetRotation(Y2RU_Rotation rotation);
/**
* @brief Gets the configured rotation.
* @param rotation Pointer to output the rotation to.
*/
Result Y2RU_GetRotation(Y2RU_Rotation* rotation);
/**
* @brief Used to configure the alignment of the output buffer.
* @param alignment Alignment to use.
*
* @note Prefer using @ref Y2RU_SetConversionParams if you have to set multiple parameters.
*/
Result Y2RU_SetBlockAlignment(Y2RU_BlockAlignment alignment);
/**
* @brief Gets the configured alignment.
* @param alignment Pointer to output the alignment to.
*/
Result Y2RU_GetBlockAlignment(Y2RU_BlockAlignment* alignment);
/**
* @brief Sets whether to use spacial dithering.
* @param enable Whether to use spacial dithering.
*/
Result Y2RU_SetSpacialDithering(bool enable);
/**
* @brief Gets whether to use spacial dithering.
* @param enable Pointer to output the spacial dithering state to.
*/
Result Y2RU_GetSpacialDithering(bool* enabled);
/**
* @brief Sets whether to use temporal dithering.
* @param enable Whether to use temporal dithering.
*/
Result Y2RU_SetTemporalDithering(bool enable);
/**
* @brief Gets whether to use temporal dithering.
* @param enable Pointer to output the temporal dithering state to.
*/
Result Y2RU_GetTemporalDithering(bool* enabled);
/**
* @brief Used to configure the width of the image.
* @param line_width Width of the image in pixels. Must be a multiple of 8, up to 1024.
*
* @note Prefer using @ref Y2RU_SetConversionParams if you have to set multiple parameters.
*/
Result Y2RU_SetInputLineWidth(u16 line_width);
/**
* @brief Gets the configured input line width.
* @param line_width Pointer to output the line width to.
*/
Result Y2RU_GetInputLineWidth(u16* line_width);
/**
* @brief Used to configure the height of the image.
* @param num_lines Number of lines to be converted.
*
* A multiple of 8 seems to be preferred.
* If using the @ref BLOCK_8_BY_8 mode, it must be a multiple of 8.
*
* @note Prefer using @ref Y2RU_SetConversionParams if you have to set multiple parameters.
*/
Result Y2RU_SetInputLines(u16 num_lines);
/**
* @brief Gets the configured number of input lines.
* @param num_lines Pointer to output the input lines to.
*/
Result Y2RU_GetInputLines(u16* num_lines);
/**
* @brief Used to configure the color conversion formula.
* @param coefficients Coefficients to use.
*
* See @ref Y2RU_ColorCoefficients for more information about the coefficients.
*
* @note Prefer using @ref Y2RU_SetConversionParams if you have to set multiple parameters.
*/
Result Y2RU_SetCoefficients(const Y2RU_ColorCoefficients* coefficients);
/**
* @brief Gets the configured color coefficients.
* @param num_lines Pointer to output the coefficients to.
*/
Result Y2RU_GetCoefficients(Y2RU_ColorCoefficients* coefficients);
/**
* @brief Used to configure the color conversion formula with ITU stantards coefficients.
* @param coefficient Standard coefficient to use.
*
* See @ref Y2RU_ColorCoefficients for more information about the coefficients.
*
* @note Prefer using @ref Y2RU_SetConversionParams if you have to set multiple parameters.
*/
Result Y2RU_SetStandardCoefficient(Y2RU_StandardCoefficient coefficient);
/**
* @brief Gets the color coefficient parameters of a standard coefficient.
* @param coefficients Pointer to output the coefficients to.
* @param standardCoeff Standard coefficient to check.
*/
Result Y2RU_GetStandardCoefficient(Y2RU_ColorCoefficients* coefficients, Y2RU_StandardCoefficient standardCoeff);
/**
* @brief Used to configure the alpha value of the output.
* @param alpha 8-bit value to be used for the output when the format requires it.
*
* @note Prefer using @ref Y2RU_SetConversionParams if you have to set multiple parameters.
*/
Result Y2RU_SetAlpha(u16 alpha);
/**
* @brief Gets the configured output alpha value.
* @param alpha Pointer to output the alpha value to.
*/
Result Y2RU_GetAlpha(u16* alpha);
/**
* @brief Used to enable the end of conversion interrupt.
* @param should_interrupt Enables the interrupt if true, disable it if false.
*
* It is possible to fire an interrupt when the conversion is finished, and that the DMA is done copying the data.
* This interrupt will then be used to fire an event. See @ref Y2RU_GetTransferEndEvent.
* By default the interrupt is enabled.
*
* @note It seems that the event can be fired too soon in some cases, depending the transfer_unit size.\n Please see the note at @ref Y2RU_SetReceiving
*/
Result Y2RU_SetTransferEndInterrupt(bool should_interrupt);
/**
* @brief Gets whether the transfer end interrupt is enabled.
* @param should_interrupt Pointer to output the interrupt state to.
*/
Result Y2RU_GetTransferEndInterrupt(bool* should_interrupt);
/**
* @brief Gets an handle to the end of conversion event.
* @param end_event Pointer to the event handle to be set to the end of conversion event. It isn't necessary to create or close this handle.
*
* To enable this event you have to use @code{C} Y2RU_SetTransferEndInterrupt(true);@endcode
* The event will be triggered when the corresponding interrupt is fired.
*
* @note It is recommended to use a timeout when waiting on this event, as it sometimes (but rarely) isn't triggered.
*/
Result Y2RU_GetTransferEndEvent(Handle* end_event);
/**
* @brief Configures the Y plane buffer.
* @param src_buf A pointer to the beginning of your Y data buffer.
* @param image_size The total size of the data buffer.
* @param transfer_unit Specifies the size of 1 DMA transfer. Usually set to 1 line. This has to be a divisor of image_size.
* @param transfer_gap Specifies the gap (offset) to be added after each transfer. Can be used to convert images with stride or only a part of it.
*
* @warning transfer_unit+transfer_gap must be less than 32768 (0x8000)
*
* This specifies the Y data buffer for the planar input formats (INPUT_YUV42*_INDIV_*).
* The actual transfer will only happen after calling @ref Y2RU_StartConversion.
*/
Result Y2RU_SetSendingY(const void* src_buf, u32 image_size, s16 transfer_unit, s16 transfer_gap);
/**
* @brief Configures the U plane buffer.
* @param src_buf A pointer to the beginning of your Y data buffer.
* @param image_size The total size of the data buffer.
* @param transfer_unit Specifies the size of 1 DMA transfer. Usually set to 1 line. This has to be a divisor of image_size.
* @param transfer_gap Specifies the gap (offset) to be added after each transfer. Can be used to convert images with stride or only a part of it.
*
* @warning transfer_unit+transfer_gap must be less than 32768 (0x8000)
*
* This specifies the U data buffer for the planar input formats (INPUT_YUV42*_INDIV_*).
* The actual transfer will only happen after calling @ref Y2RU_StartConversion.
*/
Result Y2RU_SetSendingU(const void* src_buf, u32 image_size, s16 transfer_unit, s16 transfer_gap);
/**
* @brief Configures the V plane buffer.
* @param src_buf A pointer to the beginning of your Y data buffer.
* @param image_size The total size of the data buffer.
* @param transfer_unit Specifies the size of 1 DMA transfer. Usually set to 1 line. This has to be a divisor of image_size.
* @param transfer_gap Specifies the gap (offset) to be added after each transfer. Can be used to convert images with stride or only a part of it.
*
* @warning transfer_unit+transfer_gap must be less than 32768 (0x8000)
*
* This specifies the V data buffer for the planar input formats (INPUT_YUV42*_INDIV_*).
* The actual transfer will only happen after calling @ref Y2RU_StartConversion.
*/
Result Y2RU_SetSendingV(const void* src_buf, u32 image_size, s16 transfer_unit, s16 transfer_gap);
/**
* @brief Configures the YUYV source buffer.
* @param src_buf A pointer to the beginning of your Y data buffer.
* @param image_size The total size of the data buffer.
* @param transfer_unit Specifies the size of 1 DMA transfer. Usually set to 1 line. This has to be a divisor of image_size.
* @param transfer_gap Specifies the gap (offset) to be added after each transfer. Can be used to convert images with stride or only a part of it.
*
* @warning transfer_unit+transfer_gap must be less than 32768 (0x8000)
*
* This specifies the YUYV data buffer for the packed input format @ref INPUT_YUV422_BATCH.
* The actual transfer will only happen after calling @ref Y2RU_StartConversion.
*/
Result Y2RU_SetSendingYUYV(const void* src_buf, u32 image_size, s16 transfer_unit, s16 transfer_gap);
/**
* @brief Configures the destination buffer.
* @param src_buf A pointer to the beginning of your destination buffer in FCRAM
* @param image_size The total size of the data buffer.
* @param transfer_unit Specifies the size of 1 DMA transfer. Usually set to 1 line. This has to be a divisor of image_size.
* @param transfer_gap Specifies the gap (offset) to be added after each transfer. Can be used to convert images with stride or only a part of it.
*
* This specifies the destination buffer of the conversion.
* The actual transfer will only happen after calling @ref Y2RU_StartConversion.
* The buffer does NOT need to be allocated in the linear heap.
*
* @warning transfer_unit+transfer_gap must be less than 32768 (0x8000)
*
* @note
* It seems that depending on the size of the image and of the transfer unit,\n
* it is possible for the end of conversion interrupt to be triggered right after the conversion began.\n
* One line as transfer_unit seems to trigger this issue for 400x240, setting to 2/4/8 lines fixes it.
*
* @note Setting a transfer_unit of 4 or 8 lines seems to bring the best results in terms of speed for a 400x240 image.
*/
Result Y2RU_SetReceiving(void* dst_buf, u32 image_size, s16 transfer_unit, s16 transfer_gap);
/**
* @brief Checks if the DMA has finished sending the Y buffer.
* @param is_done Pointer to the boolean that will hold the result.
*
* True if the DMA has finished transferring the Y plane, false otherwise. To be used with @ref Y2RU_SetSendingY.
*/
Result Y2RU_IsDoneSendingY(bool* is_done);
/**
* @brief Checks if the DMA has finished sending the U buffer.
* @param is_done Pointer to the boolean that will hold the result.
*
* True if the DMA has finished transferring the U plane, false otherwise. To be used with @ref Y2RU_SetSendingU.
*/
Result Y2RU_IsDoneSendingU(bool* is_done);
/**
* @brief Checks if the DMA has finished sending the V buffer.
* @param is_done Pointer to the boolean that will hold the result.
*
* True if the DMA has finished transferring the V plane, false otherwise. To be used with @ref Y2RU_SetSendingV.
*/
Result Y2RU_IsDoneSendingV(bool* is_done);
/**
* @brief Checks if the DMA has finished sending the YUYV buffer.
* @param is_done Pointer to the boolean that will hold the result.
*
* True if the DMA has finished transferring the YUYV buffer, false otherwise. To be used with @ref Y2RU_SetSendingYUYV.
*/
Result Y2RU_IsDoneSendingYUYV(bool* is_done);
/**
* @brief Checks if the DMA has finished sending the converted result.
* @param is_done Pointer to the boolean that will hold the result.
*
* True if the DMA has finished transferring data to your destination buffer, false otherwise.
*/
Result Y2RU_IsDoneReceiving(bool* is_done);
/**
* @brief Configures the dithering weight parameters.
* @param params Dithering weight parameters to use.
*/
Result Y2RU_SetDitheringWeightParams(const Y2RU_DitheringWeightParams* params);
/**
* @brief Gets the configured dithering weight parameters.
* @param params Pointer to output the dithering weight parameters to.
*/
Result Y2RU_GetDitheringWeightParams(Y2RU_DitheringWeightParams* params);
/**
* @brief Sets all of the parameters of Y2RU_ConversionParams at once.
* @param params Conversion parameters to set.
*
* Faster than calling the individual value through Y2R_Set* because only one system call is made.
*/
Result Y2RU_SetConversionParams(const Y2RU_ConversionParams* params);
/// Starts the conversion process
Result Y2RU_StartConversion(void);
/// Cancels the conversion
Result Y2RU_StopConversion(void);
/**
* @brief Checks if the conversion and DMA transfer are finished.
* @param is_busy Pointer to output the busy state to.
*
* This can have the same problems as the event and interrupt. See @ref Y2RU_SetTransferEndInterrupt.
*/
Result Y2RU_IsBusyConversion(bool* is_busy);
/**
* @brief Checks whether Y2R is ready to be used.
* @param ping Pointer to output the ready status to.
*/
Result Y2RU_PingProcess(u8* ping);
/// Initializes the Y2R driver.
Result Y2RU_DriverInitialize(void);
/// Terminates the Y2R driver.
Result Y2RU_DriverFinalize(void);
Y2RU_ColorCoefficients
Coefficients of the YUV->RGB conversion formula.
Definition: y2r.h:70
Y2RU_ColorCoefficients::r_V
u16 r_V
Red per unit V.
Definition: y2r.h:72
Y2RU_ColorCoefficients::b_offset
u16 b_offset
Blue offset.
Definition: y2r.h:78
Y2RU_ColorCoefficients::b_U
u16 b_U
Blue per unit U.
Definition: y2r.h:75
Y2RU_ColorCoefficients::g_V
u16 g_V
Green per unit V.
Definition: y2r.h:73
Y2RU_ColorCoefficients::rgb_Y
u16 rgb_Y
RGB per unit Y.
Definition: y2r.h:71
Y2RU_ColorCoefficients::g_U
u16 g_U
Green per unit U.
Definition: y2r.h:74
Y2RU_ColorCoefficients::g_offset
u16 g_offset
Green offset.
Definition: y2r.h:77
Y2RU_ColorCoefficients::r_offset
u16 r_offset
Red offset.
Definition: y2r.h:76
Y2RU_ConversionParams
Structure used to configure all parameters at once.
Definition: y2r.h:100
Y2RU_ConversionParams::output_format
Y2RU_OutputFormat output_format
Value passed to Y2RU_SetOutputFormat.
Definition: y2r.h:102
Y2RU_ConversionParams::input_lines
s16 input_lines
Value passed to Y2RU_SetInputLines.
Definition: y2r.h:106
Y2RU_ConversionParams::alpha
u16 alpha
Value passed to Y2RU_SetAlpha.
Definition: y2r.h:109
Y2RU_ConversionParams::rotation
Y2RU_Rotation rotation
Value passed to Y2RU_SetRotation.
Definition: y2r.h:103
Y2RU_ConversionParams::unused
u8 unused
Unused.
Definition: y2r.h:108
Y2RU_ConversionParams::input_line_width
s16 input_line_width
Value passed to Y2RU_SetInputLineWidth.
Definition: y2r.h:105
Y2RU_ConversionParams::input_format
Y2RU_InputFormat input_format
Value passed to Y2RU_SetInputFormat.
Definition: y2r.h:101
Y2RU_ConversionParams::standard_coefficient
Y2RU_StandardCoefficient standard_coefficient
Value passed to Y2RU_SetStandardCoefficient.
Definition: y2r.h:107
Y2RU_ConversionParams::block_alignment
Y2RU_BlockAlignment block_alignment
Value passed to Y2RU_SetBlockAlignment.
Definition: y2r.h:104
Y2RU_DitheringWeightParams
Dithering weights.
Definition: y2r.h:114
Y2RU_DitheringWeightParams::w0_xEven_yOdd
u16 w0_xEven_yOdd
Weight 0 for even X, odd Y.
Definition: y2r.h:117
Y2RU_DitheringWeightParams::w1_xEven_yEven
u16 w1_xEven_yEven
Weight 1 for even X, even Y.
Definition: y2r.h:119
Y2RU_DitheringWeightParams::w1_xEven_yOdd
u16 w1_xEven_yOdd
Weight 1 for even X, odd Y.
Definition: y2r.h:121
Y2RU_DitheringWeightParams::w3_xEven_yEven
u16 w3_xEven_yEven
Weight 3 for even X, even Y.
Definition: y2r.h:127
Y2RU_DitheringWeightParams::w2_xOdd_yEven
u16 w2_xOdd_yEven
Weight 2 for odd X, even Y.
Definition: y2r.h:124
Y2RU_DitheringWeightParams::w2_xOdd_yOdd
u16 w2_xOdd_yOdd
Weight 2 for odd X, odd Y.
Definition: y2r.h:126
Y2RU_DitheringWeightParams::w2_xEven_yEven
u16 w2_xEven_yEven
Weight 2 for even X, even Y.
Definition: y2r.h:123
Y2RU_DitheringWeightParams::w1_xOdd_yOdd
u16 w1_xOdd_yOdd
Weight 1 for odd X, odd Y.
Definition: y2r.h:122
Y2RU_DitheringWeightParams::w2_xEven_yOdd
u16 w2_xEven_yOdd
Weight 2 for even X, odd Y.
Definition: y2r.h:125
Y2RU_DitheringWeightParams::w0_xEven_yEven
u16 w0_xEven_yEven
Weight 0 for even X, even Y.
Definition: y2r.h:115
Y2RU_DitheringWeightParams::w3_xEven_yOdd
u16 w3_xEven_yOdd
Weight 3 for even X, odd Y.
Definition: y2r.h:129
Y2RU_DitheringWeightParams::w1_xOdd_yEven
u16 w1_xOdd_yEven
Weight 1 for odd X, even Y.
Definition: y2r.h:120
Y2RU_DitheringWeightParams::w0_xOdd_yEven
u16 w0_xOdd_yEven
Weight 0 for odd X, even Y.
Definition: y2r.h:116
Y2RU_DitheringWeightParams::w3_xOdd_yEven
u16 w3_xOdd_yEven
Weight 3 for odd X, even Y.
Definition: y2r.h:128
Y2RU_DitheringWeightParams::w0_xOdd_yOdd
u16 w0_xOdd_yOdd
Weight 0 for odd X, odd Y.
Definition: y2r.h:118
Y2RU_DitheringWeightParams::w3_xOdd_yOdd
u16 w3_xOdd_yOdd
Weight 3 for odd X, odd Y.
Definition: y2r.h:130
types.h
Various system types.
u8
uint8_t u8
would be nice if newlib had this already
Definition: types.h:21
s16
int16_t s16
16-bit signed integer
Definition: types.h:27
Handle
u32 Handle
Resource handle.
Definition: types.h:41
Result
s32 Result
Function result.
Definition: types.h:42
u16
uint16_t u16
16-bit unsigned integer
Definition: types.h:22
u32
uint32_t u32
32-bit unsigned integer
Definition: types.h:23
Y2RU_Rotation
Y2RU_Rotation
Rotation to be applied to the output.
Definition: y2r.h:37
ROTATION_CLOCKWISE_270
@ ROTATION_CLOCKWISE_270
Clockwise 270 degrees.
Definition: y2r.h:41
ROTATION_NONE
@ ROTATION_NONE
No rotation.
Definition: y2r.h:38
ROTATION_CLOCKWISE_180
@ ROTATION_CLOCKWISE_180
Clockwise 180 degrees.
Definition: y2r.h:40
ROTATION_CLOCKWISE_90
@ ROTATION_CLOCKWISE_90
Clockwise 90 degrees.
Definition: y2r.h:39
Y2RU_IsDoneReceiving
Result Y2RU_IsDoneReceiving(bool *is_done)
Checks if the DMA has finished sending the converted result.
Y2RU_GetInputFormat
Result Y2RU_GetInputFormat(Y2RU_InputFormat *format)
Gets the configured input format.
Y2RU_SetConversionParams
Result Y2RU_SetConversionParams(const Y2RU_ConversionParams *params)
Sets all of the parameters of Y2RU_ConversionParams at once.
Y2RU_IsDoneSendingU
Result Y2RU_IsDoneSendingU(bool *is_done)
Checks if the DMA has finished sending the U buffer.
y2rExit
void y2rExit(void)
Closes the y2r service.
Y2RU_SetSendingYUYV
Result Y2RU_SetSendingYUYV(const void *src_buf, u32 image_size, s16 transfer_unit, s16 transfer_gap)
Configures the YUYV source buffer.
Y2RU_GetStandardCoefficient
Result Y2RU_GetStandardCoefficient(Y2RU_ColorCoefficients *coefficients, Y2RU_StandardCoefficient standardCoeff)
Gets the color coefficient parameters of a standard coefficient.
Y2RU_SetTemporalDithering
Result Y2RU_SetTemporalDithering(bool enable)
Sets whether to use temporal dithering.
Y2RU_SetSendingY
Result Y2RU_SetSendingY(const void *src_buf, u32 image_size, s16 transfer_unit, s16 transfer_gap)
Configures the Y plane buffer.
Y2RU_GetAlpha
Result Y2RU_GetAlpha(u16 *alpha)
Gets the configured output alpha value.
Y2RU_GetSpacialDithering
Result Y2RU_GetSpacialDithering(bool *enabled)
Gets whether to use spacial dithering.
Y2RU_StandardCoefficient
Y2RU_StandardCoefficient
Preset conversion coefficients based on ITU standards for the YUV->RGB formula.
Definition: y2r.h:87
COEFFICIENT_ITU_R_BT_601_SCALING
@ COEFFICIENT_ITU_R_BT_601_SCALING
Coefficients from the ITU-R BT.601 standard with TV ranges.
Definition: y2r.h:90
COEFFICIENT_ITU_R_BT_709_SCALING
@ COEFFICIENT_ITU_R_BT_709_SCALING
Coefficients from the ITU-R BT.709 standard with TV ranges.
Definition: y2r.h:91
COEFFICIENT_ITU_R_BT_601
@ COEFFICIENT_ITU_R_BT_601
Coefficients from the ITU-R BT.601 standard with PC ranges.
Definition: y2r.h:88
COEFFICIENT_ITU_R_BT_709
@ COEFFICIENT_ITU_R_BT_709
Coefficients from the ITU-R BT.709 standard with PC ranges.
Definition: y2r.h:89
Y2RU_IsDoneSendingYUYV
Result Y2RU_IsDoneSendingYUYV(bool *is_done)
Checks if the DMA has finished sending the YUYV buffer.
y2rInit
Result y2rInit(void)
Initializes the y2r service.
Y2RU_SetOutputFormat
Result Y2RU_SetOutputFormat(Y2RU_OutputFormat format)
Used to configure the output format.
Y2RU_SetSendingV
Result Y2RU_SetSendingV(const void *src_buf, u32 image_size, s16 transfer_unit, s16 transfer_gap)
Configures the V plane buffer.
Y2RU_SetTransferEndInterrupt
Result Y2RU_SetTransferEndInterrupt(bool should_interrupt)
Used to enable the end of conversion interrupt.
Y2RU_GetTransferEndInterrupt
Result Y2RU_GetTransferEndInterrupt(bool *should_interrupt)
Gets whether the transfer end interrupt is enabled.
Y2RU_SetCoefficients
Result Y2RU_SetCoefficients(const Y2RU_ColorCoefficients *coefficients)
Used to configure the color conversion formula.
Y2RU_IsDoneSendingY
Result Y2RU_IsDoneSendingY(bool *is_done)
Checks if the DMA has finished sending the Y buffer.
Y2RU_GetDitheringWeightParams
Result Y2RU_GetDitheringWeightParams(Y2RU_DitheringWeightParams *params)
Gets the configured dithering weight parameters.
Y2RU_GetCoefficients
Result Y2RU_GetCoefficients(Y2RU_ColorCoefficients *coefficients)
Gets the configured color coefficients.
Y2RU_SetStandardCoefficient
Result Y2RU_SetStandardCoefficient(Y2RU_StandardCoefficient coefficient)
Used to configure the color conversion formula with ITU stantards coefficients.
Y2RU_GetInputLineWidth
Result Y2RU_GetInputLineWidth(u16 *line_width)
Gets the configured input line width.
Y2RU_IsBusyConversion
Result Y2RU_IsBusyConversion(bool *is_busy)
Checks if the conversion and DMA transfer are finished.
Y2RU_SetRotation
Result Y2RU_SetRotation(Y2RU_Rotation rotation)
Used to configure the rotation of the output.
Y2RU_SetSendingU
Result Y2RU_SetSendingU(const void *src_buf, u32 image_size, s16 transfer_unit, s16 transfer_gap)
Configures the U plane buffer.
Y2RU_SetSpacialDithering
Result Y2RU_SetSpacialDithering(bool enable)
Sets whether to use spacial dithering.
Y2RU_DriverInitialize
Result Y2RU_DriverInitialize(void)
Initializes the Y2R driver.
Y2RU_StartConversion
Result Y2RU_StartConversion(void)
Starts the conversion process.
Y2RU_StopConversion
Result Y2RU_StopConversion(void)
Cancels the conversion.
Y2RU_SetInputLines
Result Y2RU_SetInputLines(u16 num_lines)
Used to configure the height of the image.
Y2RU_GetBlockAlignment
Result Y2RU_GetBlockAlignment(Y2RU_BlockAlignment *alignment)
Gets the configured alignment.
Y2RU_GetOutputFormat
Result Y2RU_GetOutputFormat(Y2RU_OutputFormat *format)
Gets the configured output format.
Y2RU_IsDoneSendingV
Result Y2RU_IsDoneSendingV(bool *is_done)
Checks if the DMA has finished sending the V buffer.
Y2RU_BlockAlignment
Y2RU_BlockAlignment
Block alignment of output.
Definition: y2r.h:50
BLOCK_8_BY_8
@ BLOCK_8_BY_8
The result will be stored as 8x8 blocks in Z-order. Useful for textures since it is the format used ...
Definition: y2r.h:52
BLOCK_LINE
@ BLOCK_LINE
The result buffer will be laid out in linear format, the usual way.
Definition: y2r.h:51
Y2RU_GetRotation
Result Y2RU_GetRotation(Y2RU_Rotation *rotation)
Gets the configured rotation.
Y2RU_SetDitheringWeightParams
Result Y2RU_SetDitheringWeightParams(const Y2RU_DitheringWeightParams *params)
Configures the dithering weight parameters.
Y2RU_SetBlockAlignment
Result Y2RU_SetBlockAlignment(Y2RU_BlockAlignment alignment)
Used to configure the alignment of the output buffer.
Y2RU_InputFormat
Y2RU_InputFormat
Input color formats.
Definition: y2r.h:14
INPUT_YUV420_INDIV_16
@ INPUT_YUV420_INDIV_16
16-bit per component, planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples)....
Definition: y2r.h:18
INPUT_YUV422_INDIV_16
@ INPUT_YUV422_INDIV_16
16-bit per component, planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples)....
Definition: y2r.h:17
INPUT_YUV422_BATCH
@ INPUT_YUV422_BATCH
8-bit per component, packed YUV 4:2:2, 16bpp, (Y0 Cb Y1 Cr). Usually named YUYV422.
Definition: y2r.h:19
INPUT_YUV422_INDIV_8
@ INPUT_YUV422_INDIV_8
8-bit per component, planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)....
Definition: y2r.h:15
INPUT_YUV420_INDIV_8
@ INPUT_YUV420_INDIV_8
8-bit per component, planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)....
Definition: y2r.h:16
Y2RU_OutputFormat
Y2RU_OutputFormat
Output color formats.
Definition: y2r.h:28
OUTPUT_RGB_32
@ OUTPUT_RGB_32
32-bit RGBA8888. The alpha component is the 8-bit value set by Y2RU_SetAlpha
Definition: y2r.h:29
OUTPUT_RGB_24
@ OUTPUT_RGB_24
24-bit RGB888.
Definition: y2r.h:30
OUTPUT_RGB_16_565
@ OUTPUT_RGB_16_565
16-bit RGB565.
Definition: y2r.h:32
OUTPUT_RGB_16_555
@ OUTPUT_RGB_16_555
16-bit RGBA5551. The alpha bit is the 7th bit of the alpha value set by Y2RU_SetAlpha
Definition: y2r.h:31
Y2RU_SetReceiving
Result Y2RU_SetReceiving(void *dst_buf, u32 image_size, s16 transfer_unit, s16 transfer_gap)
Configures the destination buffer.
Y2RU_SetInputLineWidth
Result Y2RU_SetInputLineWidth(u16 line_width)
Used to configure the width of the image.
Y2RU_GetInputLines
Result Y2RU_GetInputLines(u16 *num_lines)
Gets the configured number of input lines.
Y2RU_DriverFinalize
Result Y2RU_DriverFinalize(void)
Terminates the Y2R driver.
Y2RU_SetInputFormat
Result Y2RU_SetInputFormat(Y2RU_InputFormat format)
Used to configure the input format.
Y2RU_GetTemporalDithering
Result Y2RU_GetTemporalDithering(bool *enabled)
Gets whether to use temporal dithering.
Y2RU_GetTransferEndEvent
Result Y2RU_GetTransferEndEvent(Handle *end_event)
Gets an handle to the end of conversion event.
Y2RU_PingProcess
Result Y2RU_PingProcess(u8 *ping)
Checks whether Y2R is ready to be used.
Y2RU_SetAlpha
Result Y2RU_SetAlpha(u16 alpha)
Used to configure the alpha value of the output.