1 /*
2 * Copyright (c) 2020-2021, 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     decode_jpeg_downsampling_packet.cpp
24 //! \brief    Defines the interface for jpeg decode down sampling sub packet
25 //!
26 #include "decode_jpeg_downsampling_packet.h"
27 #include "decode_jpeg_basic_feature.h"
28 
29 #ifdef _DECODE_PROCESSING_SUPPORTED
30 namespace decode
31 {
JpegDownSamplingPkt(DecodePipeline * pipeline,CodechalHwInterfaceNext * hwInterface)32 JpegDownSamplingPkt::JpegDownSamplingPkt(DecodePipeline *pipeline, CodechalHwInterfaceNext *hwInterface)
33     : DecodeDownSamplingPkt(pipeline, hwInterface)
34 {
35     m_jpegPipeline = dynamic_cast<JpegPipeline *>(pipeline);
36 }
37 
Init()38 MOS_STATUS JpegDownSamplingPkt::Init()
39 {
40     DECODE_CHK_STATUS(DecodeDownSamplingPkt::Init());
41     DECODE_CHK_NULL(m_jpegPipeline);
42 
43     return MOS_STATUS_SUCCESS;
44 }
45 
SetSfcMode(MEDIA_SFC_INTERFACE_MODE & mode)46 MOS_STATUS JpegDownSamplingPkt::SetSfcMode(MEDIA_SFC_INTERFACE_MODE &mode)
47 {
48     mode.veboxSfcEnabled = 0;
49     mode.vdboxSfcEnabled = 1;
50     return MOS_STATUS_SUCCESS;
51 }
52 
InitSfcParams(VDBOX_SFC_PARAMS & sfcParams)53 MOS_STATUS JpegDownSamplingPkt::InitSfcParams(VDBOX_SFC_PARAMS &sfcParams)
54 {
55     JpegBasicFeature *jpegBasicFeature = dynamic_cast<JpegBasicFeature *>(m_basicFeature);
56     DECODE_CHK_NULL(jpegBasicFeature);
57     DECODE_CHK_STATUS(DecodeDownSamplingPkt::InitSfcParams(sfcParams));
58     //Align Jpeg sfc output surface size
59     sfcParams.output.surface->dwWidth  = jpegBasicFeature->m_destSurface.dwWidth;
60     sfcParams.output.surface->dwHeight = jpegBasicFeature->m_destSurface.dwHeight;
61     sfcParams.videoParams.jpeg.jpegChromaType = (CodecDecodeJpegChromaType)jpegBasicFeature->m_jpegPicParams->m_chromaType;
62     return MOS_STATUS_SUCCESS;
63 }
64 
65 }
66 #endif