<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 8, 2013 at 6:46 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im"># HG changeset patch<br>
# User Gopu Govindaswamy <<a href="mailto:gopu@multicorewareinc.com">gopu@multicorewareinc.com</a>><br>
</div># Date 1381232760 -19800<br>
# Node ID 166d3dbf2b70145a668d8c88582408574a5e8c64<br>
<div class="im"># 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></div></blockquote><div><br></div><div>Queued with a pile of cleanups</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im">
<br>
</div>diff -r 9b3a427a1009 -r 166d3dbf2b70 source/Lib/TLibCommon/TComPic.cpp<br>
<div class="im">--- a/source/Lib/TLibCommon/TComPic.cpp Tue Oct 08 11:12:12 2013 +0530<br>
</div>+++ b/source/Lib/TLibCommon/TComPic.cpp Tue Oct 08 17:16:00 2013 +0530<br>
<div class="im">@@ -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></div></blockquote><div><br></div><div>class member naming convention calls for m_</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im">
}<br>
<br>
TComPic::~TComPic()<br>
</div>diff -r 9b3a427a1009 -r 166d3dbf2b70 source/Lib/TLibCommon/TComPic.h<br>
<div class="im">--- a/source/Lib/TLibCommon/TComPic.h Tue Oct 08 11:12:12 2013 +0530<br>
</div>+++ b/source/Lib/TLibCommon/TComPic.h Tue Oct 08 17:16:00 2013 +0530<br>
<div class="im">@@ -81,6 +81,9 @@<br>
<br>
Lowres m_lowres;<br>
<br>
+ TComPic *next;<br>
+ TComPic *prev;<br>
+<br>
TComPic();<br>
virtual ~TComPic();<br>
<br>
</div>diff -r 9b3a427a1009 -r 166d3dbf2b70 source/common/CMakeLists.txt<br>
<div class="im">--- a/source/common/CMakeLists.txt Tue Oct 08 11:12:12 2013 +0530<br>
</div>+++ b/source/common/CMakeLists.txt Tue Oct 08 17:16:00 2013 +0530<br>
<div class="im">@@ -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>
</div>diff -r 9b3a427a1009 -r 166d3dbf2b70 source/common/piclist.cpp<br>
<div class="im">--- /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
</div>+++ b/source/common/piclist.cpp Tue Oct 08 17:16:00 2013 +0530<br>
@@ -0,0 +1,110 @@<br>
<div><div class="h5">+/*****************************************************************************<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>
+#include "TLibCommon/TComPic.h"<br>
+using namespace x265;<br></div></div></blockquote><div><br></div><div>added a few blank lines here</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div class="h5">
+void piclist::push_front(TComPic *pic)<br>
+{<br></div></div></blockquote><div><br></div><div>it's tempting to pass TComPic by reference so we don't have to check for NULL inside our function</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div class="h5">
+ 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></div></div></blockquote><div><br></div><div>modified to ensure pic->m_next and pic->m_prev are properly initialized</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div class="h5">
+ }<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><div style="color:rgb(34,34,34)">modified to ensure pic->m_next and pic->m_prev are properly initialized</div>+ }<br>
+}<br>
+<br>
+TComPic *piclist::pop_front()<br>
+{<br>
+ if (!empty())<br>
+ {<br>
+ TComPic *temp = start;<br>
</div></div>+ /** if one pic in the list */<br>
+ if (count == 1)<br>
+ {<br>
+ start = end = NULL;<br>
+ count--;<br>
+ }<br>
+ else<br>
+ {<br>
<div class="im">+ start = start->next;<br>
+ temp->next = temp->prev = NULL;<br>
+ count--;<br>
+ }<br><div style="color:rgb(34,34,34)">modified to ensure pic->m_next and pic->m_prev are properly updated, simplified</div>+ 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>
</div>+ /** if one pic in the list */<br>
+ if (count == 1)<br>
+ {<br>
+ start = end = NULL;<br>
+ count--;<br>
+ }<br>
+ else<br>
+ {<br>
<div class="im">+ TComPic* back = end->prev;<br>
+ back->next = NULL;<br>
+ end = back;<br><div style="color:rgb(34,34,34)">modified to ensure pic->m_next and pic->m_prev are properly updated, simplified</div>+ count--;<br>
+ }<br>
+ return temp;<br>
+ }<br>
+ else<br>
+ return NULL;<br>
+}<br>
</div>diff -r 9b3a427a1009 -r 166d3dbf2b70 source/common/piclist.h<br>
<div class="im">--- /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
</div>+++ b/source/common/piclist.h Tue Oct 08 17:16:00 2013 +0530<br>
<div><div class="h5">@@ -0,0 +1,79 @@<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>
</div></div>+#include "common.h"<br></blockquote><div><br></div><div>no need for either of these includes, all you need is NULL defined</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5">+namespace x265 {<br>
+<br>
+class TComPic;<br></div></div></blockquote><div><br></div><div>added a blank line</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5">
+class piclist<br></div></div></blockquote><div><br></div><div>our class naming convention requires PicList</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5">
+{<br>
+<br>
+ TComPic *start;<br>
+ TComPic *end;<br></div></div></blockquote><div><br></div><div>m_start, m_end, m_count</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5">
+<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>
+<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></div></div></blockquote><div><br></div><div>many comments had double spaces in them</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5">
+ void push_front(TComPic *pic);<br>
+<br>
+ /** Retrieve the picture at end of the list */<br></div></div></blockquote><div><br></div><div>you used the term "Retrieve" in the comments for pop* and first() last() which are entirely different operations; I changed the pop_* comments to use the verb Pop</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5">
+ TComPic* pop_back();<br>
+<br>
+ /** Retrieve the picture at beginning of the list */<br>
+ TComPic* pop_front();<br></div></div></blockquote><div><br></div><div>our class method naming convention calls for popFront(), etc</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5">
+<br>
+ /** Number of Picture in the list */<br>
+ int size() { return count; }<br>
+<br>
+ /** Retrieve the beginning picture */<br>
+ TComPic* first()<br>
+ {<br>
+ if (start)<br>
+ return start;<br>
+ }<br></div></div></blockquote><div><br></div><div>this shouldn't even compile (not all paths have return statements). the if() is entirely unnecessary.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5">
+<br>
+ /** Retrieve the end picture */<br>
+ TComPic* last() { return end; }<br>
+<br>
+ bool empty() const { return !start; }<br>
+ operator bool() const { return !empty(); }<br></div></div></blockquote><div><br></div><div>I added a remove() method because I know we need one for freelist picture reuse</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5">
+};<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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>