add capsdcShrinkJpeg

This commit is contained in:
Michael Scire 2023-10-17 16:13:39 -07:00 committed by fincs
parent e322bdf82d
commit 6f9bc920c9
2 changed files with 23 additions and 0 deletions

View File

@ -30,3 +30,8 @@ Service* capsdcGetServiceSession(void);
* @param[in] out_image_size Output image buffer size, should be at least large enough for RGBA8 width x height.
*/
Result capsdcDecodeJpeg(u32 width, u32 height, const CapsScreenShotDecodeOption *opts, const void* jpeg, size_t jpeg_size, void* out_image, size_t out_image_size);
/**
* @brief Shrinks a jpeg's dimensions by 2.
*/
Result capsdcShrinkJpeg(u32 width, u32 height, const CapsScreenShotDecodeOption *opts, const void* jpeg, size_t jpeg_size, void* out_jpeg, size_t out_jpeg_size, u64 *out_result_size);

View File

@ -39,3 +39,21 @@ Result capsdcDecodeJpeg(u32 width, u32 height, const CapsScreenShotDecodeOption
}
);
}
Result capsdcShrinkJpeg(u32 width, u32 height, const CapsScreenShotDecodeOption *opts, const void* jpeg, size_t jpeg_size, void* out_jpeg, size_t out_jpeg_size, u64 *out_result_size) {
const struct {
u32 width;
u32 height;
CapsScreenShotDecodeOption opts;
} in = { width, height, *opts };
return serviceDispatchInOut(&g_capsdcSrv, 4001, in, *out_result_size,
.buffer_attrs = {
SfBufferAttr_In | SfBufferAttr_HipcMapAlias,
SfBufferAttr_Out | SfBufferAttr_HipcMapAlias | SfBufferAttr_HipcMapTransferAllowsNonSecure,
},
.buffers = {
{ jpeg, jpeg_size },
{ out_jpeg, out_jpeg_size },
}
);
}