735f05b5578dcb2984c014d49d68f6839d2658b1
1 /*****************************************************************************
2 * Copyright (C) 2013 x265 project
4 * Authors: Gopu Govindaswamy <gopu@multicorewareinc.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
20 * This program is also available under a commercial proprietary license.
21 * For more information, contact us at license @ x265.com.
22 *****************************************************************************/
30 void PicList::pushFront(Frame
& curFrame
)
32 X265_CHECK(!curFrame
.m_next
&& !curFrame
.m_prev
, "piclist: picture already in list\n"); // ensure frame is not in a list
33 curFrame
.m_next
= m_start
;
34 curFrame
.m_prev
= NULL
;
38 m_start
->m_prev
= &curFrame
;
43 m_start
= m_end
= &curFrame
;
48 void PicList::pushBack(Frame
& curFrame
)
50 X265_CHECK(!curFrame
.m_next
&& !curFrame
.m_prev
, "piclist: picture already in list\n"); // ensure frame is not in a list
51 curFrame
.m_next
= NULL
;
52 curFrame
.m_prev
= m_end
;
56 m_end
->m_next
= &curFrame
;
61 m_start
= m_end
= &curFrame
;
66 Frame
*PicList::popFront()
70 Frame
*temp
= m_start
;
75 m_start
= m_start
->m_next
;
76 m_start
->m_prev
= NULL
;
80 m_start
= m_end
= NULL
;
82 temp
->m_next
= temp
->m_prev
= NULL
;
89 Frame
* PicList::getPOC(int poc
)
91 Frame
*curFrame
= m_start
;
92 while (curFrame
&& curFrame
->m_poc
!= poc
)
93 curFrame
= curFrame
->m_next
;
97 Frame
*PicList::popBack()
106 m_end
= m_end
->m_prev
;
107 m_end
->m_next
= NULL
;
111 m_start
= m_end
= NULL
;
113 temp
->m_next
= temp
->m_prev
= NULL
;
120 void PicList::remove(Frame
& curFrame
)
123 Frame
*tmp
= m_start
;
124 while (tmp
&& tmp
!= &curFrame
)
129 X265_CHECK(tmp
== &curFrame
, "piclist: pic being removed was not in list\n"); // verify pic is in this list
135 if (m_start
== &curFrame
)
136 m_start
= curFrame
.m_next
;
137 if (m_end
== &curFrame
)
138 m_end
= curFrame
.m_prev
;
141 curFrame
.m_next
->m_prev
= curFrame
.m_prev
;
143 curFrame
.m_prev
->m_next
= curFrame
.m_next
;
147 m_start
= m_end
= NULL
;
150 curFrame
.m_next
= curFrame
.m_prev
= NULL
;