1 /* 2 * 3 * Copyright 2015 Rockchip Electronics Co. LTD 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 #ifndef __HAL_DEC_TASK__ 19 #define __HAL_DEC_TASK__ 20 21 #include "hal_task.h" 22 #include "mpp_callback.h" 23 24 #define MAX_DEC_REF_NUM 17 25 26 /* 27 * modified by parser and encoder 28 * 29 * number : the number of the data pointer array element 30 * data : the address of the pointer array, parser will add its data here 31 */ 32 typedef struct MppSyntax_t { 33 RK_U32 number; 34 void *data; 35 } MppSyntax; 36 37 typedef union HalDecTaskFlag_t { 38 RK_U64 val; 39 struct { 40 RK_U32 eos : 1; 41 RK_U32 info_change : 1; 42 43 /* 44 * Different error flags for task 45 * 46 * parse_err : 47 * When set it means fatal error happened at parsing stage 48 * This task should not enable hardware just output a empty frame with 49 * error flag. 50 * 51 * ref_err : 52 * When set it means current task is ok but it contains reference frame 53 * with error which will introduce error pixels to this frame. 54 * 55 * used_for_ref : 56 * When set it means this output frame will be used as reference frame 57 * for further decoding. When there is error on decoding this frame 58 * if used_for_ref is set then the frame will set errinfo flag 59 * if used_for_ref is cleared then the frame will set discard flag. 60 */ 61 RK_U32 parse_err : 1; 62 RK_U32 ref_err : 1; 63 RK_U32 used_for_ref : 1; 64 65 RK_U32 wait_done : 1; 66 RK_U32 reserved0 : 1; 67 RK_U32 ref_info_valid : 1; 68 RK_U32 ref_miss : 16; 69 RK_U32 ref_used : 16; 70 }; 71 } HalDecTaskFlag; 72 73 typedef struct HalDecTask_t { 74 // set by parser to signal that it is valid 75 RK_U32 valid; 76 HalDecTaskFlag flags; 77 78 // current tesk protocol syntax information 79 MppSyntax syntax; 80 81 // packet need to be copied to hardware buffer 82 // parser will create this packet and mpp_dec will copy it to hardware bufffer 83 MppPacket input_packet; 84 85 // current task input slot index 86 RK_S32 input; 87 88 RK_S32 reg_index; 89 // for test purpose 90 // current tesk output slot index 91 RK_S32 output; 92 93 // current task reference slot index, -1 for unused 94 RK_S32 refer[MAX_DEC_REF_NUM]; 95 } HalDecTask; 96 97 typedef union HalDecVprocTaskFlag_t { 98 RK_U32 val; 99 100 struct { 101 RK_U32 eos : 1; 102 RK_U32 info_change : 1; 103 }; 104 } HalDecVprocTaskFlag; 105 106 typedef struct HalDecVprocTask_t { 107 // input slot index for post-process 108 HalDecVprocTaskFlag flags; 109 110 RK_S32 input; 111 } HalDecVprocTask; 112 113 typedef union HalTask_u { 114 HalDecTask dec; 115 HalDecVprocTask dec_vproc; 116 } HalTaskInfo; 117 118 #endif /* __HAL_DEC_TASK__ */ 119