<div dir="ltr">Sent new patch</div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">With Regards,<div>Sagar</div></div></div>
<br><br><div class="gmail_quote">On Tue, Feb 25, 2014 at 2:37 PM, Deepthi Nandakumar <span dir="ltr"><<a href="mailto:deepthi@multicorewareinc.com" target="_blank">deepthi@multicorewareinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Ok, looks good except x265_ssim should not be extern, and should be a part of common.cpp and not api.cpp. <br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Tue, Feb 25, 2014 at 2:33 PM,  <span dir="ltr"><<a href="mailto:sagar@multicorewareinc.com" target="_blank">sagar@multicorewareinc.com</a>></span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"># HG changeset patch<br>
# User Sagar Kotecha <<a href="mailto:sagar@multicorewareinc.com" target="_blank">sagar@multicorewareinc.com</a>><br>
# Date 1393318766 -19800<br>
#      Tue Feb 25 14:29:26 2014 +0530<br>
# Node ID 504c2a959e5815cb3020033289137f64cb458aee<br>
# Parent  a36a669d09e89332dd91817afdf139853ba3ad03<br>
Add x265 API defination to api.cpp<br>
<br>
diff -r a36a669d09e8 -r 504c2a959e58 source/common/common.cpp<br>
--- a/source/common/common.cpp  Tue Feb 25 02:22:06 2014 -0600<br>
+++ b/source/common/common.cpp  Tue Feb 25 14:29:26 2014 +0530<br>
@@ -134,23 +134,3 @@<br>
     va_end(arg);<br>
 }<br>
<br>
-extern "C"<br>
-x265_picture *x265_picture_alloc()<br>
-{<br>
-    return (x265_picture*)x265_malloc(sizeof(x265_picture));<br>
-}<br>
-<br>
-extern "C"<br>
-void x265_picture_init(x265_param *param, x265_picture *pic)<br>
-{<br>
-    memset(pic, 0, sizeof(x265_picture));<br>
-<br>
-    pic->bitDepth = param->internalBitDepth;<br>
-    pic->colorSpace = param->internalCsp;<br>
-}<br>
-<br>
-extern "C"<br>
-void x265_picture_free(x265_picture *p)<br>
-{<br>
-    return x265_free(p);<br>
-}<br>
diff -r a36a669d09e8 -r 504c2a959e58 source/encoder/CMakeLists.txt<br>
--- a/source/encoder/CMakeLists.txt     Tue Feb 25 02:22:06 2014 -0600<br>
+++ b/source/encoder/CMakeLists.txt     Tue Feb 25 14:29:26 2014 +0530<br>
@@ -58,4 +58,5 @@<br>
     compress.cpp<br>
     reference.cpp reference.h<br>
     encoder.cpp encoder.h<br>
+       api.cpp<br>
     weightPrediction.cpp)<br>
