You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.2KB

  1. /*
  2. * yuv2rgb_mlib.c, Software YUV to RGB coverter using mediaLib
  3. *
  4. * Copyright (C) 2000, HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>
  5. * All Rights Reserved.
  6. *
  7. * This file is part of mpeg2dec, a free MPEG-2 video decoder
  8. *
  9. * mpeg2dec is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2, or (at your option)
  12. * any later version.
  13. *
  14. * mpeg2dec is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with GNU Make; see the file COPYING. If not, write to
  21. * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  22. *
  23. */
  24. #include <mlib_types.h>
  25. #include <mlib_status.h>
  26. #include <mlib_sys.h>
  27. #include <mlib_video.h>
  28. static void mlib_YUV2ARGB420_32(uint8_t* image, uint8_t* py,
  29. uint8_t* pu, uint8_t* pv,
  30. unsigned h_size, unsigned v_size,
  31. unsigned rgb_stride, unsigned y_stride, unsigned uv_stride)
  32. {
  33. mlib_VideoColorYUV2ARGB420(image, py, pu, pv, h_size,
  34. v_size, rgb_stride, y_stride, uv_stride);
  35. }
  36. static void mlib_YUV2ABGR420_32(uint8_t* image, uint8_t* py,
  37. uint8_t* pu, uint8_t* pv,
  38. unsigned h_size, unsigned v_size,
  39. unsigned rgb_stride, unsigned y_stride, unsigned uv_stride)
  40. {
  41. mlib_VideoColorYUV2ABGR420(image, py, pu, pv, h_size,
  42. v_size, rgb_stride, y_stride, uv_stride);
  43. }
  44. static void mlib_YUV2RGB420_24(uint8_t* image, uint8_t* py,
  45. uint8_t* pu, uint8_t* pv,
  46. unsigned h_size, unsigned v_size,
  47. unsigned rgb_stride, unsigned y_stride, unsigned uv_stride)
  48. {
  49. mlib_VideoColorYUV2RGB420(image, py, pu, pv, h_size,
  50. v_size, rgb_stride, y_stride, uv_stride);
  51. }
  52. yuv2rgb_fun yuv2rgb_init_mlib(unsigned bpp, int mode)
  53. {
  54. if( bpp == 24 )
  55. {
  56. if( mode == MODE_RGB )
  57. return mlib_YUV2RGB420_24;
  58. }
  59. if( bpp == 32 )
  60. {
  61. if( mode == MODE_RGB )
  62. return mlib_YUV2ARGB420_32;
  63. else if( mode == MODE_BGR )
  64. return mlib_YUV2ABGR420_32;
  65. }
  66. return NULL;
  67. }