Changeset 1434 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibEncoder/SEIEncoder.cpp
- Timestamp:
- 11 Aug 2015, 20:47:57 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibEncoder/SEIEncoder.cpp
r1307 r1434 416 416 } 417 417 418 Void SEIEncoder::initSEIChromaSamplingFilterHint(SEIChromaSamplingFilterHint *seiChromaSamplingFilterHint, Int iHorFilterIndex, Int iVerFilterIndex) 419 { 420 assert (m_isInitialized); 421 assert (seiChromaSamplingFilterHint!=NULL); 422 423 seiChromaSamplingFilterHint->m_verChromaFilterIdc = iVerFilterIndex; 424 seiChromaSamplingFilterHint->m_horChromaFilterIdc = iHorFilterIndex; 425 seiChromaSamplingFilterHint->m_verFilteringProcessFlag = 1; 426 seiChromaSamplingFilterHint->m_targetFormatIdc = 3; 427 seiChromaSamplingFilterHint->m_perfectReconstructionFlag = false; 428 if(seiChromaSamplingFilterHint->m_verChromaFilterIdc == 1) 429 { 430 seiChromaSamplingFilterHint->m_numVerticalFilters = 1; 431 seiChromaSamplingFilterHint->m_verTapLengthMinus1 = (Int*)malloc(seiChromaSamplingFilterHint->m_numVerticalFilters * sizeof(Int)); 432 seiChromaSamplingFilterHint->m_verFilterCoeff = (Int**)malloc(seiChromaSamplingFilterHint->m_numVerticalFilters * sizeof(Int*)); 433 for(Int i = 0; i < seiChromaSamplingFilterHint->m_numVerticalFilters; i ++) 434 { 435 seiChromaSamplingFilterHint->m_verTapLengthMinus1[i] = 0; 436 seiChromaSamplingFilterHint->m_verFilterCoeff[i] = (Int*)malloc(seiChromaSamplingFilterHint->m_verTapLengthMinus1[i] * sizeof(Int)); 437 for(Int j = 0; j < seiChromaSamplingFilterHint->m_verTapLengthMinus1[i]; j ++) 438 { 439 seiChromaSamplingFilterHint->m_verFilterCoeff[i][j] = 0; 440 } 441 } 418 Void SEIEncoder::initSEIChromaResamplingFilterHint(SEIChromaResamplingFilterHint *seiChromaResamplingFilterHint, Int iHorFilterIndex, Int iVerFilterIndex) 419 { 420 assert (m_isInitialized); 421 assert (seiChromaResamplingFilterHint!=NULL); 422 423 seiChromaResamplingFilterHint->m_verChromaFilterIdc = iVerFilterIndex; 424 seiChromaResamplingFilterHint->m_horChromaFilterIdc = iHorFilterIndex; 425 seiChromaResamplingFilterHint->m_verFilteringFieldProcessingFlag = 1; 426 seiChromaResamplingFilterHint->m_targetFormatIdc = 3; 427 seiChromaResamplingFilterHint->m_perfectReconstructionFlag = false; 428 429 // this creates some example filter values, if explicit filter definition is selected 430 if (seiChromaResamplingFilterHint->m_verChromaFilterIdc == 1) 431 { 432 const Int numVerticalFilters = 3; 433 const Int verTapLengthMinus1[] = {5,3,3}; 434 435 seiChromaResamplingFilterHint->m_verFilterCoeff.resize(numVerticalFilters); 436 for(Int i = 0; i < numVerticalFilters; i ++) 437 { 438 seiChromaResamplingFilterHint->m_verFilterCoeff[i].resize(verTapLengthMinus1[i]+1); 439 } 440 // Note: C++11 -> seiChromaResamplingFilterHint->m_verFilterCoeff[0] = {-3,13,31,23,3,-3}; 441 seiChromaResamplingFilterHint->m_verFilterCoeff[0][0] = -3; 442 seiChromaResamplingFilterHint->m_verFilterCoeff[0][1] = 13; 443 seiChromaResamplingFilterHint->m_verFilterCoeff[0][2] = 31; 444 seiChromaResamplingFilterHint->m_verFilterCoeff[0][3] = 23; 445 seiChromaResamplingFilterHint->m_verFilterCoeff[0][4] = 3; 446 seiChromaResamplingFilterHint->m_verFilterCoeff[0][5] = -3; 447 448 seiChromaResamplingFilterHint->m_verFilterCoeff[1][0] = -1; 449 seiChromaResamplingFilterHint->m_verFilterCoeff[1][1] = 25; 450 seiChromaResamplingFilterHint->m_verFilterCoeff[1][2] = 247; 451 seiChromaResamplingFilterHint->m_verFilterCoeff[1][3] = -15; 452 453 seiChromaResamplingFilterHint->m_verFilterCoeff[2][0] = -20; 454 seiChromaResamplingFilterHint->m_verFilterCoeff[2][1] = 186; 455 seiChromaResamplingFilterHint->m_verFilterCoeff[2][2] = 100; 456 seiChromaResamplingFilterHint->m_verFilterCoeff[2][3] = -10; 442 457 } 443 458 else 444 459 { 445 seiChromaSamplingFilterHint->m_numVerticalFilters = 0; 446 seiChromaSamplingFilterHint->m_verTapLengthMinus1 = NULL; 447 seiChromaSamplingFilterHint->m_verFilterCoeff = NULL; 448 } 449 if(seiChromaSamplingFilterHint->m_horChromaFilterIdc == 1) 450 { 451 seiChromaSamplingFilterHint->m_numHorizontalFilters = 1; 452 seiChromaSamplingFilterHint->m_horTapLengthMinus1 = (Int*)malloc(seiChromaSamplingFilterHint->m_numHorizontalFilters * sizeof(Int)); 453 seiChromaSamplingFilterHint->m_horFilterCoeff = (Int**)malloc(seiChromaSamplingFilterHint->m_numHorizontalFilters * sizeof(Int*)); 454 for(Int i = 0; i < seiChromaSamplingFilterHint->m_numHorizontalFilters; i ++) 455 { 456 seiChromaSamplingFilterHint->m_horTapLengthMinus1[i] = 0; 457 seiChromaSamplingFilterHint->m_horFilterCoeff[i] = (Int*)malloc(seiChromaSamplingFilterHint->m_horTapLengthMinus1[i] * sizeof(Int)); 458 for(Int j = 0; j < seiChromaSamplingFilterHint->m_horTapLengthMinus1[i]; j ++) 459 { 460 seiChromaSamplingFilterHint->m_horFilterCoeff[i][j] = 0; 461 } 462 } 460 seiChromaResamplingFilterHint->m_verFilterCoeff.resize(0); 461 } 462 463 if (seiChromaResamplingFilterHint->m_horChromaFilterIdc == 1) 464 { 465 Int const numHorizontalFilters = 1; 466 const Int horTapLengthMinus1[] = {3}; 467 468 seiChromaResamplingFilterHint->m_horFilterCoeff.resize(numHorizontalFilters); 469 for(Int i = 0; i < numHorizontalFilters; i ++) 470 { 471 seiChromaResamplingFilterHint->m_horFilterCoeff[i].resize(horTapLengthMinus1[i]+1); 472 } 473 seiChromaResamplingFilterHint->m_horFilterCoeff[0][0] = 1; 474 seiChromaResamplingFilterHint->m_horFilterCoeff[0][1] = 6; 475 seiChromaResamplingFilterHint->m_horFilterCoeff[0][2] = 1; 463 476 } 464 477 else 465 478 { 466 seiChromaSamplingFilterHint->m_numHorizontalFilters = 0; 467 seiChromaSamplingFilterHint->m_horTapLengthMinus1 = NULL; 468 seiChromaSamplingFilterHint->m_horFilterCoeff = NULL; 479 seiChromaResamplingFilterHint->m_horFilterCoeff.resize(0); 469 480 } 470 481 }
Note: See TracChangeset for help on using the changeset viewer.