Skip to content

Commit

Permalink
[VP] refine code for DdiMedia_CreateImage and DdiMedia_PutImage
Browse files Browse the repository at this point in the history
refine code for DdiMedia_CreateImage and DdiMedia_PutImage.
  • Loading branch information
VincentCheungKokomo authored and intel-mediadev committed Aug 6, 2024
1 parent a599dc7 commit 3f46155
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions media_driver/linux/common/ddi/media_libva.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4696,13 +4696,7 @@ VAStatus DdiMedia_CreateImage(
vaimg->offsets[1] = offsetU;
if (height % 2 == 1)
{
uint32_t upperSize = pitch * MOS_ALIGN_CEIL(height, 2) / 2;
uint32_t lowerSize = pitch * height / 2;
uint32_t remainSize = size - offsetU;
if (remainSize >= lowerSize && remainSize < upperSize)
{
vaimg->data_size = offsetU + pitch * MOS_ALIGN_CEIL(height, 2) / 2;
}
vaimg->data_size += pitch;
}
break;
case VA_FOURCC_YV12:
Expand Down Expand Up @@ -5621,7 +5615,7 @@ VAStatus DdiMedia_PutImage(
}

//Copy data from image to temp surferce
MOS_STATUS eStatus = MOS_SecureMemcpy(tempSurfData, vaimg->data_size, imageData, vaimg->data_size);
MOS_STATUS eStatus = MOS_SecureMemcpy(tempSurfData, tempMediaSurface->data_size, imageData, vaimg->data_size);
if (eStatus != MOS_STATUS_SUCCESS)
{
DDI_ASSERTMESSAGE("Failed to copy image to surface buffer.");
Expand Down

0 comments on commit 3f46155

Please sign in to comment.