yv12config.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef VPX_SCALE_YV12CONFIG_H_
  11. #define VPX_SCALE_YV12CONFIG_H_
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #include "./vpx_config.h"
  16. #include "vpx/vpx_codec.h"
  17. #include "vpx/vpx_frame_buffer.h"
  18. #include "vpx/vpx_integer.h"
  19. #define VP8BORDERINPIXELS 32
  20. #define VP9INNERBORDERINPIXELS 96
  21. #define VP9_INTERP_EXTEND 4
  22. #define VP9_ENC_BORDER_IN_PIXELS 160
  23. #define VP9_DEC_BORDER_IN_PIXELS 32
  24. typedef struct yv12_buffer_config {
  25. int y_width;
  26. int y_height;
  27. int y_crop_width;
  28. int y_crop_height;
  29. int y_stride;
  30. int uv_width;
  31. int uv_height;
  32. int uv_crop_width;
  33. int uv_crop_height;
  34. int uv_stride;
  35. int alpha_width;
  36. int alpha_height;
  37. int alpha_stride;
  38. uint8_t *y_buffer;
  39. uint8_t *u_buffer;
  40. uint8_t *v_buffer;
  41. uint8_t *alpha_buffer;
  42. uint8_t *buffer_alloc;
  43. int buffer_alloc_sz;
  44. int border;
  45. int frame_size;
  46. int subsampling_x;
  47. int subsampling_y;
  48. unsigned int bit_depth;
  49. vpx_color_space_t color_space;
  50. vpx_color_range_t color_range;
  51. int render_width;
  52. int render_height;
  53. int corrupted;
  54. int flags;
  55. } YV12_BUFFER_CONFIG;
  56. #define YV12_FLAG_HIGHBITDEPTH 8
  57. int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
  58. int border);
  59. int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width,
  60. int height, int border);
  61. int vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf);
  62. int vpx_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
  63. int ss_x, int ss_y,
  64. #if CONFIG_VP9_HIGHBITDEPTH
  65. int use_highbitdepth,
  66. #endif
  67. int border, int byte_alignment);
  68. // Updates the yv12 buffer config with the frame buffer. |byte_alignment| must
  69. // be a power of 2, from 32 to 1024. 0 sets legacy alignment. If cb is not
  70. // NULL, then libvpx is using the frame buffer callbacks to handle memory.
  71. // If cb is not NULL, libvpx will call cb with minimum size in bytes needed
  72. // to decode the current frame. If cb is NULL, libvpx will allocate memory
  73. // internally to decode the current frame. Returns 0 on success. Returns < 0
  74. // on failure.
  75. int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
  76. int ss_x, int ss_y,
  77. #if CONFIG_VP9_HIGHBITDEPTH
  78. int use_highbitdepth,
  79. #endif
  80. int border, int byte_alignment,
  81. vpx_codec_frame_buffer_t *fb,
  82. vpx_get_frame_buffer_cb_fn_t cb, void *cb_priv);
  83. int vpx_free_frame_buffer(YV12_BUFFER_CONFIG *ybf);
  84. #ifdef __cplusplus
  85. }
  86. #endif
  87. #endif // VPX_SCALE_YV12CONFIG_H_