error_resilience.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. *
  3. * This file is part of FFmpeg.
  4. *
  5. * FFmpeg is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * FFmpeg is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with FFmpeg; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #ifndef AVCODEC_ERROR_RESILIENCE_H
  20. #define AVCODEC_ERROR_RESILIENCE_H
  21. #include <stdint.h>
  22. #include "avcodec.h"
  23. #include "dsputil.h"
  24. #include "thread.h"
  25. ///< current MB is the first after a resync marker
  26. #define VP_START 1
  27. #define ER_AC_ERROR 2
  28. #define ER_DC_ERROR 4
  29. #define ER_MV_ERROR 8
  30. #define ER_AC_END 16
  31. #define ER_DC_END 32
  32. #define ER_MV_END 64
  33. #define ER_MB_ERROR (ER_AC_ERROR|ER_DC_ERROR|ER_MV_ERROR)
  34. #define ER_MB_END (ER_AC_END|ER_DC_END|ER_MV_END)
  35. typedef struct ERPicture {
  36. AVFrame *f;
  37. ThreadFrame *tf;
  38. // it's the caller's responsibility to allocate these buffers
  39. int16_t (*motion_val[2])[2];
  40. int8_t *ref_index[2];
  41. uint32_t *mb_type;
  42. int field_picture;
  43. } ERPicture;
  44. typedef struct ERContext {
  45. AVCodecContext *avctx;
  46. DSPContext *dsp;
  47. int *mb_index2xy;
  48. int mb_num;
  49. int mb_width, mb_height;
  50. int mb_stride;
  51. int b8_stride;
  52. int error_count, error_occurred;
  53. uint8_t *error_status_table;
  54. uint8_t *er_temp_buffer;
  55. int16_t *dc_val[3];
  56. uint8_t *mbskip_table;
  57. uint8_t *mbintra_table;
  58. int mv[2][4][2];
  59. ERPicture cur_pic;
  60. ERPicture last_pic;
  61. ERPicture next_pic;
  62. AVBufferRef *ref_index_buf[2];
  63. AVBufferRef *motion_val_buf[2];
  64. uint16_t pp_time;
  65. uint16_t pb_time;
  66. int quarter_sample;
  67. int partitioned_frame;
  68. int ref_count;
  69. void (*decode_mb)(void *opaque, int ref, int mv_dir, int mv_type,
  70. int (*mv)[2][4][2],
  71. int mb_x, int mb_y, int mb_intra, int mb_skipped);
  72. void *opaque;
  73. } ERContext;
  74. void ff_er_frame_start(ERContext *s);
  75. void ff_er_frame_end(ERContext *s);
  76. void ff_er_add_slice(ERContext *s, int startx, int starty, int endx, int endy,
  77. int status);
  78. #endif /* AVCODEC_ERROR_RESILIENCE_H */