Commit 5accab743ee73971e19a530e16a283f3f7b15fbb
1 parent
881ac79d
修改crop某些情况会失败的问题
Showing
1 changed file
with
5 additions
and
3 deletions
src/util/vpc_util.cpp
@@ -139,8 +139,10 @@ vpc_img_info VPCUtil::crop(DeviceMemory *devMem, video_object_info obj) { | @@ -139,8 +139,10 @@ vpc_img_info VPCUtil::crop(DeviceMemory *devMem, video_object_info obj) { | ||
139 | acldvppSetPicDescHeightStride(vpcInputDesc_, devMem->getHeightStride()); | 139 | acldvppSetPicDescHeightStride(vpcInputDesc_, devMem->getHeightStride()); |
140 | acldvppSetPicDescSize(vpcInputDesc_, devMem->getSize()); | 140 | acldvppSetPicDescSize(vpcInputDesc_, devMem->getSize()); |
141 | 141 | ||
142 | + uint32_t width_stride = ALIGN_UP64(cropSizeWidth); | ||
143 | + uint32_t height_stride = ALIGN_UP16(cropSizeHeight); | ||
142 | /* processdecode */ | 144 | /* processdecode */ |
143 | - uint32_t vpcOutBufferSize_ = cropSizeWidth * cropSizeHeight * 3 / 2; | 145 | + uint32_t vpcOutBufferSize_ = width_stride * height_stride * 3 / 2; |
144 | void *vpcOutBufferDev_ = nullptr; | 146 | void *vpcOutBufferDev_ = nullptr; |
145 | acldvppMalloc(&vpcOutBufferDev_, vpcOutBufferSize_); | 147 | acldvppMalloc(&vpcOutBufferDev_, vpcOutBufferSize_); |
146 | acldvppPicDesc *vpcOutputDesc_ = acldvppCreatePicDesc(); | 148 | acldvppPicDesc *vpcOutputDesc_ = acldvppCreatePicDesc(); |
@@ -148,8 +150,8 @@ vpc_img_info VPCUtil::crop(DeviceMemory *devMem, video_object_info obj) { | @@ -148,8 +150,8 @@ vpc_img_info VPCUtil::crop(DeviceMemory *devMem, video_object_info obj) { | ||
148 | acldvppSetPicDescFormat(vpcOutputDesc_, PIXEL_FORMAT_YUV_SEMIPLANAR_420); | 150 | acldvppSetPicDescFormat(vpcOutputDesc_, PIXEL_FORMAT_YUV_SEMIPLANAR_420); |
149 | acldvppSetPicDescWidth(vpcOutputDesc_, cropSizeWidth); | 151 | acldvppSetPicDescWidth(vpcOutputDesc_, cropSizeWidth); |
150 | acldvppSetPicDescHeight(vpcOutputDesc_, cropSizeHeight); | 152 | acldvppSetPicDescHeight(vpcOutputDesc_, cropSizeHeight); |
151 | - acldvppSetPicDescWidthStride(vpcOutputDesc_, cropSizeWidth); | ||
152 | - acldvppSetPicDescHeightStride(vpcOutputDesc_, cropSizeHeight); | 153 | + acldvppSetPicDescWidthStride(vpcOutputDesc_, width_stride); |
154 | + acldvppSetPicDescHeightStride(vpcOutputDesc_, height_stride); | ||
153 | acldvppSetPicDescSize(vpcOutputDesc_, vpcOutBufferSize_); | 155 | acldvppSetPicDescSize(vpcOutputDesc_, vpcOutBufferSize_); |
154 | 156 | ||
155 | bool bRet = false; | 157 | bool bRet = false; |