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.

97 lines
2.6KB

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