Mercurial > mplayer.hg
comparison libmpcodecs/vf_spp.c @ 11307:487bf0179498
autoq
support all planar YUV variants (untested, probably buggy)
author | michael |
---|---|
date | Tue, 28 Oct 2003 14:00:07 +0000 |
parents | d1585f7d5366 |
children | 0c8d12a58a29 |
comparison
equal
deleted
inserted
replaced
11306:d3c53b565ac8 | 11307:487bf0179498 |
---|---|
267 static void (*requantize)(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation)= requantize_c; | 267 static void (*requantize)(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation)= requantize_c; |
268 | 268 |
269 static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, uint8_t *qp_store, int qp_stride, int is_luma){ | 269 static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, uint8_t *qp_store, int qp_stride, int is_luma){ |
270 int x, y, i; | 270 int x, y, i; |
271 const int count= 1<<p->log2_count; | 271 const int count= 1<<p->log2_count; |
272 const int stride= is_luma ? p->temp_stride : (p->temp_stride/2 + 8); | 272 const int stride= is_luma ? p->temp_stride : ((width+16+15)&(~15)); |
273 uint64_t block_align[32]; | 273 uint64_t block_align[32]; |
274 DCTELEM *block = (DCTELEM *)block_align; | 274 DCTELEM *block = (DCTELEM *)block_align; |
275 DCTELEM *block2= (DCTELEM *)(block_align+16); | 275 DCTELEM *block2= (DCTELEM *)(block_align+16); |
276 | 276 |
277 for(y=0; y<height; y++){ | 277 for(y=0; y<height; y++){ |
361 mp_image_t *dmpi; | 361 mp_image_t *dmpi; |
362 | 362 |
363 if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ | 363 if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ |
364 // no DR, so get a new image! hope we'll get DR buffer: | 364 // no DR, so get a new image! hope we'll get DR buffer: |
365 vf->dmpi=vf_get_image(vf->next,vf->priv->outfmt, | 365 vf->dmpi=vf_get_image(vf->next,vf->priv->outfmt, |
366 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, | 366 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE, |
367 mpi->w,mpi->h); | 367 mpi->w,mpi->h); |
368 } | 368 } |
369 | 369 |
370 dmpi= vf->dmpi; | 370 dmpi= vf->dmpi; |
371 | 371 |
372 vf->priv->mpeg2= mpi->qscale_type; | 372 vf->priv->mpeg2= mpi->qscale_type; |
373 | 373 if(vf->priv->log2_count || !(mpi->flags&MP_IMGFLAG_DIRECT)){ |
374 filter(vf->priv, dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, mpi->qscale, mpi->qstride, 1); | 374 filter(vf->priv, dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, mpi->qscale, mpi->qstride, 1); |
375 filter(vf->priv, dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w>>1, mpi->h>>1, mpi->qscale, mpi->qstride, 0); | 375 filter(vf->priv, dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, mpi->qscale, mpi->qstride, 0); |
376 filter(vf->priv, dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w>>1, mpi->h>>1, mpi->qscale, mpi->qstride, 0); | 376 filter(vf->priv, dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, mpi->qscale, mpi->qstride, 0); |
377 | 377 } |
378 vf_clone_mpi_attributes(dmpi, mpi); | 378 vf_clone_mpi_attributes(dmpi, mpi); |
379 | 379 |
380 #ifdef HAVE_MMX | 380 #ifdef HAVE_MMX |
381 if(gCpuCaps.hasMMX) asm volatile ("emms\n\t"); | 381 if(gCpuCaps.hasMMX) asm volatile ("emms\n\t"); |
382 #endif | 382 #endif |
400 free(vf->priv); | 400 free(vf->priv); |
401 vf->priv=NULL; | 401 vf->priv=NULL; |
402 } | 402 } |
403 | 403 |
404 //===========================================================================// | 404 //===========================================================================// |
405 | |
406 static int query_format(struct vf_instance_s* vf, unsigned int fmt){ | 405 static int query_format(struct vf_instance_s* vf, unsigned int fmt){ |
407 switch(fmt) | 406 switch(fmt){ |
408 { | 407 case IMGFMT_YVU9: |
408 case IMGFMT_IF09: | |
409 case IMGFMT_YV12: | 409 case IMGFMT_YV12: |
410 case IMGFMT_I420: | 410 case IMGFMT_I420: |
411 case IMGFMT_IYUV: | 411 case IMGFMT_IYUV: |
412 return vf_next_query_format(vf,vf->priv->outfmt); | 412 case IMGFMT_CLPL: |
413 } | 413 case IMGFMT_Y800: |
414 return 0; | 414 case IMGFMT_Y8: |
415 case IMGFMT_NV12: | |
416 case IMGFMT_444P: | |
417 case IMGFMT_422P: | |
418 case IMGFMT_411P: | |
419 return vf_next_query_format(vf,fmt); | |
420 } | |
421 return 0; | |
415 } | 422 } |
416 | 423 |
417 static unsigned int fmt_list[]={ | 424 static unsigned int fmt_list[]={ |
418 IMGFMT_YV12, | 425 IMGFMT_YVU9, |
419 IMGFMT_I420, | 426 IMGFMT_IF09, |
420 IMGFMT_IYUV, | 427 IMGFMT_YV12, |
421 0 | 428 IMGFMT_I420, |
429 IMGFMT_IYUV, | |
430 IMGFMT_CLPL, | |
431 IMGFMT_Y800, | |
432 IMGFMT_Y8, | |
433 IMGFMT_NV12, | |
434 IMGFMT_444P, | |
435 IMGFMT_422P, | |
436 IMGFMT_411P, | |
437 0 | |
422 }; | 438 }; |
439 | |
440 static int control(struct vf_instance_s* vf, int request, void* data){ | |
441 switch(request){ | |
442 case VFCTRL_QUERY_MAX_PP_LEVEL: | |
443 return 6; | |
444 case VFCTRL_SET_PP_LEVEL: | |
445 vf->priv->log2_count= *((unsigned int*)data); | |
446 return CONTROL_TRUE; | |
447 } | |
448 return vf_next_control(vf,request,data); | |
449 } | |
423 | 450 |
424 static int open(vf_instance_t *vf, char* args){ | 451 static int open(vf_instance_t *vf, char* args){ |
425 vf->config=config; | 452 vf->config=config; |
426 vf->put_image=put_image; | 453 vf->put_image=put_image; |
427 vf->get_image=get_image; | 454 vf->get_image=get_image; |
428 vf->query_format=query_format; | 455 vf->query_format=query_format; |
429 vf->uninit=uninit; | 456 vf->uninit=uninit; |
457 vf->control= control; | |
430 vf->priv=malloc(sizeof(struct vf_priv_s)); | 458 vf->priv=malloc(sizeof(struct vf_priv_s)); |
431 memset(vf->priv, 0, sizeof(struct vf_priv_s)); | 459 memset(vf->priv, 0, sizeof(struct vf_priv_s)); |
432 | 460 |
433 avcodec_init(); | 461 avcodec_init(); |
434 | 462 |
439 store_slice= store_slice_mmx; | 467 store_slice= store_slice_mmx; |
440 requantize= requantize_mmx; | 468 requantize= requantize_mmx; |
441 } | 469 } |
442 #endif | 470 #endif |
443 | 471 |
444 vf->priv->log2_count= 6; | 472 vf->priv->log2_count= 3; |
445 | 473 |
446 if (args) sscanf(args, "%d:%d", &vf->priv->log2_count, &vf->priv->qp); | 474 if (args) sscanf(args, "%d:%d", &vf->priv->log2_count, &vf->priv->qp); |
447 | 475 |
448 // check csp: | 476 // check csp: |
449 vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12); | 477 vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12); |