yv12config.h 3.1 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. int corrupted;
  51. int flags;
  52. } YV12_BUFFER_CONFIG;
  53. #define YV12_FLAG_HIGHBITDEPTH 8
  54. int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
  55. int width, int height, int border);
  56. int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
  57. int width, int height, int border);
  58. int vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf);
  59. int vp9_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
  60. int width, int height, int ss_x, int ss_y,
  61. #if CONFIG_VP9_HIGHBITDEPTH
  62. int use_highbitdepth,
  63. #endif
  64. int border, int byte_alignment);
  65. // Updates the yv12 buffer config with the frame buffer. |byte_alignment| must
  66. // be a power of 2, from 32 to 1024. 0 sets legacy alignment. If cb is not
  67. // NULL, then libvpx is using the frame buffer callbacks to handle memory.
  68. // If cb is not NULL, libvpx will call cb with minimum size in bytes needed
  69. // to decode the current frame. If cb is NULL, libvpx will allocate memory
  70. // internally to decode the current frame. Returns 0 on success. Returns < 0
  71. // on failure.
  72. int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
  73. int width, int height, int ss_x, int ss_y,
  74. #if CONFIG_VP9_HIGHBITDEPTH
  75. int use_highbitdepth,
  76. #endif
  77. int border,
  78. int byte_alignment,
  79. vpx_codec_frame_buffer_t *fb,
  80. vpx_get_frame_buffer_cb_fn_t cb,
  81. void *cb_priv);
  82. int vp9_free_frame_buffer(YV12_BUFFER_CONFIG *ybf);
  83. #ifdef __cplusplus
  84. }
  85. #endif
  86. #endif // VPX_SCALE_YV12CONFIG_H_