Mercurial > mplayer.hg
changeset 27398:1861074aef60
Add NV12 colorspace support to VIDIX driver.
patch by Magnus Damm <magnus dot damm at gmail dot com>
author | ben |
---|---|
date | Thu, 07 Aug 2008 12:28:28 +0000 |
parents | d47744b95b78 |
children | eb9b0b46009d |
files | libvo/vosub_vidix.c vidix/fourcc.h |
diffstat | 2 files changed, 33 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/vosub_vidix.c Thu Aug 07 12:20:50 2008 +0000 +++ b/libvo/vosub_vidix.c Thu Aug 07 12:28:28 2008 +0000 @@ -212,6 +212,34 @@ return 0; } +static uint32_t vidix_draw_slice_nv12(uint8_t *image[], int stride[], int w,int h,int x,int y) +{ + uint8_t *src; + uint8_t *dest; + int i; + + /* Plane Y */ + dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; + dest += dstrides.y*y + x; + src = image[0]; + for(i=0;i<h;i++){ + memcpy(dest,src,w); + src+=stride[0]; + dest += dstrides.y; + } + + /* Plane UV */ + dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.u; + dest += dstrides.u*y/2 + x; + src = image[1]; + for(i=0;i<h/2;i++){ + memcpy(dest,src,w); + src+=stride[1]; + dest+=dstrides.u; + } + return 0; +} + static uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) { mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SUB_VIDIX_DummyVidixdrawsliceWasCalled); @@ -254,6 +282,7 @@ lvo_mem = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; apitch = vidix_play.dest.pitch.y-1; switch(vidix_play.fourcc){ + case IMGFMT_NV12: case IMGFMT_YV12: case IMGFMT_IYUV: case IMGFMT_I420: @@ -449,6 +478,7 @@ switch(format) { + case IMGFMT_NV12: case IMGFMT_YV12: case IMGFMT_I420: case IMGFMT_IYUV: @@ -495,6 +525,8 @@ vo_server->draw_slice = vidix_draw_slice_420; else if (src_format == IMGFMT_YVU9 || src_format == IMGFMT_IF09) vo_server->draw_slice = vidix_draw_slice_410; + else if (src_format == IMGFMT_NV12) + vo_server->draw_slice = vidix_draw_slice_nv12; else vo_server->draw_slice = vidix_draw_slice_packed; } return 0;
--- a/vidix/fourcc.h Thu Aug 07 12:20:50 2008 +0000 +++ b/vidix/fourcc.h Thu Aug 07 12:28:28 2008 +0000 @@ -51,6 +51,7 @@ #define IMGFMT_YV12 vid_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */ #define IMGFMT_I420 vid_fourcc('I','4','2','0') /* 12 YUV 4:2:0 */ #define IMGFMT_IYUV vid_fourcc('I','Y','U','V') /* 12 YUV 4:2:0 */ +#define IMGFMT_NV12 vid_fourcc('N','V','1','2') #define IMGFMT_CLPL vid_fourcc('C','L','P','L') /* 12 */ #define IMGFMT_Y800 vid_fourcc('Y','8','0','0') /* 8 Y Grayscale */ #define IMGFMT_Y8 vid_fourcc('Y','8',' ',' ') /* 8 Y Grayscale */