Ticket #1282: fix_1282.patch
File fix_1282.patch, 5.9 KB (added by barrouxg, 10 years ago) |
---|
-
source/Lib/TLibEncoder/TEncCfg.h
66 66 Bool m_interRPSPrediction; 67 67 #endif 68 68 Int m_deltaRPS; 69 69 Int m_numRefIdc; 70 70 Int m_refIdc[MAX_NUM_REF_PICS+1]; 71 Bool m_isEncoded; 71 72 GOPEntry() 72 73 : m_POC(-1) 73 74 , m_QPOffset(0) 74 75 , m_QPFactor(0) 75 76 , m_tcOffsetDiv2(0) … … 80 81 , m_sliceType('P') 81 82 , m_numRefPics(0) 82 83 , m_interRPSPrediction(false) 83 84 , m_deltaRPS(0) 84 85 , m_numRefIdc(0) 86 , m_isEncoded(false) 85 87 { 86 88 ::memset( m_referencePics, 0, sizeof(m_referencePics) ); 87 89 ::memset( m_usedByCurrPic, 0, sizeof(m_usedByCurrPic) ); 88 90 ::memset( m_refIdc, 0, sizeof(m_refIdc) ); 89 91 } … … 396 398 Void setDecodingRefreshType ( Int i ) { m_uiDecodingRefreshType = (UInt)i; } 397 399 Void setGOPSize ( Int i ) { m_iGOPSize = i; } 398 400 Void setGopList ( GOPEntry* GOPList ) { for ( Int i = 0; i < MAX_GOP; i++ ) m_GOPList[i] = GOPList[i]; } 399 401 Void setExtraRPSs ( Int i ) { m_extraRPSs = i; } 400 402 GOPEntry getGOPEntry ( Int i ) { return m_GOPList[i]; } 403 Void setEncodedFlag ( Int i, Bool value ) { m_GOPList[i].m_isEncoded = value; } 401 404 Void setMaxDecPicBuffering ( UInt u, UInt tlayer ) { m_maxDecPicBuffering[tlayer] = u; } 402 405 Void setNumReorderPics ( Int i, UInt tlayer ) { m_numReorderPics[tlayer] = i; } 403 406 404 407 Void setQP ( Int i ) { m_iQP = i; } 405 408 -
source/Lib/TLibEncoder/TEncGOP.cpp
609 609 } 610 610 } 611 611 } 612 612 } 613 613 #endif 614 // reset flag indicating whether pictures have been encoded 615 for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ ) 616 { 617 m_pcCfg->setEncodedFlag(iGOPid, false); 618 } 614 619 615 620 for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ ) 616 621 { 617 622 #if EFFICIENT_FIELD_IRAP 618 623 if(IRAPtoReorder) … … 1876 1881 /* insert the SEI message NALUnit before any Slice NALUnits */ 1877 1882 AccessUnit::iterator it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice)); 1878 1883 accessUnit.insert(it, new NALUnitEBSP(nalu)); 1879 1884 } 1880 1885 1886 m_pcCfg->setEncodedFlag(iGOPid, true); 1881 1887 xCalculateAddPSNR( pcPic, pcPic->getPicYuvRec(), accessUnit, dEncTime, snr_conversion, printFrameMSE ); 1882 1888 1883 1889 //In case of field coding, compute the interlaced PSNR for both fields 1884 if (isField && ((!pcPic->isTopField() && isTff) || (pcPic->isTopField() && !isTff)) && (pcPic->getPOC()%m_iGopSize != 1))1890 if(isField) 1885 1891 { 1886 //get complementary top field 1887 1888 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 1889 while ((*iterPic)->getPOC() != pcPic->getPOC()-1) 1892 Bool bothFieldsAreEncoded = false; 1893 Int correspondingFieldPOC = pcPic->getPOC(); 1894 Int currentPicGOPPoc = m_pcCfg->getGOPEntry(iGOPid).m_POC; 1895 if(pcPic->getPOC() == 0) 1896 { 1897 // particular case for POC 0 and 1. 1898 // If they are not encoded first and separaltely from other pictures, we need to change this 1899 // POC 0 is always encoded first then POC 1 is encoded 1900 bothFieldsAreEncoded = false; 1901 } 1902 else if(pcPic->getPOC() == 1) 1903 { 1904 // if we are at POC 1, POC 0 has been encoded for sure 1905 correspondingFieldPOC = 0; 1906 bothFieldsAreEncoded = true; 1907 } 1908 else 1890 1909 { 1891 iterPic ++; 1910 if(pcPic->getPOC()%2 == 1) 1911 { 1912 correspondingFieldPOC -= 1; // all odd POC are associated with the preceding even POC (e.g poc 1 is associated to poc 0) 1913 currentPicGOPPoc -= 1; 1892 1914 } 1893 TComPic* pcPicFirstField = *(iterPic); 1894 xCalculateInterlacedAddPSNR(pcPicFirstField, pcPic, pcPicFirstField->getPicYuvRec(), pcPic->getPicYuvRec(), accessUnit, dEncTime, snr_conversion, printFrameMSE ); 1915 else 1916 { 1917 correspondingFieldPOC += 1; // all even POC are associated with the following odd POC (e.g poc 0 is associated to poc 1) 1918 currentPicGOPPoc += 1; 1895 1919 } 1896 else if (isField && pcPic->getPOC()!= 0 && (pcPic->getPOC()%m_iGopSize == 0))1920 for(Int i = 0; i < m_iGopSize; i ++) 1897 1921 { 1898 //get complementary bottom field 1922 if(m_pcCfg->getGOPEntry(i).m_POC == currentPicGOPPoc) 1923 { 1924 bothFieldsAreEncoded = m_pcCfg->getGOPEntry(i).m_isEncoded; 1925 break; 1926 } 1927 } 1928 } 1899 1929 1930 if(bothFieldsAreEncoded) 1931 { 1932 //get complementary top field 1900 1933 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 1901 while ((*iterPic)->getPOC() != pcPic->getPOC()+1)1934 while ((*iterPic)->getPOC() != correspondingFieldPOC) 1902 1935 { 1903 1936 iterPic ++; 1904 1937 } 1905 TComPic* pcPicFirstField = *(iterPic); 1906 xCalculateInterlacedAddPSNR(pcPic, pcPicFirstField, pcPic->getPicYuvRec(), pcPicFirstField->getPicYuvRec(), accessUnit, dEncTime, snr_conversion, printFrameMSE ); 1938 TComPic* correspondingFieldPic = *(iterPic); 1939 1940 if(pcPic->isTopField() && isTff || !pcPic->isTopField() && !isTff) 1941 { 1942 xCalculateInterlacedAddPSNR(pcPic, correspondingFieldPic, pcPic->getPicYuvRec(), correspondingFieldPic->getPicYuvRec(), accessUnit, dEncTime, snr_conversion, printFrameMSE ); 1943 } 1944 else 1945 { 1946 xCalculateInterlacedAddPSNR(correspondingFieldPic, pcPic, correspondingFieldPic->getPicYuvRec(), pcPic->getPicYuvRec(), accessUnit, dEncTime, snr_conversion, printFrameMSE ); 1947 } 1948 } 1907 1949 } 1908 1950 1909 1951 if (!digestStr.empty()) 1910 1952 { 1911 1953 if(m_pcCfg->getDecodedPictureHashSEIEnabled() == 1)