Commit e2c8f2a9 authored by Simon Morlat's avatar Simon Morlat

generalize the use of YuvBufAllocator

parent 5edf966f
......@@ -276,7 +276,7 @@ MS2_PUBLIC void deinterlace_and_rotate_180_neon(uint8_t* ysrc, uint8_t* cbcrsrc,
void deinterlace_down_scale_and_rotate_180_neon(uint8_t* ysrc, uint8_t* cbcrsrc, uint8_t* ydst, uint8_t* udst, uint8_t* vdst, int w, int h, int y_byte_per_row,int cbcr_byte_per_row,bool_t down_scale);
void deinterlace_down_scale_neon(uint8_t* ysrc, uint8_t* cbcrsrc, uint8_t* ydst, uint8_t* u_dst, uint8_t* v_dst, int w, int h, int y_byte_per_row,int cbcr_byte_per_row,bool_t down_scale);
#endif
MS2_PUBLIC mblk_t *copy_ycbcrbiplanar_to_true_yuv_with_rotation_and_down_scale_by_2(uint8_t* y, uint8_t * cbcr, int rotation, int w, int h, int y_byte_per_row,int cbcr_byte_per_row, bool_t uFirstvSecond, bool_t down_scale);
MS2_PUBLIC mblk_t *copy_ycbcrbiplanar_to_true_yuv_with_rotation_and_down_scale_by_2(MSYuvBufAllocator *allocator, const uint8_t* y, const uint8_t * cbcr, int rotation, int w, int h, int y_byte_per_row,int cbcr_byte_per_row, bool_t uFirstvSecond, bool_t down_scale);
static MS2_INLINE MSVideoSize ms_video_size_make(int width, int height){
MSVideoSize vsize={width,height};
......@@ -351,7 +351,7 @@ MS2_PUBLIC void ms_scaler_context_free(MSScalerContext *ctx);
MS2_PUBLIC void ms_video_set_scaler_impl(MSScalerDesc *desc);
MS2_PUBLIC mblk_t *copy_ycbcrbiplanar_to_true_yuv_with_rotation(uint8_t* y, uint8_t* cbcr, int rotation, int w, int h, int y_byte_per_row,int cbcr_byte_per_row, bool_t uFirstvSecond);
MS2_PUBLIC mblk_t *copy_ycbcrbiplanar_to_true_yuv_with_rotation(MSYuvBufAllocator *allocator, const uint8_t* y, const uint8_t* cbcr, int rotation, int w, int h, int y_byte_per_row,int cbcr_byte_per_row, bool_t uFirstvSecond);
/*** Encoder Helpers ***/
/* Frame rate controller */
......
......@@ -621,7 +621,7 @@ void ms_video_set_scaler_impl(MSScalerDesc *desc){
}
/* Can rotate Y, U or V plane; use step=2 for interleaved UV planes otherwise step=1*/
static void rotate_plane(int wDest, int hDest, int full_width, uint8_t* src, uint8_t* dst, int step, bool_t clockWise) {
static void rotate_plane(int wDest, int hDest, int full_width, const uint8_t* src, uint8_t* dst, int step, bool_t clockWise) {
int hSrc = wDest;
int wSrc = hDest;
int src_stride = full_width * step;
......@@ -669,19 +669,19 @@ static int hasNeon = 0;
#endif
/* Destination and source images may have their dimensions inverted.*/
mblk_t *copy_ycbcrbiplanar_to_true_yuv_with_rotation_and_down_scale_by_2(uint8_t* y, uint8_t * cbcr, int rotation, int w, int h, int y_byte_per_row,int cbcr_byte_per_row, bool_t uFirstvSecond, bool_t down_scale) {
mblk_t *copy_ycbcrbiplanar_to_true_yuv_with_rotation_and_down_scale_by_2(MSYuvBufAllocator *allocator, const uint8_t* y, const uint8_t * cbcr, int rotation, int w, int h, int y_byte_per_row,int cbcr_byte_per_row, bool_t uFirstvSecond, bool_t down_scale) {
MSPicture pict;
int uv_w;
int uv_h;
uint8_t* ysrc;
const uint8_t* ysrc;
uint8_t* ydst;
uint8_t* uvsrc;
uint8_t* srcu;
const uint8_t* uvsrc;
const uint8_t* srcu;
uint8_t* dstu;
uint8_t* srcv;
const uint8_t* srcv;
uint8_t* dstv;
mblk_t *yuv_block = ms_yuv_buf_alloc(&pict, w, h);
mblk_t *yuv_block = ms_yuv_buf_allocator_get(allocator, &pict, w, h);
#ifdef ANDROID
if (hasNeon == -1) {
......@@ -791,8 +791,8 @@ mblk_t *copy_ycbcrbiplanar_to_true_yuv_with_rotation_and_down_scale_by_2(uint8_t
return yuv_block;
}
mblk_t *copy_ycbcrbiplanar_to_true_yuv_with_rotation(uint8_t* y, uint8_t * cbcr, int rotation, int w, int h, int y_byte_per_row,int cbcr_byte_per_row, bool_t uFirstvSecond) {
return copy_ycbcrbiplanar_to_true_yuv_with_rotation_and_down_scale_by_2(y, cbcr, rotation, w, h, y_byte_per_row, cbcr_byte_per_row, uFirstvSecond, FALSE);
mblk_t *copy_ycbcrbiplanar_to_true_yuv_with_rotation(MSYuvBufAllocator *allocator, const uint8_t* y, const uint8_t * cbcr, int rotation, int w, int h, int y_byte_per_row,int cbcr_byte_per_row, bool_t uFirstvSecond) {
return copy_ycbcrbiplanar_to_true_yuv_with_rotation_and_down_scale_by_2(allocator, y, cbcr, rotation, w, h, y_byte_per_row, cbcr_byte_per_row, uFirstvSecond, FALSE);
}
void ms_video_init_framerate_controller(MSFrameRateController* ctrl, float fps) {
......
......@@ -71,6 +71,7 @@ static void test_video_processing (void) {
int crcb_bytes_per_row = src_size.width/2 + (src_size.width/2)%32 ;
uint8_t* cbcr = (uint8_t*)ms_malloc(crcb_bytes_per_row*src_size.height);
int i,j;
MSYuvBufAllocator *yba = ms_yuv_buf_allocator_new();
for (i=0;i<src_size.height*src_size.width;i++) {
y[i]=i%256;
......@@ -79,7 +80,7 @@ static void test_video_processing (void) {
cbcr[i]=i%256;
}
yuv_block2 = copy_ycbcrbiplanar_to_true_yuv_with_rotation_and_down_scale_by_2( y
yuv_block2 = copy_ycbcrbiplanar_to_true_yuv_with_rotation_and_down_scale_by_2(yba, y
,cbcr
,0
, src_size.width
......@@ -123,9 +124,10 @@ static void test_video_processing (void) {
break;
}
}
freemsg(yuv_block2);
ms_free(y);
ms_free(cbcr);
ms_yuv_buf_allocator_free(yba);
}
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment