comparison libvo/vosub_vidix.c @ 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 e4497d289c3c
children d97a607821f1
comparison
equal deleted inserted replaced
27397:d47744b95b78 27398:1861074aef60
210 dest += dstrides.y; 210 dest += dstrides.y;
211 } 211 }
212 return 0; 212 return 0;
213 } 213 }
214 214
215 static uint32_t vidix_draw_slice_nv12(uint8_t *image[], int stride[], int w,int h,int x,int y)
216 {
217 uint8_t *src;
218 uint8_t *dest;
219 int i;
220
221 /* Plane Y */
222 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
223 dest += dstrides.y*y + x;
224 src = image[0];
225 for(i=0;i<h;i++){
226 memcpy(dest,src,w);
227 src+=stride[0];
228 dest += dstrides.y;
229 }
230
231 /* Plane UV */
232 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.u;
233 dest += dstrides.u*y/2 + x;
234 src = image[1];
235 for(i=0;i<h/2;i++){
236 memcpy(dest,src,w);
237 src+=stride[1];
238 dest+=dstrides.u;
239 }
240 return 0;
241 }
242
215 static uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) 243 static uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
216 { 244 {
217 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SUB_VIDIX_DummyVidixdrawsliceWasCalled); 245 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SUB_VIDIX_DummyVidixdrawsliceWasCalled);
218 return -1; 246 return -1;
219 } 247 }
252 uint32_t apitch,bespitch; 280 uint32_t apitch,bespitch;
253 char *lvo_mem; 281 char *lvo_mem;
254 lvo_mem = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; 282 lvo_mem = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
255 apitch = vidix_play.dest.pitch.y-1; 283 apitch = vidix_play.dest.pitch.y-1;
256 switch(vidix_play.fourcc){ 284 switch(vidix_play.fourcc){
285 case IMGFMT_NV12:
257 case IMGFMT_YV12: 286 case IMGFMT_YV12:
258 case IMGFMT_IYUV: 287 case IMGFMT_IYUV:
259 case IMGFMT_I420: 288 case IMGFMT_I420:
260 case IMGFMT_YVU9: 289 case IMGFMT_YVU9:
261 case IMGFMT_IF09: 290 case IMGFMT_IF09:
447 /* show one of the "clear" frames */ 476 /* show one of the "clear" frames */
448 vidix_flip_page(); 477 vidix_flip_page();
449 478
450 switch(format) 479 switch(format)
451 { 480 {
481 case IMGFMT_NV12:
452 case IMGFMT_YV12: 482 case IMGFMT_YV12:
453 case IMGFMT_I420: 483 case IMGFMT_I420:
454 case IMGFMT_IYUV: 484 case IMGFMT_IYUV:
455 case IMGFMT_YVU9: 485 case IMGFMT_YVU9:
456 case IMGFMT_IF09: 486 case IMGFMT_IF09:
493 523
494 if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV) 524 if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV)
495 vo_server->draw_slice = vidix_draw_slice_420; 525 vo_server->draw_slice = vidix_draw_slice_420;
496 else if (src_format == IMGFMT_YVU9 || src_format == IMGFMT_IF09) 526 else if (src_format == IMGFMT_YVU9 || src_format == IMGFMT_IF09)
497 vo_server->draw_slice = vidix_draw_slice_410; 527 vo_server->draw_slice = vidix_draw_slice_410;
528 else if (src_format == IMGFMT_NV12)
529 vo_server->draw_slice = vidix_draw_slice_nv12;
498 else vo_server->draw_slice = vidix_draw_slice_packed; 530 else vo_server->draw_slice = vidix_draw_slice_packed;
499 } 531 }
500 return 0; 532 return 0;
501 } 533 }
502 534