1 /*
2 * Copyright (c) 2022, 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 //!
24 //! \file     decode_sfc_histogram_postsubpipeline_m12.cpp
25 //! \brief    Defines the postSubpipeline for decode SFC histogram
26 //! \details  Defines the postSubpipline for decode SFC histogram
27 //!
28 
29 #include "decode_sfc_histogram_postsubpipeline_m12.h"
30 #include "decode_pipeline.h"
31 #include "decode_common_feature_defs.h"
32 #include "decode_huc_packet_creator_g12.h"
33 
34 #ifdef _DECODE_PROCESSING_SUPPORTED
35 
36 namespace decode {
37 
DecodeSfcHistogramSubPipelineM12(DecodePipeline * pipeline,MediaTask * task,uint8_t numVdbox,CodechalHwInterface * hwInterface)38 DecodeSfcHistogramSubPipelineM12::DecodeSfcHistogramSubPipelineM12(DecodePipeline *pipeline,
39     MediaTask *task,
40     uint8_t numVdbox,
41     CodechalHwInterface *hwInterface):
42     DecodeSfcHistogramSubPipeline(pipeline, task, numVdbox)
43 {
44     m_hwInterface = hwInterface;
45 }
46 
Init(CodechalSetting & settings)47 MOS_STATUS DecodeSfcHistogramSubPipelineM12::Init(CodechalSetting &settings)
48 {
49     DECODE_FUNC_CALL();
50     DECODE_CHK_NULL(m_pipeline);
51 
52     CodechalHwInterface *hwInterface = m_hwInterface;
53     DECODE_CHK_NULL(hwInterface);
54     m_osInterface = hwInterface->GetOsInterface();
55     DECODE_CHK_NULL(m_osInterface);
56     InitScalabilityPars(m_osInterface);
57 
58     m_allocator = m_pipeline->GetDecodeAllocator();
59     DECODE_CHK_NULL(m_allocator);
60 
61     auto featureManger = m_pipeline->GetFeatureManager();
62     DECODE_CHK_NULL(featureManger);
63     m_basicFeature = dynamic_cast<DecodeBasicFeature*>(featureManger->GetFeature(FeatureIDs::basicFeature));
64     DECODE_CHK_NULL(m_basicFeature);
65 
66     m_downsampFeature = dynamic_cast<DecodeDownSamplingFeature*>(featureManger->GetFeature(
67         DecodeFeatureIDs::decodeDownSampling));
68 
69     //Create Packets
70     HucPacketCreatorG12 *hucPktCreator = dynamic_cast<HucPacketCreatorG12 *>(m_pipeline);
71     DECODE_CHK_NULL(hucPktCreator);
72     m_copyPkt = hucPktCreator->CreateHucCopyPkt(m_pipeline, m_task, hwInterface);
73     DECODE_CHK_NULL(m_copyPkt);
74     MediaPacket *packet = dynamic_cast<MediaPacket *>(m_copyPkt);
75     DECODE_CHK_NULL(packet);
76     DECODE_CHK_STATUS(RegisterPacket(DecodePacketId(m_pipeline, hucCopyPacketId), *packet));
77     DECODE_CHK_STATUS(packet->Init());
78 
79     return MOS_STATUS_SUCCESS;
80 }
81 
82 }
83 
84 #endif
85