u16 alpha; ///< Value passed to @ref Y2RU_SetAlpha
} Y2R_ConversionParams;
+/**
+ * @brief Dithering weights
+ *
+ */
+typedef struct
+{
+ u16 w0_xEven_yEven;
+ u16 w0_xOdd_yEven;
+ u16 w0_xEven_yOdd;
+ u16 w0_xOdd_yOdd;
+ u16 w1_xEven_yEven;
+ u16 w1_xOdd_yEven;
+ u16 w1_xEven_yOdd;
+ u16 w1_xOdd_yOdd;
+ u16 w2_xEven_yEven;
+ u16 w2_xOdd_yEven;
+ u16 w2_xEven_yOdd;
+ u16 w2_xOdd_yOdd;
+ u16 w3_xEven_yEven;
+ u16 w3_xOdd_yEven;
+ u16 w3_xEven_yOdd;
+ u16 w3_xOdd_yOdd;
+} Y2R_DitheringWeightParams;
+
+
/**
* @brief Initializes the y2r service.
*/
Result Y2RU_SetInputFormat(Y2R_InputFormat format);
+Result Y2RU_GetInputFormat(Y2R_InputFormat* format);
/**
* @brief Used to configure the output format.
*/
Result Y2RU_SetOutputFormat(Y2R_OutputFormat format);
+Result Y2RU_GetOutputFormat(Y2R_OutputFormat* format);
+
/**
* @brief Used to configure the rotation of the output.
*
*/
Result Y2RU_SetRotation(Y2R_Rotation rotation);
+Result Y2RU_GetRotation(Y2R_Rotation* rotation);
+
/**
* @brief Used to configure the alignment of the output buffer.
*
*/
Result Y2RU_SetBlockAlignment(Y2R_BlockAlignment alignment);
+Result Y2RU_GetBlockAlignment(Y2R_BlockAlignment* alignment);
+
+///Sets the usage of spacial dithering
+Result Y2RU_SetSpacialDithering(bool enable);
+
+Result Y2RU_GetSpacialDithering(bool* enabled);
+
+///Sets the usage of temporal dithering
+Result Y2RU_SetTemporalDithering(bool enable);
+
+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.
*/
Result Y2RU_SetInputLineWidth(u16 line_width);
+Result Y2RU_GetInputLineWidth(u16* line_width);
+
/**
* @brief Used to configure the height of the image.
* @param num_lines Number of lines to be converted.
*/
Result Y2RU_SetInputLines(u16 num_lines);
+Result Y2RU_GetInputLines(u16* num_lines);
+
/**
* @brief Used to configure the color conversion formula.
*
*/
Result Y2RU_SetCoefficients(const Y2R_ColorCoefficients* coefficients);
+Result Y2RU_GetCoefficients(Y2R_ColorCoefficients* coefficients);
+
/**
* @brief Used to configure the color conversion formula with ITU stantards coefficients.
*
*/
Result Y2RU_SetStandardCoefficient(Y2R_StandardCoefficient coefficient);
+///Retrieves the coeeficients associated to the given standard
+Result Y2RU_GetStandardCoefficient(Y2R_ColorCoefficients* coefficients, Y2R_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.
*/
Result Y2RU_SetAlpha(u16 alpha);
+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.
*/
Result Y2RU_SetTransferEndInterrupt(bool should_interrupt);
+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.
*/
Result Y2RU_IsDoneReceiving(bool* is_done);
-/**
- * @brief Sets currently unknown parameters.
- * @param params Unknown parameters.
- */
-Result Y2RU_SetUnknownParams(const u16 params[16]);
+/// Sets the dithering weights
+Result Y2RU_SetDitheringWeightParams(const Y2R_DitheringWeightParams* params);
+
+/// Retrieves the dithering weights
+Result Y2RU_GetDitheringWeightParams(Y2R_DitheringWeightParams* params);
/**
* @brief Sets all the parameters of Y2R_ConversionParams at once.
return cmdbuf[1];
}
+Result Y2RU_GetInputFormat(Y2R_InputFormat* format)
+{
+ Result ret = 0;
+ u32* cmdbuf = getThreadCommandBuffer();
+ cmdbuf[0] = IPC_MakeHeader(0x2,0,0); // 0x20000
+
+ if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
+ *format = cmdbuf[2] & 0xFF;
+ return cmdbuf[1];
+}
+
Result Y2RU_SetOutputFormat(Y2R_OutputFormat format)
{
Result ret = 0;
return cmdbuf[1];
}
+Result Y2RU_GetOutputFormat(Y2R_OutputFormat* format)
+{
+ Result ret = 0;
+ u32* cmdbuf = getThreadCommandBuffer();
+ cmdbuf[0] = IPC_MakeHeader(0x4,0,0); // 0x40000
+
+ if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
+ *format = cmdbuf[2] & 0xFF;
+ return cmdbuf[1];
+}
+
Result Y2RU_SetRotation(Y2R_Rotation rotation)
{
Result ret = 0;
return cmdbuf[1];
}
+Result Y2RU_GetRotation(Y2R_Rotation* rotation)
+{
+ Result ret = 0;
+ u32* cmdbuf = getThreadCommandBuffer();
+ cmdbuf[0] = IPC_MakeHeader(0x6,0,0); // 0x60000
+
+ if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
+ *rotation = cmdbuf[2] & 0xFF;
+ return cmdbuf[1];
+}
+
Result Y2RU_SetBlockAlignment(Y2R_BlockAlignment alignment)
{
Result ret = 0;
return cmdbuf[1];
}
+Result Y2RU_GetBlockAlignment(Y2R_BlockAlignment* alignment)
+{
+ Result ret = 0;
+ u32* cmdbuf = getThreadCommandBuffer();
+ cmdbuf[0] = IPC_MakeHeader(0x8,0,0); // 0x80000
+
+ if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
+ *alignment = cmdbuf[2] & 0xFF;
+ return cmdbuf[1];
+}
+
+Result Y2RU_SetSpacialDithering(bool enable)
+{
+ Result ret = 0;
+ u32* cmdbuf = getThreadCommandBuffer();
+ cmdbuf[0] = IPC_MakeHeader(0x9,1,0); // 0x90040
+ cmdbuf[1] = enable;
+
+ if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
+ return cmdbuf[1];
+}
+
+Result Y2RU_GetSpacialDithering(bool* enabled)
+{
+ Result ret = 0;
+ u32* cmdbuf = getThreadCommandBuffer();
+ cmdbuf[0] = IPC_MakeHeader(0xA,0,0); // 0xA0000
+
+ if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
+ *enabled = cmdbuf[2] & 0xFF;
+ return cmdbuf[1];
+}
+
+Result Y2RU_SetTemporalDithering(bool enable)
+{
+ Result ret = 0;
+ u32* cmdbuf = getThreadCommandBuffer();
+ cmdbuf[0] = IPC_MakeHeader(0xB,1,0); // 0xB0040
+ cmdbuf[1] = enable;
+
+ if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
+ return cmdbuf[1];
+}
+
+Result Y2RU_GetTemporalDithering(bool* enabled)
+{
+ Result ret = 0;
+ u32* cmdbuf = getThreadCommandBuffer();
+ cmdbuf[0] = IPC_MakeHeader(0xC,0,0); // 0xC0000
+
+ if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
+ *enabled = cmdbuf[2] & 0xFF;
+ return cmdbuf[1];
+}
+
Result Y2RU_SetTransferEndInterrupt(bool should_interrupt)
{
Result ret = 0;
return cmdbuf[1];
}
+Result Y2RU_GetTransferEndInterrupt(bool* should_interrupt)
+{
+ Result ret = 0;
+ u32* cmdbuf = getThreadCommandBuffer();
+ cmdbuf[0] = IPC_MakeHeader(0xE,0,0); // 0xE0000
+
+ if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
+ *should_interrupt = cmdbuf[2] & 0xFF;
+ return cmdbuf[1];
+}
+
Result Y2RU_GetTransferEndEvent(Handle* end_event)
{
if (*end_event != 0)
return cmdbuf[1];
}
+Result Y2RU_GetInputLineWidth(u16* line_width)
+{
+ Result ret = 0;
+ u32* cmdbuf = getThreadCommandBuffer();
+ cmdbuf[0] = IPC_MakeHeader(0x1B,0,0); // 0x1B0000
+
+ if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
+ *line_width = cmdbuf[2] & 0xFFFF;
+ return cmdbuf[1];
+}
+
Result Y2RU_SetInputLines(u16 num_lines)
{
Result ret = 0;
return cmdbuf[1];
}
+Result Y2RU_GetInputLines(u16* num_lines)
+{
+ Result ret = 0;
+ u32* cmdbuf = getThreadCommandBuffer();
+ cmdbuf[0] = IPC_MakeHeader(0x1D,0,0); // 0x1D0000
+
+ if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
+ *num_lines = cmdbuf[2] & 0xFFFF;
+ return cmdbuf[1];
+}
+
Result Y2RU_SetCoefficients(const Y2R_ColorCoefficients* coefficients)
{
Result ret = 0;
return cmdbuf[1];
}
+Result Y2RU_GetCoefficients(Y2R_ColorCoefficients* coefficients)
+{
+ Result ret = 0;
+ u32* cmdbuf = getThreadCommandBuffer();
+ cmdbuf[0] = IPC_MakeHeader(0x1F,0,0); // 0x1F0000
+
+ if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
+ memcpy(coefficients,cmdbuf + 2, sizeof(Y2R_ColorCoefficients));
+ return cmdbuf[1];
+}
+
Result Y2RU_SetStandardCoefficient(Y2R_StandardCoefficient coefficient)
{
Result ret = 0;
return cmdbuf[1];
}
+Result Y2RU_GetStandardCoefficient(Y2R_ColorCoefficients* coefficients, Y2R_StandardCoefficient standardCoeff)
+{
+ Result ret = 0;
+ u32* cmdbuf = getThreadCommandBuffer();
+ cmdbuf[0] = IPC_MakeHeader(0x21,1,0); // 0x210040
+ cmdbuf[1] = standardCoeff;
+
+ if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
+ memcpy(coefficients,cmdbuf + 2, sizeof(Y2R_ColorCoefficients));
+ return cmdbuf[1];
+}
+
Result Y2RU_SetAlpha(u16 alpha)
{
Result ret = 0;
return cmdbuf[1];
}
-Result Y2RU_SetUnknownParams(const u16 params[16])
+Result Y2RU_GetAlpha(u16* alpha)
+{
+ Result ret = 0;
+ u32* cmdbuf = getThreadCommandBuffer();
+ cmdbuf[0] = IPC_MakeHeader(0x23,0,0); // 0x230000
+
+ if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
+ *alpha = cmdbuf[2] & 0xFFFF;
+ return cmdbuf[1];
+}
+
+
+Result Y2RU_SetDitheringWeightParams(const Y2R_DitheringWeightParams* params)
{
Result ret = 0;
u32* cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x24,8,0); // 0x240200
- memcpy(&cmdbuf[1], params, sizeof(u16) * 16);
+ memcpy(&cmdbuf[1], params, sizeof(Y2R_DitheringWeightParams));
+
+ if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
+ return cmdbuf[1];
+}
+
+Result Y2RU_GetDitheringWeightParams(Y2R_DitheringWeightParams* params)
+{
+ Result ret = 0;
+ u32* cmdbuf = getThreadCommandBuffer();
+ cmdbuf[0] = IPC_MakeHeader(0x25,0,0); // 0x250000
if ((ret = svcSendSyncRequest(y2rHandle)) != 0) return ret;
+ memcpy(params,cmdbuf+2, sizeof(Y2R_DitheringWeightParams));
return cmdbuf[1];
}