| 1 |
/*############################################################################ |
| 2 |
# Copyright (C) 2020 Intel Corporation |
| 3 |
# |
| 4 |
# SPDX-License-Identifier: MIT |
| 5 |
############################################################################*/ |
| 6 |
|
| 7 |
#include <stdlib.h> |
| 8 |
#include <stdio.h> |
| 9 |
|
| 10 |
#include "mfxdefs.h" |
| 11 |
#include "mfxvideo.h" |
| 12 |
|
| 13 |
#define UNUSED_PARAM(x) (void)(x) |
| 14 |
|
| 15 |
mfxSession session; |
| 16 |
mfxBitstream *bitstream; |
| 17 |
mfxSurfaceArray *surf_array_out; |
| 18 |
mfxVideoParam* decode_par; |
| 19 |
mfxVideoChannelParam** vpp_par_array; |
| 20 |
mfxU32 num_channel_par; |
| 21 |
mfxStatus sts; |
| 22 |
|
| 23 |
static void do_smth(mfxFrameSurface1* surf) { |
| 24 |
UNUSED_PARAM(surf); |
| 25 |
} |
| 26 |
|
| 27 |
static void prg_decoding_vpp1 () { |
| 28 |
/*beg1*/ |
| 29 |
num_channel_par = 2; |
| 30 |
// first video processing channel with resize |
| 31 |
vpp_par_array[0]->VPP.Width = 400; |
| 32 |
vpp_par_array[0]->VPP.Height = 400; |
| 33 |
|
| 34 |
// second video channel with color conversion filter |
| 35 |
vpp_par_array[1]->VPP.FourCC = MFX_FOURCC_UYVY; |
| 36 |
|
| 37 |
sts = MFXVideoDECODE_VPP_Init(session, decode_par, vpp_par_array, num_channel_par); |
| 38 |
|
| 39 |
sts = MFXVideoDECODE_VPP_DecodeFrameAsync(session, bitstream, NULL, 0, &surf_array_out); |
| 40 |
|
| 41 |
//surf_array_out layout is |
| 42 |
do_smth(surf_array_out->Surfaces[0]); //The first channel contains decoded frames. |
| 43 |
do_smth(surf_array_out->Surfaces[1]); //The second channel contains resized frames after decode. |
| 44 |
do_smth(surf_array_out->Surfaces[2]); //The third channel contains color converted frames after decode. |
| 45 |
/*end1*/ |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
static void prg_decoding_vpp2 () { |
| 50 |
/*beg2*/ |
| 51 |
|
| 52 |
//1st call |
| 53 |
sts = MFXVideoDECODE_VPP_DecodeFrameAsync(session, bitstream, NULL, 0, &surf_array_out); |
| 54 |
//surf_array_out layout is |
| 55 |
do_smth(surf_array_out->Surfaces[0]); //decoded frame |
| 56 |
do_smth(surf_array_out->Surfaces[1]); //resized frame (ChannelId = 1). The first frame from channel with resize available |
| 57 |
// no output from channel with ADI output since it has one frame delay |
| 58 |
|
| 59 |
//2nd call |
| 60 |
sts = MFXVideoDECODE_VPP_DecodeFrameAsync(session, bitstream, NULL, 0, &surf_array_out); |
| 61 |
//surf_array_out layout is |
| 62 |
do_smth(surf_array_out->Surfaces[0]); //decoded frame |
| 63 |
do_smth(surf_array_out->Surfaces[1]); //resized frame (ChannelId = 1) |
| 64 |
do_smth(surf_array_out->Surfaces[2]); //ADI output (ChannelId = 2). The first frame from ADI channel |
| 65 |
/*end2*/ |
| 66 |
} |