diff -r a36a669d09e8 -r 504c2a959e58 source/encoder/api.cpp<br>
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000<br>
+++ b/source/encoder/api.cpp    Tue Feb 25 14:29:26 2014 +0530<br>
@@ -0,0 +1,199 @@<br>
+/*****************************************************************************<br>
+ * Copyright (C) 2013 x265 project<br>
+ *<br>
+ * Authors: Steve Borho <<a href="mailto:steve@borho.org" target="_blank">steve@borho.org</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" target="_blank">licensing@multicorewareinc.com</a>.<br>
+ *****************************************************************************/<br>
+<br>
+#include "TLibCommon/CommonDef.h"<br>
+#include "param.h"<br>
+#include "encoder.h"<br>
+#include "frameencoder.h"<br>
+<br>
+using namespace x265;<br>
+<br>
+extern "C"<br>
+x265_encoder *x265_encoder_open(x265_param *param)<br>
+{<br>
+    x265_setup_primitives(param, -1);  // -1 means auto-detect if uninitialized<br>
+<br>
+    if (x265_check_params(param))<br>
+        return NULL;<br>
+<br>
+    if (x265_set_globals(param))<br>
+        return NULL;<br>
+<br>
+    Encoder *encoder = new Encoder;<br>
+    if (encoder)<br>
+    {<br>
+        // these may change params for auto-detect, etc<br>
+        encoder->determineLevelAndProfile(param);<br>
+        encoder->configure(param);<br>
+<br>
+        // save a copy of final parameters in TEncCfg<br>
+        memcpy(&encoder->param, param, sizeof(*param));<br>
+<br>
+        x265_print_params(param);<br>
+        encoder->create();<br>
+        encoder->init();<br>
+    }<br>
+<br>
+    return encoder;<br>
+}<br>
+<br>
+extern "C"<br>
+int x265_encoder_headers(x265_encoder *enc, x265_nal **pp_nal, uint32_t *pi_nal)<br>
+{<br>
+    if (!pp_nal || !enc)<br>
+        return 0;<br>
+<br>
+    Encoder *encoder = static_cast<Encoder*>(enc);<br>
+<br>
+    int ret = 0;<br>
+    NALUnitEBSP *nalunits[MAX_NAL_UNITS] = { 0, 0, 0, 0, 0 };<br>
+    if (!encoder->getStreamHeaders(nalunits))<br>
+    {<br>
+        int nalcount = encoder->extractNalData(nalunits);<br>
+        *pp_nal = &encoder->m_nals[0];<br>
+        if (pi_nal) *pi_nal = nalcount;<br>
+    }<br>
+    else if (pi_nal)<br>
+    {<br>
+        *pi_nal = 0;<br>
+        ret = -1;<br>
+    }<br>
+<br>
+    for (int i = 0; i < MAX_NAL_UNITS; i++)<br>
+    {<br>
+        if (nalunits[i])<br>
+        {<br>
+            free(nalunits[i]->m_nalUnitData);<br>
+            X265_FREE(nalunits[i]);<br>
+        }<br>
+    }<br>
+<br>
+    return ret;<br>
+}<br>
+<br>
+extern "C"<br>
+int x265_encoder_encode(x265_encoder *enc, x265_nal **pp_nal, uint32_t *pi_nal, x265_picture *pic_in, x265_picture *pic_out)<br>
+{<br>
+    if (!enc)<br>
+        return -1;<br>
+<br>
+    Encoder *encoder = static_cast<Encoder*>(enc);<br>
+    NALUnitEBSP *nalunits[MAX_NAL_UNITS] = { 0, 0, 0, 0, 0 };<br>
+    int numEncoded = encoder->encode(!pic_in, pic_in, pic_out, nalunits);<br>
+<br>
+    if (pp_nal && numEncoded > 0)<br>
+    {<br>
+        int nalcount = encoder->extractNalData(nalunits);<br>
+        *pp_nal = &encoder->m_nals[0];<br>
+        if (pi_nal) *pi_nal = nalcount;<br>
+    }<br>
+    else if (pi_nal)<br>
+        *pi_nal = 0;<br>
+<br>
+    for (int i = 0; i < MAX_NAL_UNITS; i++)<br>
+    {<br>
+        if (nalunits[i])<br>
+        {<br>
+            free(nalunits[i]->m_nalUnitData);<br>
+            X265_FREE(nalunits[i]);<br>
+        }<br>
+    }<br>
+<br>
+    return numEncoded;<br>
+}<br>
+<br>
+EXTERN_CYCLE_COUNTER(ME);<br>
+<br>
+extern "C"<br>
+void x265_encoder_get_stats(x265_encoder *enc, x265_stats *outputStats, uint32_t statsSizeBytes)<br>
+{<br>
+    if (enc && outputStats)<br>
+    {<br>
+        Encoder *encoder = static_cast<Encoder*>(enc);<br>
+        encoder->fetchStats(outputStats, statsSizeBytes);<br>
+    }<br>
+}<br>
+<br>
+extern "C"<br>
+void x265_encoder_log(x265_encoder* enc, int argc, char **argv)<br>
+{<br>
+    if (enc)<br>
+    {<br>
+        Encoder *encoder = static_cast<Encoder*>(enc);<br>
+        encoder->writeLog(argc, argv);<br>
+    }<br>
+}<br>
+<br>
+extern "C"<br>
+void x265_encoder_close(x265_encoder *enc)<br>
+{<br>
+    if (enc)<br>
+    {<br>
+        Encoder *encoder = static_cast<Encoder*>(enc);<br>
+<br>
+        REPORT_CYCLE_COUNTER(ME);<br>
+<br>
+        encoder->printSummary();<br>
+        encoder->destroy();<br>
+        delete encoder;<br>
+    }<br>
+}<br>
+<br>
+extern "C"<br>
+void x265_cleanup(void)<br>
+{<br>
+    destroyROM();<br>
+    BitCost::destroy();<br>
+}<br>
+<br>
+extern "C"<br>
+double x265_ssim(double ssim)<br>
+{<br>
+    double inv_ssim = 1 - ssim;<br>
+<br>
+    if (inv_ssim <= 0.0000000001) /* Max 100dB */<br>
+        return 100;<br>
+<br>
+    return -10.0 * log10(inv_ssim);<br>
+}<br>
+<br>
+extern "C"<br>
+x265_picture *x265_picture_alloc()<br>
+{<br>
+    return (x265_picture*)x265_malloc(sizeof(x265_picture));<br>
+}<br>
+<br>
+extern "C"<br>
+void x265_picture_init(x265_param *param, x265_picture *pic)<br>
+{<br>
+    memset(pic, 0, sizeof(x265_picture));<br>
+<br>
+    pic->bitDepth = param->internalBitDepth;<br>
+    pic->colorSpace = param->internalCsp;<br>
+}<br>
+<br>
+extern "C"<br>
+void x265_picture_free(x265_picture *p)<br>
+{<br>
+    return x265_free(p);<br>
+}<br>
\ No newline at end of file<br>
diff -r a36a669d09e8 -r 504c2a959e58 source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp        Tue Feb 25 02:22:06 2014 -0600<br>
+++ b/source/encoder/encoder.cpp        Tue Feb 25 14:29:26 2014 +0530<br>
@@ -1587,151 +1587,3 @@<br>
     return nalcount;<br>
 }<br>
