<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 8, 2013 at 2:30 AM, Gopu Govindaswamy <span dir="ltr"><<a href="mailto:gopu@multicorewareinc.com" target="_blank">gopu@multicorewareinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Gopu Govindaswamy <<a href="mailto:gopu@multicorewareinc.com">gopu@multicorewareinc.com</a>><br>
# Date 1381217437 -19800<br>
# Node ID ef8a18d9a3605f90644b563ef7976727b769e60a<br>
# Parent 9b3a427a1009d1853bbdc30abe1fd891864e6b38<br>
piclist: Added new class piclist for list manipulations<br>
<br>
Created new file piclist.cpp and piclist.h for linked list manipulation, there will be<br>
no intermediate storage in piclist, the piclist just link the TComPic object<br>
<br>
piclist is used to Replace TComList<TComPic> and this will remove std::list dependency in X265<br>
<br>
diff -r 9b3a427a1009 -r ef8a18d9a360 source/Lib/TLibCommon/TComPic.cpp<br>
--- a/source/Lib/TLibCommon/TComPic.cpp Tue Oct 08 11:12:12 2013 +0530<br>
+++ b/source/Lib/TLibCommon/TComPic.cpp Tue Oct 08 13:00:37 2013 +0530<br>
@@ -59,6 +59,8 @@<br>
m_reconRowCount = 0;<br>
m_countRefEncoders = 0;<br>
memset(&m_lowres, 0, sizeof(m_lowres));<br>
+ next = NULL;<br>
+ prev = NULL;<br>
}<br>
<br>
TComPic::~TComPic()<br>
diff -r 9b3a427a1009 -r ef8a18d9a360 source/Lib/TLibCommon/TComPic.h<br>
--- a/source/Lib/TLibCommon/TComPic.h Tue Oct 08 11:12:12 2013 +0530<br>
+++ b/source/Lib/TLibCommon/TComPic.h Tue Oct 08 13:00:37 2013 +0530<br>
@@ -81,6 +81,9 @@<br>
<br>
Lowres m_lowres;<br>
<br>
+ TComPic *next;<br>
+ TComPic *prev;<br>
+<br>
TComPic();<br>
virtual ~TComPic();<br>
<br>
diff -r 9b3a427a1009 -r ef8a18d9a360 source/common/CMakeLists.txt<br>
--- a/source/common/CMakeLists.txt Tue Oct 08 11:12:12 2013 +0530<br>
+++ b/source/common/CMakeLists.txt Tue Oct 08 13:00:37 2013 +0530<br>
@@ -93,7 +93,8 @@<br>
TShortYUV.cpp TShortYUV.h mv.h<br>
reference.cpp reference.h<br>
common.cpp common.h<br>
- lowres.cpp lowres.h)<br>
+ lowres.cpp lowres.h<br>
+ piclist.cpp piclist.h)<br>
<br>
if(ENABLE_PRIMITIVES_VEC)<br>
add_subdirectory(vec)<br>
diff -r 9b3a427a1009 -r ef8a18d9a360 source/common/piclist.cpp<br>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
+++ b/source/common/piclist.cpp Tue Oct 08 13:00:37 2013 +0530<br>
@@ -0,0 +1,91 @@<br>
+/*****************************************************************************<br>
+ * Copyright (C) 2013 x265 project<br>
+ *<br>
+ * Authors: Gopu Govindaswamy <<a href="mailto:gopu@multicorewareinc.com">gopu@multicorewareinc.com</a>><br>
+ *<br>
+ * This program is free software; you can redistribute it and/or modify<br>
+ * it under the terms of the GNU General Public License as published by<br>
+ * the Free Software Foundation; either version 2 of the License, or<br>
+ * (at your option) any later version.<br>
+ *<br>
+ * This program is distributed in the hope that it will be useful,<br>
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+ * GNU General Public License for more details.<br>
+ *<br>
+ * You should have received a copy of the GNU General Public License<br>
+ * along with this program; if not, write to the Free Software<br>
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.<br>
+ *<br>
+ * This program is also available under a commercial proprietary license.<br>
+ * For more information, contact us at <a href="mailto:licensing@multicorewareinc.com">licensing@multicorewareinc.com</a>.<br>
+ *****************************************************************************/<br>
+#include "piclist.h"<br>
+using namespace x265;<br>
+<br>
+void piclist::push_front(TComPic *pic)<br>
+{<br>
+ if (pic)<br>
+ {<br>
+ count++;<br>
+ if (start == NULL)<br>
+ {<br>
+ start = pic;<br>
+ end = pic;<br>
+ }<br>
+ else<br>
+ {<br>
+ pic->next = start;<br>
+ start->prev = pic;<br>
+ start = pic;<br>
+ }<br>
+ }<br>
+}<br>
+<br>
+void piclist::push_back(TComPic *pic)<br>
+{<br>
+ if (pic)<br>
+ {<br>
+ count++;<br>
+ if (end == NULL)<br>
+ {<br>
+ start = pic;<br>
+ end = pic;<br>
+ }<br>
+ else<br>
+ {<br>
+ pic->prev = end;<br>
+ end->next = pic;<br>
+ end = pic;<br>
+ }<br>
+ }<br>
+}<br>
+<br>
+TComPic *piclist::pop_front()<br>
+{<br>
+ if (!empty())<br>
+ {<br>
+ TComPic *temp = start;<br>
+ start = start->next;<br>
+ temp->next = temp->prev = NULL;<br>
+ count--;<br>
+ return temp;<br>
+ }<br>
+ else<br>
+ return NULL;<br>
+}<br>
+<br>
+TComPic *piclist::pop_back()<br>
+{<br>
+ if (!empty())<br>
+ {<br>
+ TComPic* temp = end;<br>
+ TComPic* back = end->prev;<br>
+ back->next = NULL;<br>
+ end = back;<br>
+ count--;<br>
+ return temp;<br>
+ }<br>
+ else<br>
+ return NULL;<br>
+}<br>
diff -r 9b3a427a1009 -r ef8a18d9a360 source/common/piclist.h<br>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
+++ b/source/common/piclist.h Tue Oct 08 13:00:37 2013 +0530<br>
@@ -0,0 +1,81 @@<br>
+/*****************************************************************************<br>
+ * Copyright (C) 2013 x265 project<br>
+ *<br>
+ * Authors: Gopu Govindaswamy <<a href="mailto:gopu@multicorewareinc.com">gopu@multicorewareinc.com</a>><br>
+ *<br>
+ * This program is free software; you can redistribute it and/or modify<br>
+ * it under the terms of the GNU General Public License as published by<br>
+ * the Free Software Foundation; either version 2 of the License, or<br>
+ * (at your option) any later version.<br>
+ *<br>
+ * This program is distributed in the hope that it will be useful,<br>
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+ * GNU General Public License for more details.<br>
+ *<br>
+ * You should have received a copy of the GNU General Public License<br>
+ * along with this program; if not, write to the Free Software<br>
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.<br>
+ *<br>
+ * This program is also available under a commercial proprietary license.<br>
+ * For more information, contact us at <a href="mailto:licensing@multicorewareinc.com">licensing@multicorewareinc.com</a>.<br>
+ *****************************************************************************/<br>
+<br>
+#ifndef X265_PICLIST_H<br>
+#define X265_PICLIST_H<br>
+<br>
+#include "x265.h"<br>
+#include "TLibCommon/TComPic.h"<br></blockquote><div><br></div><div>There's no need to include TComPic.h when the class is forward decl'd below<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+namespace x265 {<br>
+<br>
+class TComPic;<br>
+class piclist {<br>
+<br>
+ TComPic *start;<br>
+ TComPic *end;<br>
+<br>
+ /** Number of the picture in the list */<br>
+ int count;<br>
+<br>
+public:<br>
+ piclist()<br>
+ {<br>
+ start = NULL;<br>
+ end = NULL;<br>
+ count = 0;<br>
+ }<br></blockquote><div><br></div><div>white-space nits<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+ /** Pushing the picture at end of the list */<br>
+ void push_back(TComPic *pic);<br>
+<br>
+ /** Pushing the picture at beginning of the list */<br>
+ void push_front(TComPic *pic);<br>
+<br>
+ /** Retrieve the picture at end of the list */<br>
+ TComPic* pop_back();<br>
+<br>
+ /** Retrieve the picture at beginning of the list */<br>
+ TComPic* pop_front();<br>
+<br>
+ /** Number of Picture in the list */<br>
+ UInt size() { return count; }<br>
+<br>
+ /** Retrieve the beginning picture */<br>
+ TComPic* first()<br>
+ {<br>
+ if (start)<br>
+ return start;<br>
+ else<br>
+ NULL;<br></blockquote><div><br></div><div>missing a return here, but it seems "return start;" would be fine without any conditionals<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ }<br>
+<br>
+ /** Retrieve the end picture */<br>
+ TComPic* last() { return end; }<br>
+<br>
+ bool empty() const { return !start; }<br>
+ operator bool() const { return !empty(); }<br>
+};<br>
+}<br>
+<br>
+#endif // ifndef X265_PICLIST_H<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Steve Borho
</div></div>