Changeset 838 in 3DVCSoftware for branches/HTM-10.0rc1-dev0/source/Lib/TLibEncoder/TEncSbac.cpp
- Timestamp:
- 8 Feb 2014, 01:07:38 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-10.0rc1-dev0/source/Lib/TLibEncoder/TEncSbac.cpp
r837 r838 2129 2129 { 2130 2130 m_pcBinIf->encodeBin( 1, m_cSaoTypeIdxSCModel.get( 0, 0, 0 ) ); 2131 m_pcBinIf->encodeBinEP( uiCode <= 4 ? 1 : 0);2131 m_pcBinIf->encodeBinEP( uiCode == 1 ? 0 : 1 ); 2132 2132 } 2133 2133 } … … 2332 2332 } 2333 2333 2334 Void TEncSbac::codeSAOOffsetParam(Int compIdx, SAOOffset& ctbParam, Bool sliceEnabled) 2335 { 2336 UInt uiSymbol; 2337 if(!sliceEnabled) 2338 { 2339 assert(ctbParam.modeIdc == SAO_MODE_OFF); 2340 return; 2341 } 2342 2343 //type 2344 if(compIdx == SAO_Y || compIdx == SAO_Cb) 2345 { 2346 //sao_type_idx_luma or sao_type_idx_chroma 2347 if(ctbParam.modeIdc == SAO_MODE_OFF) 2348 { 2349 uiSymbol =0; 2350 } 2351 else if(ctbParam.typeIdc == SAO_TYPE_BO) //BO 2352 { 2353 uiSymbol = 1; 2354 } 2355 else 2356 { 2357 assert(ctbParam.typeIdc < SAO_TYPE_START_BO); //EO 2358 uiSymbol = 2; 2359 } 2360 codeSaoTypeIdx(uiSymbol); 2361 } 2362 2363 if(ctbParam.modeIdc == SAO_MODE_NEW) 2364 { 2365 Int numClasses = (ctbParam.typeIdc == SAO_TYPE_BO)?4:NUM_SAO_EO_CLASSES; 2366 Int offset[4]; 2367 Int k=0; 2368 for(Int i=0; i< numClasses; i++) 2369 { 2370 if(ctbParam.typeIdc != SAO_TYPE_BO && i == SAO_CLASS_EO_PLAIN) 2371 { 2372 continue; 2373 } 2374 Int classIdx = (ctbParam.typeIdc == SAO_TYPE_BO)?( (ctbParam.typeAuxInfo+i)% NUM_SAO_BO_CLASSES ):i; 2375 offset[k] = ctbParam.offset[classIdx]; 2376 k++; 2377 } 2378 2379 for(Int i=0; i< 4; i++) 2380 { 2381 codeSaoMaxUvlc((offset[i]<0)?(-offset[i]):(offset[i]), g_saoMaxOffsetQVal[compIdx] ); //sao_offset_abs 2382 } 2383 2384 2385 if(ctbParam.typeIdc == SAO_TYPE_BO) 2386 { 2387 for(Int i=0; i< 4; i++) 2388 { 2389 if(offset[i] != 0) 2390 { 2391 codeSAOSign((offset[i]< 0)?1:0); 2392 } 2393 } 2394 2395 codeSaoUflc(NUM_SAO_BO_CLASSES_LOG2, ctbParam.typeAuxInfo ); //sao_band_position 2396 } 2397 else //EO 2398 { 2399 if(compIdx == SAO_Y || compIdx == SAO_Cb) 2400 { 2401 assert(ctbParam.typeIdc - SAO_TYPE_START_EO >=0); 2402 codeSaoUflc(NUM_SAO_EO_TYPES_LOG2, ctbParam.typeIdc - SAO_TYPE_START_EO ); //sao_eo_class_luma or sao_eo_class_chroma 2403 } 2404 } 2405 2406 } 2407 } 2408 2409 2410 Void TEncSbac::codeSAOBlkParam(SAOBlkParam& saoBlkParam 2411 , Bool* sliceEnabled 2412 , Bool leftMergeAvail 2413 , Bool aboveMergeAvail 2414 , Bool onlyEstMergeInfo // = false 2415 ) 2416 { 2417 2418 Bool isLeftMerge = false; 2419 Bool isAboveMerge= false; 2420 2421 if(leftMergeAvail) 2422 { 2423 isLeftMerge = ((saoBlkParam[SAO_Y].modeIdc == SAO_MODE_MERGE) && (saoBlkParam[SAO_Y].typeIdc == SAO_MERGE_LEFT)); 2424 codeSaoMerge( isLeftMerge?1:0 ); //sao_merge_left_flag 2425 } 2426 2427 if( aboveMergeAvail && !isLeftMerge) 2428 { 2429 isAboveMerge = ((saoBlkParam[SAO_Y].modeIdc == SAO_MODE_MERGE) && (saoBlkParam[SAO_Y].typeIdc == SAO_MERGE_ABOVE)); 2430 codeSaoMerge( isAboveMerge?1:0 ); //sao_merge_left_flag 2431 } 2432 2433 if(onlyEstMergeInfo) 2434 { 2435 return; //only for RDO 2436 } 2437 2438 if(!isLeftMerge && !isAboveMerge) //not merge mode 2439 { 2440 for(Int compIdx=0; compIdx < NUM_SAO_COMPONENTS; compIdx++) 2441 { 2442 codeSAOOffsetParam(compIdx, saoBlkParam[compIdx], sliceEnabled[compIdx]); 2443 } 2444 } 2445 } 2446 2334 2447 #if H_3D_INTER_SDC 2335 2448 #if QC_SDC_UNIFY_G0130
Note: See TracChangeset for help on using the changeset viewer.