Skip to content

Commit

Permalink
[VP] Fix failed 4k video wall test case and color corruption of video…
Browse files Browse the repository at this point in the history
… composition

Fix failed 4k video wall test case from 16CH video only show 1CH output and corruption observed on certain number of video composition when doing sample_multi_transcode.
  • Loading branch information
VincentCheungKokomo authored and intel-mediadev committed Jan 10, 2024
1 parent f6a1b25 commit 38e14b1
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 43 deletions.
1 change: 1 addition & 0 deletions media_common/agnostic/common/vp/kdll/hal_kerneldll_next.h
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ typedef struct tagKdll_FilterEntry
Kdll_Scalingratio ScalingRatio;
Kdll_RenderMethod RenderMethod;
Kdll_SetCSCCoeffMethod SetCSCCoeffMode;
bool forceToTargetColorSpace;
} Kdll_FilterEntry, *PKdll_FilterEntry;

// Structure that defines a compositing filter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,13 @@ MOS_STATUS VpRenderFcKernel::BuildFilter(

for (i = 0; (i < (int)compParams->sourceCount) && (iMaxFilterSize > 0); i++)
{
if (i > 0)
{
if (!RECT1_CONTAINS_RECT2(compParams->source[0].surf->rcDst, compParams->source[i].surf->rcDst))
{
pFilter->forceToTargetColorSpace = true;
}
}
src = &compParams->source[i];

//--------------------------------
Expand Down
70 changes: 41 additions & 29 deletions media_softlet/agnostic/common/vp/kdll/hal_kerneldll_next.c
Original file line number Diff line number Diff line change
Expand Up @@ -2378,6 +2378,7 @@ bool KernelDll_SetupCSC(
Kdll_CSC_Matrix curr_matrix;
Kdll_CSC_Matrix *matrix = pCSC->Matrix; // Color Space conversion matrix
uint8_t * matrixID = pCSC->MatrixID; // CSC coefficient allocation table
bool forceToTargetColorSpace = false;

// Clear all CSC matrices
MOS_ZeroMemory(matrix, sizeof(pCSC->Matrix));
Expand All @@ -2395,6 +2396,10 @@ bool KernelDll_SetupCSC(
//---------------------------------------------------------------//
for (i = iFilterSize, pFilter = pSearchState->Filter; i > 0; i--, pFilter++)
{
if (pFilter->forceToTargetColorSpace)
{
forceToTargetColorSpace = true;
}
// Disable Procamp for all layers except Main Video
// Disable Procamp if source is RGB
if (pFilter->layer != Layer_MainVideo ||
Expand Down Expand Up @@ -2456,44 +2461,51 @@ bool KernelDll_SetupCSC(
//---------------------------------------------------------------//
if (sel_cspace == CSpace_Any)
{
int cs;
for (cs = (CSpace_Any + 1); cs < CSpace_Count; cs++)
if (forceToTargetColorSpace)
{
// Skip color spaces not in use
cspace = (VPHAL_CSPACE)cs;
if (!cspace_in_use[cspace])
{
continue;
}

// xvYCC and BT are treated as same for CSC considerations (BT.x to xvYCC.x matrix is I)
cspace = KernelDll_TranslateCspace(cspace);

// Count # of CS conversions and matrices
csc_count = 0;
for (i = iFilterSize, pFilter = pSearchState->Filter; i > 0; i--, pFilter++)
sel_cspace = out_cspace;
}
else
{
int cs;
for (cs = (CSpace_Any + 1); cs < CSpace_Count; cs++)
{
// Ignore layers where the Color Space may be set in software (colorfill, palletized)
if (pFilter->cspace == CSpace_Any)
// Skip color spaces not in use
cspace = (VPHAL_CSPACE)cs;
if (!cspace_in_use[cspace])
{
continue;
}

// Check if CSC/PA is required
if (KernelDll_TranslateCspace(pFilter->cspace) != cspace ||
pFilter->procamp != DL_PROCAMP_DISABLED)
// xvYCC and BT are treated as same for CSC considerations (BT.x to xvYCC.x matrix is I)
cspace = KernelDll_TranslateCspace(cspace);

// Count # of CS conversions and matrices
csc_count = 0;
for (i = iFilterSize, pFilter = pSearchState->Filter; i > 0; i--, pFilter++)
{
csc_count++;
// Ignore layers where the Color Space may be set in software (colorfill, palletized)
if (pFilter->cspace == CSpace_Any)
{
continue;
}

// Check if CSC/PA is required
if (KernelDll_TranslateCspace(pFilter->cspace) != cspace ||
pFilter->procamp != DL_PROCAMP_DISABLED)
{
csc_count++;
}
}
}

// Save best choice as requiring minimum number of CSC operations
if ((sel_csc_count < 0) || // Initial value
(csc_count < sel_csc_count) || // Minimum number of CSC operations
(csc_count == sel_csc_count && cs == main_cspace)) // Use main cspace as default if same CSC count
{
sel_cspace = cspace;
sel_csc_count = csc_count;
// Save best choice as requiring minimum number of CSC operations
if ((sel_csc_count < 0) || // Initial value
(csc_count < sel_csc_count) || // Minimum number of CSC operations
(csc_count == sel_csc_count && cs == main_cspace)) // Use main cspace as default if same CSC count
{
sel_cspace = cspace;
sel_csc_count = csc_count;
}
}
}
}
Expand Down
20 changes: 6 additions & 14 deletions media_softlet/linux/common/vp/ddi/ddi_vp_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2115,9 +2115,8 @@ VAStatus DdiVpFunctions::SetBackgroundColorfill(
{
DDI_VP_FUNC_ENTER;
DDI_VP_CHK_NULL(vpHalRenderParams, "nullptr vpHalRenderParams.", VA_STATUS_ERROR_INVALID_PARAMETER);
DDI_VP_CHK_NULL(vpHalRenderParams->pTarget[0],"nullptr pTarget[0].", VA_STATUS_ERROR_INVALID_PARAMETER);

if ((outBackGroundcolor >> 24) != 0 || vpHalRenderParams->pTarget[0]->ColorSpace == CSpace_sRGB)
if ((outBackGroundcolor >> 24) != 0)
{
if (vpHalRenderParams->pColorFillParams == nullptr)
{
Expand All @@ -2126,18 +2125,11 @@ VAStatus DdiVpFunctions::SetBackgroundColorfill(

DDI_VP_CHK_NULL(vpHalRenderParams->pColorFillParams, "nullptr pColorFillParams.", VA_STATUS_ERROR_UNKNOWN);

if (vpHalRenderParams->pTarget[0]->ColorSpace == CSpace_sRGB && (outBackGroundcolor >> 24) == 0)
{
// set color space for sRGB output
vpHalRenderParams->pColorFillParams->CSpace = CSpace_sRGB;
}
else
{
// set background colorfill option
vpHalRenderParams->pColorFillParams->Color = outBackGroundcolor;
vpHalRenderParams->pColorFillParams->bYCbCr = false;
vpHalRenderParams->pColorFillParams->CSpace = CSpace_sRGB;
}
// set background colorfill option
vpHalRenderParams->pColorFillParams->Color = outBackGroundcolor;
vpHalRenderParams->pColorFillParams->bYCbCr = false;
vpHalRenderParams->pColorFillParams->CSpace = CSpace_sRGB;

}
else
{
Expand Down

0 comments on commit 38e14b1

Please sign in to comment.