image.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*Daala video codec
  2. Copyright (c) 2004-2012 Daala project contributors. All rights reserved.
  3. Redistribution and use in source and binary forms, with or without
  4. modification, are permitted provided that the following conditions are met:
  5. - Redistributions of source code must retain the above copyright notice, this
  6. list of conditions and the following disclaimer.
  7. - Redistributions in binary form must reproduce the above copyright notice,
  8. this list of conditions and the following disclaimer in the documentation
  9. and/or other materials provided with the distribution.
  10. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
  11. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  12. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  13. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
  14. FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  15. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  16. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  17. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  18. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  19. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
  20. #if !defined(_image_H)
  21. # define _image_H (1)
  22. # if !defined(_LARGEFILE_SOURCE)
  23. # define _LARGEFILE_SOURCE
  24. # endif
  25. # if !defined(_LARGEFILE64_SOURCE)
  26. # define _LARGEFILE64_SOURCE
  27. # endif
  28. # if !defined(_FILE_OFFSET_BITS)
  29. # define _FILE_OFFSET_BITS 64
  30. # endif
  31. # include <stdio.h>
  32. typedef unsigned short od_rgba16_pixel[4];
  33. typedef struct od_rgba16_image od_rgba16_image;
  34. struct od_rgba16_image{
  35. od_rgba16_pixel *data;
  36. int stride;
  37. int width;
  38. int height;
  39. };
  40. int od_rgba16_image_read_png(od_rgba16_image *_this,FILE *_fin);
  41. void od_rgba16_image_init(od_rgba16_image *_this,int _width,int _height);
  42. void od_rgba16_image_draw_point(od_rgba16_image *_this,int _x,int _y,
  43. const od_rgba16_pixel _color);
  44. void od_rgba16_image_draw_line(od_rgba16_image *_this,
  45. int _x0,int _y0,int _x1,int _y1,const od_rgba16_pixel _color);
  46. int od_rgba16_image_write_png(const od_rgba16_image *_this,FILE *_fout);
  47. void od_rgba16_image_clear(od_rgba16_image *_this);
  48. #define HUE_MAX (0xFFFF*6)
  49. void od_rgba16_from_hue(od_rgba16_pixel _color,int _hue);
  50. void intra_map_colors(od_rgba16_pixel *_colors,int _mapi_max);
  51. #endif