<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Mar 15, 2014 at 12:16 AM, Yu Xiaolei <span dir="ltr"><<a href="mailto:dreifachstein@gmail.com" target="_blank">dreifachstein@gmail.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">This eliminates an extra copy when recording from android camera preview data<br>
<br>
---<br>
common/frame.c | 8 ++++++++<br>
common/mc.c | 12 ++++++++++++<br>
common/mc.h | 1 +<br>
x264.h | 23 ++++++++++++-----------<br>
4 files changed, 33 insertions(+), 11 deletions(-)<br>
<br>
diff --git a/common/frame.c b/common/frame.c<br>
index 4b4a69f..f21368b 100644<br>
--- a/common/frame.c<br>
+++ b/common/frame.c<br>
@@ -49,6 +49,7 @@ static int x264_frame_internal_csp( int external_csp )<br>
case X264_CSP_NV12:<br>
case X264_CSP_I420:<br>
case X264_CSP_YV12:<br>
+ case X264_CSP_NV21:<br>
return X264_CSP_NV12;<br>
case X264_CSP_NV16:<br>
case X264_CSP_I422:<br>
@@ -435,6 +436,13 @@ int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src )<br>
h->mc.plane_copy( dst->plane[1], dst->i_stride[1], (pixel*)pix[1],<br>
stride[1]/sizeof(pixel), h->param.i_width, h->param.i_height>>v_shift );<br>
}<br>
+ else if ( i_csp == X264_CSP_NV21 )<br>
+ {<br>
+ get_plane_ptr( h, src, &pix[1], &stride[1], 1, 0, v_shift );<br>
+ h->mc.plane_copy_swap( dst->plane[1], dst->i_stride[1], (pixel*)pix[1],<br>
+ stride[1]/sizeof(pixel), h->param.i_width, h->param.i_height>>v_shift );<br>
+<br>
+ }<br></blockquote><div><br></div><div>I think :</div><div><br></div><div>stride[1]/sizeof(pixel), h->param.i_width, h->param.i_height>>v_shift );<br></div><div><br></div><div>should be:</div><div><br>
</div><div>stride[1]/sizeof(pixel), h->param.i_width>>1, h->param.i_height>>v_shift );<br></div><div><br></div><div><br></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">
diff --git a/x264.h b/x264.h<br>
index 2e4a98d..77d9ce4 100644<br>
--- a/x264.h<br>
+++ b/x264.h<br>
@@ -41,7 +41,7 @@<br>
<br>
#include "x264_config.h"<br>
<br>
-#define X264_BUILD 142<br>
+#define X264_BUILD 143<br>
<br>
/* Application developers planning to link against a shared library version of<br>
* libx264 from a Microsoft Visual Studio or similar development environment<br>
@@ -212,16 +212,17 @@ static const char * const x264_nal_hrd_names[] = { "none", "vbr", "cbr", 0 };<br>
#define X264_CSP_I420 0x0001 /* yuv 4:2:0 planar */<br>
#define X264_CSP_YV12 0x0002 /* yvu 4:2:0 planar */<br>
#define X264_CSP_NV12 0x0003 /* yuv 4:2:0, with one y plane and one packed u+v */<br>
-#define X264_CSP_I422 0x0004 /* yuv 4:2:2 planar */<br>
-#define X264_CSP_YV16 0x0005 /* yvu 4:2:2 planar */<br>
-#define X264_CSP_NV16 0x0006 /* yuv 4:2:2, with one y plane and one packed u+v */<br>
-#define X264_CSP_V210 0x0007 /* 10-bit yuv 4:2:2 packed in 32 */<br>
-#define X264_CSP_I444 0x0008 /* yuv 4:4:4 planar */<br>
-#define X264_CSP_YV24 0x0009 /* yvu 4:4:4 planar */<br>
-#define X264_CSP_BGR 0x000a /* packed bgr 24bits */<br>
-#define X264_CSP_BGRA 0x000b /* packed bgr 32bits */<br>
-#define X264_CSP_RGB 0x000c /* packed rgb 24bits */<br>
-#define X264_CSP_MAX 0x000d /* end of list */<br>
+#define X264_CSP_NV21 0x0004 /* yuv 4:2:0, with one y plane and one packed v+u */<br>
+#define X264_CSP_I422 0x0005 /* yuv 4:2:2 planar */<br>
+#define X264_CSP_YV16 0x0006 /* yvu 4:2:2 planar */<br>
+#define X264_CSP_NV16 0x0007 /* yuv 4:2:2, with one y plane and one packed u+v */<br>
+#define X264_CSP_V210 0x0008 /* 10-bit yuv 4:2:2 packed in 32 */<br>
+#define X264_CSP_I444 0x0009 /* yuv 4:4:4 planar */<br>
+#define X264_CSP_YV24 0x000a /* yvu 4:4:4 planar */<br>
+#define X264_CSP_BGR 0x000b /* packed bgr 24bits */<br>
+#define X264_CSP_BGRA 0x000c /* packed bgr 32bits */<br>
+#define X264_CSP_RGB 0x000d /* packed rgb 24bits */<br>
+#define X264_CSP_MAX 0x000e /* end of list */<br>
#define X264_CSP_VFLIP 0x1000 /* the csp is vertically flipped */<br>
#define X264_CSP_HIGH_DEPTH 0x2000 /* the csp has a depth of 16 bits per pixel component */<br>
<span class=""><font color="#888888"><br></font></span></blockquote><div><br></div><div>You need not modify the definition of other X264_CSP_XXXs, you just append X264_CSP_NV21 before X264_CSP_MAX.</div><div> </div></div>
-----------------------------------------------------------------------------------------<br>My key fingerprint: d1:03:f5:32:26:ff:d7:3c:e4:42:e3:51:ec:92:78:b2
</div></div>