<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 3, 2017 at 4:21 PM, <span dir="ltr"><<a href="mailto:praveen@multicorewareinc.com" target="_blank">praveen@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 Praveen Tiwari <<a href="mailto:praveen@multicorewareinc.com">praveen@multicorewareinc.com</a>><br>
# Date 1509446629 -19800<br>
# Tue Oct 31 16:13:49 2017 +0530<br>
# Node ID 6ad93877ffe19cd6cf285f0cc8189f<wbr>41dce606b8<br>
# Parent de91aae2db5353e4e548d002e2dce5<wbr>30a6c8078d<br>
api: 'x265_get_ref_frame_list' to get forward and backward refrence list<br></blockquote><div><br></div><div>Pushed to default branch.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
diff -r de91aae2db53 -r 6ad93877ffe1 doc/reST/api.rst<br>
--- a/doc/reST/api.rst Tue Oct 31 13:57:37 2017 +0530<br>
+++ b/doc/reST/api.rst Tue Oct 31 16:13:49 2017 +0530<br>
@@ -201,6 +201,13 @@<br>
* This API must be called after(poc >= lookaheadDepth + bframes + 2) condition check. */<br>
int x265_get_slicetype_poc_and_<wbr>scenecut(x265_encoder *encoder, int *slicetype, int *poc, int* sceneCut);<br>
<br>
+**x265_get_ref_frame_list()** may be used to fetch forward and backward refrence list::<br>
+<br>
+ /* x265_get_ref_frame_list:<br>
+ * returns negative on error, 0 when access unit were output.<br>
+ * This API must be called after(poc >= lookaheadDepth + bframes + 2) condition check */<br>
+ int x265_get_ref_frame_list(x265_<wbr>encoder *encoder, x265_picyuv**, x265_picyuv**, int, int);<br>
+<br>
**x265_encoder_ctu_info**<br>
/* x265_encoder_ctu_info:<br>
* Copy CTU information such as ctu address and ctu partition structure of all<br>
diff -r de91aae2db53 -r 6ad93877ffe1 source/CMakeLists.txt<br>
--- a/source/CMakeLists.txt Tue Oct 31 13:57:37 2017 +0530<br>
+++ b/source/CMakeLists.txt Tue Oct 31 16:13:49 2017 +0530<br>
@@ -29,7 +29,7 @@<br>
option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)<br>
mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)<br>
# X265_BUILD must be incremented each time the public API is changed<br>
-set(X265_BUILD 137)<br>
+set(X265_BUILD 138)<br>
configure_file("${PROJECT_<wbr>SOURCE_DIR}/<a href="http://x265.def.in" rel="noreferrer" target="_blank">x265.def.in</a>"<br>
"${PROJECT_BINARY_DIR}/x265.<wbr>def")<br>
configure_file("${PROJECT_<wbr>SOURCE_DIR}/<a href="http://x265_config.h.in" rel="noreferrer" target="_blank">x265_config.h.in</a>"<br>
diff -r de91aae2db53 -r 6ad93877ffe1 source/common/frame.h<br>
--- a/source/common/frame.h Tue Oct 31 13:57:37 2017 +0530<br>
+++ b/source/common/frame.h Tue Oct 31 16:13:49 2017 +0530<br>
@@ -98,6 +98,7 @@<br>
<br>
float* m_quantOffsets; // points to quantOffsets in x265_picture<br>
x265_sei m_userSEI;<br>
+ Event m_reconEncoded;<br>
<br>
/* Frame Parallelism - notification between FrameEncoders of available motion reference rows */<br>
ThreadSafeInteger* m_reconRowFlag; // flag of CTU rows completely reconstructed and extended for motion reference<br>
diff -r de91aae2db53 -r 6ad93877ffe1 source/common/picyuv.h<br>
--- a/source/common/picyuv.h Tue Oct 31 13:57:37 2017 +0530<br>
+++ b/source/common/picyuv.h Tue Oct 31 16:13:49 2017 +0530<br>
@@ -27,6 +27,7 @@<br>
#include "common.h"<br>
#include "md5.h"<br>
#include "x265.h"<br>
+struct x265_picyuv {};<br>
<br>
namespace X265_NS {<br>
// private namespace<br>
@@ -34,7 +35,7 @@<br>
class ShortYuv;<br>
struct SPS;<br>
<br>
-class PicYuv<br>
+class PicYuv : public x265_picyuv<br>
{<br>
public:<br>
<br>
diff -r de91aae2db53 -r 6ad93877ffe1 source/encoder/api.cpp<br>
--- a/source/encoder/api.cpp Tue Oct 31 13:57:37 2017 +0530<br>
+++ b/source/encoder/api.cpp Tue Oct 31 16:13:49 2017 +0530<br>
@@ -350,6 +350,15 @@<br>
return -1;<br>
}<br>
<br>
+int x265_get_ref_frame_list(x265_<wbr>encoder *enc, x265_picyuv** l0, x265_picyuv** l1, int sliceType, int poc)<br>
+{<br>
+ if (!enc)<br>
+ return -1;<br>
+<br>
+ Encoder *encoder = static_cast<Encoder*>(enc);<br>
+ return encoder->getRefFrameList((<wbr>PicYuv**)l0, (PicYuv**)l1, sliceType, poc);<br>
+}<br>
+<br>
void x265_cleanup(void)<br>
{<br>
BitCost::destroy();<br>
@@ -424,6 +433,7 @@<br>
&x265_encoder_intra_refresh,<br>
&x265_encoder_ctu_info,<br>
&x265_get_slicetype_poc_and_<wbr>scenecut,<br>
+ &x265_get_ref_frame_list,<br>
};<br>
<br>
typedef const x265_api* (*api_get_func)(int bitDepth);<br>
diff -r de91aae2db53 -r 6ad93877ffe1 source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp Tue Oct 31 13:57:37 2017 +0530<br>
+++ b/source/encoder/encoder.cpp Tue Oct 31 16:13:49 2017 +0530<br>
@@ -446,6 +446,47 @@<br>
return 0;<br>
}<br>
<br>
+int Encoder::getRefFrameList(<wbr>PicYuv** l0, PicYuv** l1, int sliceType, int poc)<br>
+{<br>
+ if (!(IS_X265_TYPE_I(sliceType)))<br>
+ {<br>
+ Frame *framePtr = m_dpb->m_picList.getPOC(poc);<br>
+ if (framePtr != NULL)<br>
+ {<br>
+ for (int j = 0; j < framePtr->m_encData->m_slice-><wbr>m_numRefIdx[0]; j++) // check only for --ref=n number of frames.<br>
+ {<br>
+ if (framePtr->m_encData->m_slice-<wbr>>m_refFrameList[0][j] && framePtr->m_encData->m_slice-><wbr>m_refFrameList[0][j]->m_<wbr>reconPic != NULL)<br>
+ {<br>
+ int l0POC = framePtr->m_encData->m_slice-><wbr>m_refFrameList[0][j]->m_poc;<br>
+ Frame* l0Fp = m_dpb->m_picList.getPOC(l0POC)<wbr>;<br>
+ if (l0Fp->m_reconPic->m_picOrg[0] == NULL)<br>
+ l0Fp->m_reconEncoded.wait(); /* If recon is not ready, current frame encoder need to wait. */<br>
+ l0[j] = l0Fp->m_reconPic;<br>
+ }<br>
+ }<br>
+ for (int j = 0; j < framePtr->m_encData->m_slice-><wbr>m_numRefIdx[1]; j++) // check only for --ref=n number of frames.<br>
+ {<br>
+ if (framePtr->m_encData->m_slice-<wbr>>m_refFrameList[1][j] && framePtr->m_encData->m_slice-><wbr>m_refFrameList[1][j]->m_<wbr>reconPic != NULL)<br>
+ {<br>
+ int l1POC = framePtr->m_encData->m_slice-><wbr>m_refFrameList[1][j]->m_poc;<br>
+ Frame* l1Fp = m_dpb->m_picList.getPOC(l1POC)<wbr>;<br>
+ if (l1Fp->m_reconPic->m_picOrg[0] == NULL)<br>
+ l1Fp->m_reconEncoded.wait(); /* If recon is not ready, current frame encoder need to wait. */<br>
+ l1[j] = l1Fp->m_reconPic;<br>
+ }<br>
+ }<br>
+ }<br>
+ else<br>
+ x265_log(NULL, X265_LOG_WARNING, "Refrence List is not in piclist\n");<br>
+ }<br>
+ else<br>
+ {<br>
+ x265_log(NULL, X265_LOG_ERROR, "I frames does not have a refrence List\n");<br>
+ return -1;<br>
+ }<br>
+ return 0;<br>
+}<br>
+<br>
void Encoder::destroy()<br>
{<br>
#if ENABLE_HDR10_PLUS<br>
diff -r de91aae2db53 -r 6ad93877ffe1 source/encoder/encoder.h<br>
--- a/source/encoder/encoder.h Tue Oct 31 13:57:37 2017 +0530<br>
+++ b/source/encoder/encoder.h Tue Oct 31 16:13:49 2017 +0530<br>
@@ -207,6 +207,8 @@<br>
<br>
int copySlicetypePocAndSceneCut(<wbr>int *slicetype, int *poc, int *sceneCut);<br>
<br>
+ int getRefFrameList(PicYuv** l0, PicYuv** l1, int sliceType, int poc);<br>
+<br>
void getStreamHeaders(NALList& list, Entropy& sbacCoder, Bitstream& bs);<br>
<br>
void fetchStats(x265_stats* stats, size_t statsSizeBytes);<br>
diff -r de91aae2db53 -r 6ad93877ffe1 source/encoder/frameencoder.<wbr>cpp<br>
--- a/source/encoder/frameencoder.<wbr>cpp Tue Oct 31 13:57:37 2017 +0530<br>
+++ b/source/encoder/frameencoder.<wbr>cpp Tue Oct 31 16:13:49 2017 +0530<br>
@@ -337,6 +337,8 @@<br>
}<br>
compressFrame();<br>
m_done.trigger(); /* FrameEncoder::<wbr>getEncodedPicture() blocks for this event */<br>
+ if (m_frame != NULL)<br>
+ m_frame->m_reconEncoded.<wbr>trigger();<br>
m_enable.wait();<br>
}<br>
}<br>
diff -r de91aae2db53 -r 6ad93877ffe1 source/x265.h<br>
--- a/source/x265.h Tue Oct 31 13:57:37 2017 +0530<br>
+++ b/source/x265.h Tue Oct 31 16:13:49 2017 +0530<br>
@@ -35,6 +35,10 @@<br>
* opaque handler for encoder */<br>
typedef struct x265_encoder x265_encoder;<br>
<br>
+/* x265_picyuv:<br>
+ * opaque handler for PicYuv */<br>
+typedef struct x265_picyuv x265_picyuv;<br>
+<br>
/* Application developers planning to link against a shared library version of<br>
* libx265 from a Microsoft Visual Studio or similar development environment<br>
* will need to define X265_API_IMPORTS before including this header.<br>
@@ -1712,6 +1716,11 @@<br>
* This API must be called after(poc >= lookaheadDepth + bframes + 2) condition check */<br>
int x265_get_slicetype_poc_and_<wbr>scenecut(x265_encoder *encoder, int *slicetype, int *poc, int* sceneCut);<br>
<br>
+/* x265_get_ref_frame_list:<br>
+ * returns negative on error, 0 when access unit were output.<br>
+ * This API must be called after(poc >= lookaheadDepth + bframes + 2) condition check */<br>
+int x265_get_ref_frame_list(x265_<wbr>encoder *encoder, x265_picyuv**, x265_picyuv**, int, int);<br>
+<br>
void x265_cleanup(void);<br>
<br>
#define X265_MAJOR_VERSION 1<br>
@@ -1760,6 +1769,7 @@<br>
int (*encoder_intra_refresh)(x265_<wbr>encoder*);<br>
int (*encoder_ctu_info)(x265_<wbr>encoder*, int, x265_ctu_info_t**);<br>
int (*x265_get_slicetype_poc_and_<wbr>scenecut)(x265_encoder*, int*, int*, int*);<br>
+ int (*x265_get_ref_frame_list)(<wbr>x265_encoder*, x265_picyuv**, x265_picyuv**, int, int);<br>
/* add new pointers to the end, or increment X265_MAJOR_VERSION */<br>
} x265_api;<br>
<br>
______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
</blockquote></div><br></div></div>