<br>
-extern "C"<br>
-x265_encoder *x265_encoder_open(x265_param *param)<br>
-{<br>
-    x265_setup_primitives(param, -1);  // -1 means auto-detect if uninitialized<br>
-<br>
-    if (x265_check_params(param))<br>
-        return NULL;<br>
-<br>
-    if (x265_set_globals(param))<br>
-        return NULL;<br>
-<br>
-    Encoder *encoder = new Encoder;<br>
-    if (encoder)<br>
-    {<br>
-        // these may change params for auto-detect, etc<br>
-        encoder->determineLevelAndProfile(param);<br>
-        encoder->configure(param);<br>
-<br>
-        // save a copy of final parameters in TEncCfg<br>
-        memcpy(&encoder->param, param, sizeof(*param));<br>
-<br>
-        x265_print_params(param);<br>
-        encoder->create();<br>
-        encoder->init();<br>
-    }<br>
-<br>
-    return encoder;<br>
-}<br>
-<br>
-extern "C"<br>
-int x265_encoder_headers(x265_encoder *enc, x265_nal **pp_nal, uint32_t *pi_nal)<br>
-{<br>
-    if (!pp_nal || !enc)<br>
-        return 0;<br>
-<br>
-    Encoder *encoder = static_cast<Encoder*>(enc);<br>
-<br>
-    int ret = 0;<br>
-    NALUnitEBSP *nalunits[MAX_NAL_UNITS] = { 0, 0, 0, 0, 0 };<br>
-    if (!encoder->getStreamHeaders(nalunits))<br>
-    {<br>
-        int nalcount = encoder->extractNalData(nalunits);<br>
-        *pp_nal = &encoder->m_nals[0];<br>
-        if (pi_nal) *pi_nal = nalcount;<br>
-    }<br>
-    else if (pi_nal)<br>
-    {<br>
-        *pi_nal = 0;<br>
-        ret = -1;<br>
-    }<br>
-<br>
-    for (int i = 0; i < MAX_NAL_UNITS; i++)<br>
-    {<br>
-        if (nalunits[i])<br>
-        {<br>
-            free(nalunits[i]->m_nalUnitData);<br>
-            X265_FREE(nalunits[i]);<br>
-        }<br>
-    }<br>
-<br>
-    return ret;<br>
-}<br>
-<br>
-extern "C"<br>
-int x265_encoder_encode(x265_encoder *enc, x265_nal **pp_nal, uint32_t *pi_nal, x265_picture *pic_in, x265_picture *pic_out)<br>
-{<br>
-    if (!enc)<br>
-        return -1;<br>
-<br>
-    Encoder *encoder = static_cast<Encoder*>(enc);<br>
-    NALUnitEBSP *nalunits[MAX_NAL_UNITS] = { 0, 0, 0, 0, 0 };<br>
-    int numEncoded = encoder->encode(!pic_in, pic_in, pic_out, nalunits);<br>
-<br>
-    if (pp_nal && numEncoded > 0)<br>
-    {<br>
-        int nalcount = encoder->extractNalData(nalunits);<br>
-        *pp_nal = &encoder->m_nals[0];<br>
-        if (pi_nal) *pi_nal = nalcount;<br>
-    }<br>
-    else if (pi_nal)<br>
-        *pi_nal = 0;<br>
-<br>
-    for (int i = 0; i < MAX_NAL_UNITS; i++)<br>
-    {<br>
-        if (nalunits[i])<br>
-        {<br>
-            free(nalunits[i]->m_nalUnitData);<br>
-            X265_FREE(nalunits[i]);<br>
-        }<br>
-    }<br>
-<br>
-    return numEncoded;<br>
-}<br>
-<br>
-EXTERN_CYCLE_COUNTER(ME);<br>
-<br>
-extern "C"<br>
-void x265_encoder_get_stats(x265_encoder *enc, x265_stats *outputStats, uint32_t statsSizeBytes)<br>
-{<br>
-    if (enc && outputStats)<br>
-    {<br>
-        Encoder *encoder = static_cast<Encoder*>(enc);<br>
-        encoder->fetchStats(outputStats, statsSizeBytes);<br>
-    }<br>
-}<br>
-<br>
-extern "C"<br>
-void x265_encoder_log(x265_encoder* enc, int argc, char **argv)<br>
-{<br>
-    if (enc)<br>
-    {<br>
-        Encoder *encoder = static_cast<Encoder*>(enc);<br>
-        encoder->writeLog(argc, argv);<br>
-    }<br>
-}<br>
-<br>
-extern "C"<br>
-void x265_encoder_close(x265_encoder *enc)<br>
-{<br>
-    if (enc)<br>
-    {<br>
-        Encoder *encoder = static_cast<Encoder*>(enc);<br>
-<br>
-        REPORT_CYCLE_COUNTER(ME);<br>
-<br>
-        encoder->printSummary();<br>
-        encoder->destroy();<br>
-        delete encoder;<br>
-    }<br>
-}<br>
-<br>
-extern "C"<br>
-void x265_cleanup(void)<br>
-{<br>
-    destroyROM();<br>
-    BitCost::destroy();<br>
-}<br>
-<br>
-extern "C"<br>
-double x265_ssim(double ssim)<br>
-{<br>
-    double inv_ssim = 1 - ssim;<br>
-<br>
-    if (inv_ssim <= 0.0000000001) /* Max 100dB */<br>
-        return 100;<br>
-<br>
-    return -10.0 * log10(inv_ssim);<br>
-}<br></div></div>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">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></div>
<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>
<br></blockquote></div><br></div>