From 52fa94953fbd848ff75f4bdf14d33e8defa713a7 Mon Sep 17 00:00:00 2001
From: Jack Haughton <jack.haughton@argondesign.com>
Date: Mon, 6 Oct 2014 13:59:54 +0100
Subject: [PATCH 1/9] Fix repeated parameter set bug
---
source/Lib/TLibCommon/TComSlice.h | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/source/Lib/TLibCommon/TComSlice.h b/source/Lib/TLibCommon/TComSlice.h
index 5be1da2..54fba6f 100644
a
|
b
|
public: |
1520 | 1520 | |
1521 | 1521 | ~ParameterSetMap() |
1522 | 1522 | { |
1523 | | for (typename std::map<Int,T *>::iterator i = m_paramsetMap.begin(); i!= m_paramsetMap.end(); i++) |
| 1523 | for (typename std::map<Int, std::vector<T *> >::iterator i = m_paramsetMap.begin(); i!= m_paramsetMap.end(); i++) |
1524 | 1524 | { |
1525 | | delete (*i).second; |
| 1525 | for (typename std::vector<T *>::iterator i2 = (*i).second.begin(); i2!= (*i).second.end(); ++i2) { |
| 1526 | delete *i2; |
| 1527 | } |
1526 | 1528 | } |
1527 | 1529 | } |
1528 | 1530 | |
1529 | 1531 | Void storePS(Int psId, T *ps) |
1530 | 1532 | { |
1531 | 1533 | assert ( psId < m_maxId ); |
1532 | | if ( m_paramsetMap.find(psId) != m_paramsetMap.end() ) |
1533 | | { |
1534 | | delete m_paramsetMap[psId]; |
1535 | | } |
1536 | | m_paramsetMap[psId] = ps; |
| 1534 | m_paramsetMap[psId].push_back(ps); |
1537 | 1535 | } |
1538 | 1536 | |
1539 | 1537 | Void mergePSList(ParameterSetMap<T> &rPsList) |
1540 | 1538 | { |
1541 | | for (typename std::map<Int,T *>::iterator i = rPsList.m_paramsetMap.begin(); i!= rPsList.m_paramsetMap.end(); i++) |
| 1539 | for (typename std::map<Int, std::vector<T *> >::iterator i = rPsList.m_paramsetMap.begin(); i!= rPsList.m_paramsetMap.end(); i++) |
1542 | 1540 | { |
1543 | | storePS(i->first, i->second); |
| 1541 | size_t sz1=m_paramsetMap[i->first].size(); |
| 1542 | size_t sz2=i->second.size(); |
| 1543 | m_paramsetMap[i->first].resize(sz1+sz2); |
| 1544 | memcpy(&(m_paramsetMap[i->first][sz1]), &(i->second[0]), sz2*sizeof(T*)); |
1544 | 1545 | } |
1545 | 1546 | rPsList.m_paramsetMap.clear(); |
1546 | 1547 | } |
… |
… |
public: |
1548 | 1549 | |
1549 | 1550 | T* getPS(Int psId) |
1550 | 1551 | { |
1551 | | return ( m_paramsetMap.find(psId) == m_paramsetMap.end() ) ? NULL : m_paramsetMap[psId]; |
| 1552 | return ( m_paramsetMap.find(psId) == m_paramsetMap.end() ) ? NULL : m_paramsetMap[psId].back(); |
1552 | 1553 | } |
1553 | 1554 | |
1554 | 1555 | T* getFirstPS() |
1555 | 1556 | { |
1556 | | return (m_paramsetMap.begin() == m_paramsetMap.end() ) ? NULL : m_paramsetMap.begin()->second; |
| 1557 | return (m_paramsetMap.begin() == m_paramsetMap.end() ) ? NULL : m_paramsetMap.begin()->second.back(); |
1557 | 1558 | } |
1558 | 1559 | |
1559 | 1560 | private: |
1560 | | std::map<Int,T *> m_paramsetMap; |
| 1561 | std::map<Int, std::vector<T *> > m_paramsetMap; |
1561 | 1562 | Int m_maxId; |
1562 | 1563 | }; |
1563 | 1564 | |