| 1 | /* |
| 2 | * Copyright (c) 2017, Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice shall be included |
| 12 | * in all copies or substantial portions of the Software. |
| 13 | * |
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 | * OTHER DEALINGS IN THE SOFTWARE. |
| 21 | */ |
| 22 | //! |
| 23 | //! \file vphal_render_composite_g9.cpp |
| 24 | //! \brief Composite related VPHAL functions |
| 25 | //! \details Unified VP HAL Composite module including render initialization, |
| 26 | //! resource allocation/free and rendering |
| 27 | //! |
| 28 | #include "vphal_render_composite_g9.h" |
| 29 | |
| 30 | void CompositeStateG9::SubmitStatesFillGenSpecificStaticData( |
| 31 | PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData, |
| 32 | PVPHAL_SURFACE pTarget, |
| 33 | MEDIA_OBJECT_KA2_STATIC_DATA *pStatic) |
| 34 | { |
| 35 | PVPHAL_SURFACE pSurface; |
| 36 | |
| 37 | //Set shift offset for interlace scaling |
| 38 | //Vertical Frame Origin for Layer 0 - Layer 7 |
| 39 | //Format = Single precision floating point |
| 40 | pSurface = pRenderingData->pLayers[0]; // only using primary layer [0] |
| 41 | |
| 42 | if (nullptr != pSurface && pSurface->bInterlacedScaling) |
| 43 | { |
| 44 | if (pSurface->SampleType == SAMPLE_INTERLEAVED_EVEN_FIRST_TOP_FIELD || pSurface->SampleType == SAMPLE_INTERLEAVED_ODD_FIRST_TOP_FIELD) |
| 45 | { |
| 46 | //use the cropping size, not the surface size |
| 47 | pStatic->DW12.TopBottomDelta = (float)(1.0 / (pSurface->rcDst.bottom - pSurface->rcDst.top) - 1.0 / (pSurface->rcSrc.bottom - pSurface->rcSrc.top)); |
| 48 | } |
| 49 | else |
| 50 | { |
| 51 | pStatic->DW12.TopBottomDelta = (float)(-(1.0 / (pSurface->rcDst.bottom - pSurface->rcDst.top) - 1.0 / (pSurface->rcSrc.bottom - pSurface->rcSrc.top))); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | // Set ChromaSitting |
| 56 | pStatic->DW10.ObjKa2Gen9.ChromaSitingLocation = GetOutputChromaSitting(pTarget); |
| 57 | |
| 58 | if (pRenderingData->iLayers > 0) |
| 59 | { |
| 60 | pStatic->DW09.ObjKa2Gen9.IEFByPassEnable = pRenderingData->pLayers[0]->bIEF ? false : true; |
| 61 | } |
| 62 | |
| 63 | // Set alpha calculation flag. The bit definitions are different for GEN8 and GEN9+. |
| 64 | // Set Bit-18 |
| 65 | pStatic->DW09.ObjKa2Gen9.AlphaChannelCalculation = pRenderingData->bAlphaCalculateEnable ? true : false; |
| 66 | } |