![]() ![]() Create the UpdateOutputDesc function to initialize the image decoding output description.ĪPP_ERROR DvppResizeProcess::UpdateOutputDesc() If (input->widthStride > MAX_RESIZE_WIDTH || input->widthStride heightStride > MAX_RESIZE_HEIGHT || input->heightStride data.get()) ĪcldvppSetPicDescFormat(resizeInputDesc_.get(), input->format) ĪcldvppSetPicDescWidth(resizeInputDesc_.get(), input->width) ĪcldvppSetPicDescHeight(resizeInputDesc_.get(), input->height) ĪcldvppSetPicDescWidthStride(resizeInputDesc_.get(), inputWidthStride) ĪcldvppSetPicDescHeightStride(resizeInputDesc_.get(), inputHeightStride) ĪcldvppSetPicDescSize(resizeInputDesc_.get(), input->lenOfByte) Check whether the width of the image after zooming is correct. LogError heightStride, VPC_STRIDE_HEIGHT) If (jpegInput->width > MAX_JPEGD_WIDTH || jpegInput->height > MAX_JPEGD_HEIGHT) else if (input->format >= PIXEL_FORMAT_ARGB_8888 & input->format widthStride, VPC_STRIDE_WIDTH) * XRGB_WIDTH_NU LogError jpegInput, const uint32_t outputSize, Ret = TransferImageH2D(imageInfo, width, height, jpegInput) Create the ProcessFile function to read image data from the image file.ĪPP_ERROR DvppJpegdProcess::ProcessFile(const std::string& imageFile,Ĭonst acldvppPixelFormat format, const bool withSynchronize)ĪPP_ERROR ret = ReadFile(imageFile, imageInfo) ImageInfo.lenOfByte, ACL_MEMCPY_HOST_TO_DEVICE, stream) Ret = aclrtMemcpyAsync(inputDeviceBuff.get(), inBufferSize, (), Copy image data from the host to the device. InputDeviceBuff.reset(inDevBuff, acldvppFree) Create the TransferImageH2D function for copying image data from the host to the device.ĪPP_ERROR DvppJpegdProcess::TransferImageH2D(const FileInfo& imageInfo, const uint32_t imageWidth,Ĭonst uint32_t imageHeight, const std::shared_ptr& jpegInput) 1.2 Construct the image description of the decoded output data.ĪcldvppPicDesc* decodeOutputDesc = acldvppCreatePicDesc() ĪcldvppSetPicDescWidth(decodeOutputDesc_.get(), inputWidth) ĪcldvppSetPicDescHeight(decodeOutputDesc_.get(), inputHeight) ĪcldvppSetPicDescWidthStride(decodeOutputDesc_.get(), output->widthStride) ĪcldvppSetPicDescHeightStride(decodeOutputDesc_.get(), output->heightStride) ĪcldvppSetPicDescSize(decodeOutputDesc_.get(), outputSize) LogError data.reset(decodeOutDevBuffer, acldvppFree) Apply for the device memory to store the decoded data.ĪPP_ERROR ret = acldvppMalloc(&decodeOutDevBuffer, output->lenOfByte) Output->widthStride = ALIGN_UP(inputWidth, JPEGD_STRIDE_WIDTH) Output->heightStride = ALIGN_UP(inputHeight, JPEGD_STRIDE_HEIGHT) Align the width and height of the input image by 16 x 2 upwards. Std::shared_ptr output = std::make_shared() Construct the image decoding output data information based on the input data information of image decoding. Obtain the input data required by the image decoding model from the declaration alias DvppDataInfoT defined in the DVPP. Create the SetOutputDesc function for decoding output images.ĪPP_ERROR DvppJpegdProcess::SetOutputDesc(const uint32_t outputSize) ![]() The following is a code example of the DvppJpegdProcess.cpp common library file: Ret = dvppResize_->ProcessDevData(decodeOutData, modelInfo_.modelWidth, modelInfo_.modelHeight, ![]() For details, see the ProcessDevData function in Code of the DvppResizeProcess.cpp library file. Call the ProcessDevData function to resize the decoded image. LogError decodeOutData = dvppJpegD_->GetOutput() For details, see the ProcessFile function in Code of the DvppJpegdProcess.cpp common library file.ĪPP_ERROR ret = dvppJpegD_->ProcessFile(imageFile, PIXEL_FORMAT_YUV_SEMIPLANAR_420, false) Call the ProcessFile function to decode the input image in JPEG format. Create the image decoding and resizing function Preprocess.ĪPP_ERROR AclProcess::Preprocess(std::string imageFile) The following is a code example for AclProcess.cpp to decode and resize images: #include "acl/acl.h" on a single texture, continuously as necessary.įor ( FileHandle f : outputFolder.Image Decoding and Resizing Function Preprocess We re-run with higher source texture res so they should fit BitmapFontWriter generated multiple bitmaps can't use them. Public static void crack(String srcAtlas, String dstDir) throws Exception, outputFolder.child(fileName + ".fnt"), fontInfo, resX, resY) īitmapFontWriter.writePixmaps((), outputFolder, fileName) įileHandle path = outputFolder.child(fileName + ".png") ![]()
0 Comments
Leave a Reply. |