1 /* 2 This file is provided under a dual BSD/GPLv2 license. When using or 3 redistributing this file, you may do so under either license. 4 5 GPL LICENSE SUMMARY 6 7 Copyright(c) 2007-2009 Intel Corporation. All rights reserved. 8 9 This program is free software; you can redistribute it and/or modify 10 it under the terms of version 2 of the GNU General Public License as 11 published by the Free Software Foundation. 12 13 This program is distributed in the hope that it will be useful, but 14 WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 21 The full GNU General Public License is included in this distribution 22 in the file called LICENSE.GPL. 23 24 Contact Information: 25 26 BSD LICENSE 27 28 Copyright(c) 2007-2009 Intel Corporation. All rights reserved. 29 All rights reserved. 30 31 Redistribution and use in source and binary forms, with or without 32 modification, are permitted provided that the following conditions 33 are met: 34 35 * Redistributions of source code must retain the above copyright 36 notice, this list of conditions and the following disclaimer. 37 * Redistributions in binary form must reproduce the above copyright 38 notice, this list of conditions and the following disclaimer in 39 the documentation and/or other materials provided with the 40 distribution. 41 * Neither the name of Intel Corporation nor the names of its 42 contributors may be used to endorse or promote products derived 43 from this software without specific prior written permission. 44 45 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 46 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 47 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 48 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 49 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 50 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 51 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 52 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 53 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 54 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 55 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 56 57 */ 58 #ifndef VIDDEC_FW_WORKLOAD_H 59 #define VIDDEC_FW_WORKLOAD_H 60 61 #include <stdint.h> 62 #include "viddec_fw_item_types.h" 63 #include "viddec_fw_frame_attr.h" 64 #include "viddec_fw_common_defs.h" 65 66 #define VIDDEC_WORKLOAD_FLAGS_ES_START_FRAME (1 << 0) 67 #define VIDDEC_WORKLOAD_FLAGS_ES_START_SLICE (1 << 1) 68 #define VIDDEC_WORKLOAD_FLAGS_ES_END_SLICE (1 << 2) 69 #define VIDDEC_WORKLOAD_FLAGS_ES_END_FRAME (1 << 3) 70 71 #define VIDDEC_FRAME_REFERENCE_IS_VALID (0x1<<1) 72 // PIP Output Frame request bits 73 #define BLSB_VIDDEC_FRAME_REFERENCE_PIP_MODE 24 74 #define BMSK_VIDDEC_FRAME_REFERENCE_PIP_MODE (0x3<<BLSB_VIDDEC_FRAME_REFERENCE_PIP_MODE) 75 #define VIDDEC_FRAME_REFERENCE_PIP_MODE_NORMAL 0x0 76 #define VIDDEC_FRAME_REFERENCE_PIP_MODE_W_HALF 0x1 77 #define VIDDEC_FRAME_REFERENCE_PIP_MODE_W_QUARTER 0x2 78 79 /** Frame reference information to pass to video decoder when performing a workload (frame decode) */ 80 typedef struct viddec_frame_reference 81 { 82 signed int driver_frame_id; 83 unsigned int luma_phys_addr; 84 unsigned int chroma_phys_addr; 85 int internal_id; /* Used by workload manager only */ 86 }viddec_frame_reference_t; 87 88 #define WORKLOAD_REFERENCE_FRAME (1 << 16) 89 #define WORKLOAD_SKIPPED_FRAME (1 << 17) 90 /** 91 Bitmask to indicate that this workload has range adjustment and needs a range_adjusted_out buffer for successful decode. 92 Will be used for VC1 only. 93 */ 94 #define WORKLOAD_FLAGS_RA_FRAME (1 << 21) 95 #define WORKLOAD_REFERENCE_FRAME_BMASK 0x000000ff 96 97 /** This structure contains all the information required to fully decode one frame of data */ 98 /** 99 num_error_mb: This field is populated at the output of the decoder. 100 Currently, its valid only for MPEG2. 101 For other codecs, it defaults to 0. 102 103 range_adjusted_out: Frame buffer needed to store range adjusted frames for VC1 only. 104 Range adjustment in VC1 requires that the luma/chroma values in the decoded frame be modified 105 before the frame can be displayed. In this case, we need a new frame buffer to store he adjusted values. 106 The parser will indicate this requirement by setting the WORKLOAD_FLAGS_RA_FRAME bit in the 107 is_reference_frame of the workload. The decoder expects this field to be valid when range adjustment 108 is indicated and populates this frame buffer along with frame_out. 109 110 Expectation from user: 111 Before feeding workload to the decoder, do the following: 112 If pip is indicated/needed, 113 provide the pip_out buffer 114 If range adjustment is indicated (WORKLOAD_FLAGS_RA_FRAME bit in is_reference_frame is set), 115 provide range_adjusted_out buffer 116 Provide frame_out buffer. 117 118 After workload is returned from the decoder, do the following: 119 If pip is indicated, 120 display the pip_out buffer 121 Else If range adjustment is indicated, 122 display range_adjusted_out buffer 123 Else 124 display frame_out buffer. 125 */ 126 typedef struct viddec_workload 127 { 128 enum viddec_stream_format codec; 129 signed int is_reference_frame; 130 unsigned int result; 131 unsigned int time; 132 unsigned int num_items;/* number of viddec_workload_item_t in current workload */ 133 unsigned int num_error_mb; /* Number of error macroblocks in the current picture. */ 134 viddec_frame_attributes_t attrs; 135 136 viddec_frame_reference_t frame_out; /* output frame */ 137 viddec_frame_reference_t range_adjusted_out; /* for VC1 only */ 138 viddec_frame_reference_t pip_out; /* PIP Buffer */ 139 140 /* Alignment is needed because the packing different between host and vSparc */ 141 __attribute__ ((aligned (16))) viddec_workload_item_t item[1]; 142 143 /* ------------------------------------------------------ */ 144 /* ------------------------------------------------------ */ 145 /* ------------------------------------------------------ */ 146 /* This structure is ALLOC_EXTENDED with workload_items */ 147 /* ------------------------------------------------------ */ 148 /* ------------------------------------------------------ */ 149 /* ------------------------------------------------------ */ 150 } viddec_workload_t; 151 152 #endif /* VIDDEC_WORKLOAD_H */ 153