00001
00032 #include "contributors.h"
00033 #include "global.h"
00034 #include "elements.h"
00035
00036
00037
00052 int set_ec_flag(ImageParameters *p_Img, int se)
00053 {
00054
00055
00056
00057
00058
00059 switch (se)
00060 {
00061 case SE_HEADER :
00062 p_Img->ec_flag[SE_HEADER] = EC_REQ;
00063 case SE_PTYPE :
00064 p_Img->ec_flag[SE_PTYPE] = EC_REQ;
00065 case SE_MBTYPE :
00066 p_Img->ec_flag[SE_MBTYPE] = EC_REQ;
00067
00068 case SE_REFFRAME :
00069 p_Img->ec_flag[SE_REFFRAME] = EC_REQ;
00070 p_Img->ec_flag[SE_MVD] = EC_REQ;
00071 se = SE_CBP_INTER;
00072 break;
00073
00074 case SE_INTRAPREDMODE :
00075 p_Img->ec_flag[SE_INTRAPREDMODE] = EC_REQ;
00076 se = SE_CBP_INTRA;
00077 break;
00078 case SE_MVD :
00079 p_Img->ec_flag[SE_MVD] = EC_REQ;
00080 se = SE_CBP_INTER;
00081 break;
00082
00083 default:
00084 break;
00085 }
00086
00087 switch (se)
00088 {
00089 case SE_CBP_INTRA :
00090 p_Img->ec_flag[SE_CBP_INTRA] = EC_REQ;
00091 case SE_LUM_DC_INTRA :
00092 p_Img->ec_flag[SE_LUM_DC_INTRA] = EC_REQ;
00093 case SE_CHR_DC_INTRA :
00094 p_Img->ec_flag[SE_CHR_DC_INTRA] = EC_REQ;
00095 case SE_LUM_AC_INTRA :
00096 p_Img->ec_flag[SE_LUM_AC_INTRA] = EC_REQ;
00097 case SE_CHR_AC_INTRA :
00098 p_Img->ec_flag[SE_CHR_AC_INTRA] = EC_REQ;
00099 break;
00100
00101 case SE_CBP_INTER :
00102 p_Img->ec_flag[SE_CBP_INTER] = EC_REQ;
00103 case SE_LUM_DC_INTER :
00104 p_Img->ec_flag[SE_LUM_DC_INTER] = EC_REQ;
00105 case SE_CHR_DC_INTER :
00106 p_Img->ec_flag[SE_CHR_DC_INTER] = EC_REQ;
00107 case SE_LUM_AC_INTER :
00108 p_Img->ec_flag[SE_LUM_AC_INTER] = EC_REQ;
00109 case SE_CHR_AC_INTER :
00110 p_Img->ec_flag[SE_CHR_AC_INTER] = EC_REQ;
00111 break;
00112 case SE_DELTA_QUANT_INTER :
00113 p_Img->ec_flag[SE_DELTA_QUANT_INTER] = EC_REQ;
00114 break;
00115 case SE_DELTA_QUANT_INTRA :
00116 p_Img->ec_flag[SE_DELTA_QUANT_INTRA] = EC_REQ;
00117 break;
00118 default:
00119 break;
00120
00121 }
00122 return EC_REQ;
00123 }
00124
00132 void reset_ec_flags(ImageParameters *p_Img)
00133 {
00134 int i;
00135 for (i=0; i<SE_MAX_ELEMENTS; i++)
00136 p_Img->ec_flag[i] = NO_EC;
00137 }
00138
00139
00151 int get_concealed_element(ImageParameters *p_Img, SyntaxElement *sym)
00152 {
00153 if (p_Img->ec_flag[sym->type] == NO_EC)
00154 return NO_EC;
00155
00156
00157
00158
00159
00160 switch (sym->type)
00161 {
00162 case SE_HEADER :
00163 sym->len = 31;
00164 sym->inf = 0;
00165 break;
00166
00167 case SE_PTYPE :
00168 case SE_MBTYPE :
00169 case SE_REFFRAME :
00170 sym->len = 1;
00171 sym->inf = 0;
00172 break;
00173
00174 case SE_INTRAPREDMODE :
00175 case SE_MVD :
00176 sym->len = 1;
00177 sym->inf = 0;
00178 break;
00179
00180 case SE_CBP_INTRA :
00181 sym->len = 5;
00182 sym->inf = 0;
00183 break;
00184
00185 case SE_LUM_DC_INTRA :
00186 case SE_CHR_DC_INTRA :
00187 case SE_LUM_AC_INTRA :
00188 case SE_CHR_AC_INTRA :
00189 sym->len = 1;
00190 sym->inf = 0;
00191 break;
00192
00193 case SE_CBP_INTER :
00194 sym->len = 1;
00195 sym->inf = 0;
00196 break;
00197
00198 case SE_LUM_DC_INTER :
00199 case SE_CHR_DC_INTER :
00200 case SE_LUM_AC_INTER :
00201 case SE_CHR_AC_INTER :
00202 sym->len = 1;
00203 sym->inf = 0;
00204 break;
00205
00206 case SE_DELTA_QUANT_INTER:
00207 sym->len = 1;
00208 sym->inf = 0;
00209 break;
00210 case SE_DELTA_QUANT_INTRA:
00211 sym->len = 1;
00212 sym->inf = 0;
00213 break;
00214 default:
00215 break;
00216 }
00217
00218 return EC_REQ;
00219 }
00220