From 39346b4748b11b4a925f6001461b9d86520383e2 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/8] 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 73c02c3..1a33c5f 100644
a
|
b
|
public: |
1522 | 1522 | |
1523 | 1523 | ~ParameterSetMap() |
1524 | 1524 | { |
1525 | | for (typename std::map<Int,T *>::iterator i = m_paramsetMap.begin(); i!= m_paramsetMap.end(); i++) |
| 1525 | for (typename std::map<Int, std::vector<T *> >::iterator i = m_paramsetMap.begin(); i!= m_paramsetMap.end(); i++) |
1526 | 1526 | { |
1527 | | delete (*i).second; |
| 1527 | for (typename std::vector<T *>::iterator i2 = (*i).second.begin(); i2!= (*i).second.end(); ++i2) { |
| 1528 | delete *i2; |
| 1529 | } |
1528 | 1530 | } |
1529 | 1531 | } |
1530 | 1532 | |
1531 | 1533 | Void storePS(Int psId, T *ps) |
1532 | 1534 | { |
1533 | 1535 | assert ( psId < m_maxId ); |
1534 | | if ( m_paramsetMap.find(psId) != m_paramsetMap.end() ) |
1535 | | { |
1536 | | delete m_paramsetMap[psId]; |
1537 | | } |
1538 | | m_paramsetMap[psId] = ps; |
| 1536 | m_paramsetMap[psId].push_back(ps); |
1539 | 1537 | } |
1540 | 1538 | |
1541 | 1539 | Void mergePSList(ParameterSetMap<T> &rPsList) |
1542 | 1540 | { |
1543 | | for (typename std::map<Int,T *>::iterator i = rPsList.m_paramsetMap.begin(); i!= rPsList.m_paramsetMap.end(); i++) |
| 1541 | for (typename std::map<Int, std::vector<T *> >::iterator i = rPsList.m_paramsetMap.begin(); i!= rPsList.m_paramsetMap.end(); i++) |
1544 | 1542 | { |
1545 | | storePS(i->first, i->second); |
| 1543 | size_t sz1=m_paramsetMap[i->first].size(); |
| 1544 | size_t sz2=i->second.size(); |
| 1545 | m_paramsetMap[i->first].resize(sz1+sz2); |
| 1546 | memcpy(&(m_paramsetMap[i->first][sz1]), &(i->second[0]), sz2*sizeof(T*)); |
1546 | 1547 | } |
1547 | 1548 | rPsList.m_paramsetMap.clear(); |
1548 | 1549 | } |
… |
… |
public: |
1550 | 1551 | |
1551 | 1552 | T* getPS(Int psId) |
1552 | 1553 | { |
1553 | | return ( m_paramsetMap.find(psId) == m_paramsetMap.end() ) ? NULL : m_paramsetMap[psId]; |
| 1554 | return ( m_paramsetMap.find(psId) == m_paramsetMap.end() ) ? NULL : m_paramsetMap[psId].back(); |
1554 | 1555 | } |
1555 | 1556 | |
1556 | 1557 | T* getFirstPS() |
1557 | 1558 | { |
1558 | | return (m_paramsetMap.begin() == m_paramsetMap.end() ) ? NULL : m_paramsetMap.begin()->second; |
| 1559 | return (m_paramsetMap.begin() == m_paramsetMap.end() ) ? NULL : m_paramsetMap.begin()->second.back(); |
1559 | 1560 | } |
1560 | 1561 | |
1561 | 1562 | private: |
1562 | | std::map<Int,T *> m_paramsetMap; |
| 1563 | std::map<Int, std::vector<T *> > m_paramsetMap; |
1563 | 1564 | Int m_maxId; |
1564 | 1565 | }; |
1565 | 1566 | |