2013-02-02 20:42:07 +01:00
|
|
|
/*
|
|
|
|
*
|
2013-02-16 18:46:28 +01:00
|
|
|
* This file is part of FFmpeg.
|
2013-02-02 20:42:07 +01:00
|
|
|
*
|
2013-02-16 18:46:28 +01:00
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2013-02-02 20:42:07 +01:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
2013-02-16 18:46:28 +01:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2013-02-02 20:42:07 +01:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2013-02-16 18:46:28 +01:00
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2013-02-02 20:42:07 +01:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef AVCODEC_ERROR_RESILIENCE_H
|
|
|
|
#define AVCODEC_ERROR_RESILIENCE_H
|
|
|
|
|
2013-02-16 20:58:18 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "avcodec.h"
|
2014-02-08 02:59:58 +01:00
|
|
|
#include "me_cmp.h"
|
2014-02-28 11:31:56 +01:00
|
|
|
#include "thread.h"
|
2013-02-16 20:58:18 +01:00
|
|
|
|
2013-02-02 20:42:07 +01:00
|
|
|
///< current MB is the first after a resync marker
|
|
|
|
#define VP_START 1
|
|
|
|
#define ER_AC_ERROR 2
|
|
|
|
#define ER_DC_ERROR 4
|
|
|
|
#define ER_MV_ERROR 8
|
|
|
|
#define ER_AC_END 16
|
|
|
|
#define ER_DC_END 32
|
|
|
|
#define ER_MV_END 64
|
|
|
|
|
|
|
|
#define ER_MB_ERROR (ER_AC_ERROR|ER_DC_ERROR|ER_MV_ERROR)
|
|
|
|
#define ER_MB_END (ER_AC_END|ER_DC_END|ER_MV_END)
|
|
|
|
|
2014-02-28 11:31:56 +01:00
|
|
|
typedef struct ERPicture {
|
|
|
|
AVFrame *f;
|
|
|
|
ThreadFrame *tf;
|
|
|
|
|
2014-04-14 22:35:25 +02:00
|
|
|
// it's the caller's responsibility to allocate these buffers
|
2014-02-28 11:31:56 +01:00
|
|
|
int16_t (*motion_val[2])[2];
|
|
|
|
int8_t *ref_index[2];
|
|
|
|
|
|
|
|
uint32_t *mb_type;
|
|
|
|
int field_picture;
|
|
|
|
} ERPicture;
|
|
|
|
|
2013-02-02 20:42:07 +01:00
|
|
|
typedef struct ERContext {
|
|
|
|
AVCodecContext *avctx;
|
2015-01-17 17:16:20 +01:00
|
|
|
MECmpContext mecc;
|
|
|
|
int mecc_inited;
|
2013-02-02 20:42:07 +01:00
|
|
|
|
|
|
|
int *mb_index2xy;
|
|
|
|
int mb_num;
|
|
|
|
int mb_width, mb_height;
|
|
|
|
int mb_stride;
|
|
|
|
int b8_stride;
|
|
|
|
|
|
|
|
int error_count, error_occurred;
|
|
|
|
uint8_t *error_status_table;
|
|
|
|
uint8_t *er_temp_buffer;
|
|
|
|
int16_t *dc_val[3];
|
|
|
|
uint8_t *mbskip_table;
|
|
|
|
uint8_t *mbintra_table;
|
|
|
|
int mv[2][4][2];
|
|
|
|
|
2014-02-28 11:31:56 +01:00
|
|
|
ERPicture cur_pic;
|
|
|
|
ERPicture last_pic;
|
|
|
|
ERPicture next_pic;
|
2013-02-02 20:42:07 +01:00
|
|
|
|
2014-03-17 05:22:20 +01:00
|
|
|
AVBufferRef *ref_index_buf[2];
|
|
|
|
AVBufferRef *motion_val_buf[2];
|
|
|
|
|
2013-02-02 20:42:07 +01:00
|
|
|
uint16_t pp_time;
|
|
|
|
uint16_t pb_time;
|
|
|
|
int quarter_sample;
|
|
|
|
int partitioned_frame;
|
|
|
|
int ref_count;
|
|
|
|
|
|
|
|
void (*decode_mb)(void *opaque, int ref, int mv_dir, int mv_type,
|
|
|
|
int (*mv)[2][4][2],
|
|
|
|
int mb_x, int mb_y, int mb_intra, int mb_skipped);
|
|
|
|
void *opaque;
|
|
|
|
} ERContext;
|
|
|
|
|
|
|
|
void ff_er_frame_start(ERContext *s);
|
|
|
|
void ff_er_frame_end(ERContext *s);
|
|
|
|
void ff_er_add_slice(ERContext *s, int startx, int starty, int endx, int endy,
|
|
|
|
int status);
|
|
|
|
|
|
|
|
#endif /* AVCODEC_ERROR_RESILIENCE_H */
|