summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-01-27 14:56:52 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-01-27 14:56:52 +0100
commit3d0411707839d3af1f34e0a8c7c8cbe4dd02b1ba (patch)
treeb8acca47871747e129ca6b33b06ea603fd9c6a9d
parenta1cdd1f08e06582c93fe66eacfc7c09e42321115 (diff)
parentcf1e0786ed64e69614760bfb4ecd7adbde8e6094 (diff)
downloadffmpeg-streaming-3d0411707839d3af1f34e0a8c7c8cbe4dd02b1ba.zip
ffmpeg-streaming-3d0411707839d3af1f34e0a8c7c8cbe4dd02b1ba.tar.gz
Merge commit 'cf1e0786ed64e69614760bfb4ecd7adbde8e6094'
* commit 'cf1e0786ed64e69614760bfb4ecd7adbde8e6094': error_resilience: move the MECmpContext initialization into ER code Conflicts: libavcodec/error_resilience.c libavcodec/h264.c libavcodec/h264.h libavcodec/h264_slice.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/error_resilience.c16
-rw-r--r--libavcodec/error_resilience.h3
-rw-r--r--libavcodec/h264.c5
-rw-r--r--libavcodec/h264.h2
-rw-r--r--libavcodec/h264_slice.c3
-rw-r--r--libavcodec/mpegvideo.c2
6 files changed, 13 insertions, 18 deletions
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 2a4de43..4fa7bc4 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -30,6 +30,7 @@
#include "libavutil/internal.h"
#include "avcodec.h"
#include "error_resilience.h"
+#include "me_cmp.h"
#include "mpegutils.h"
#include "mpegvideo.h"
#include "rectangle.h"
@@ -736,12 +737,12 @@ static int is_intra_more_likely(ERContext *s)
} else {
ff_thread_await_progress(s->last_pic.tf, mb_y, 0);
}
- is_intra_likely += s->mecc->sad[0](NULL, last_mb_ptr, mb_ptr,
- linesize[0], 16);
+ is_intra_likely += s->mecc.sad[0](NULL, last_mb_ptr, mb_ptr,
+ linesize[0], 16);
// FIXME need await_progress() here
- is_intra_likely -= s->mecc->sad[0](NULL, last_mb_ptr,
- last_mb_ptr + linesize[0] * 16,
- linesize[0], 16);
+ is_intra_likely -= s->mecc.sad[0](NULL, last_mb_ptr,
+ last_mb_ptr + linesize[0] * 16,
+ linesize[0], 16);
} else {
if (IS_INTRA(s->cur_pic.mb_type[mb_xy]))
is_intra_likely++;
@@ -759,6 +760,11 @@ void ff_er_frame_start(ERContext *s)
if (!s->avctx->error_concealment)
return;
+ if (!s->mecc_inited) {
+ ff_me_cmp_init(&s->mecc, s->avctx);
+ s->mecc_inited = 1;
+ }
+
memset(s->error_status_table, ER_MB_ERROR | VP_START | ER_MB_END,
s->mb_stride * s->mb_height * sizeof(uint8_t));
s->error_count = 3 * s->mb_num;
diff --git a/libavcodec/error_resilience.h b/libavcodec/error_resilience.h
index 171af08..4e00863 100644
--- a/libavcodec/error_resilience.h
+++ b/libavcodec/error_resilience.h
@@ -52,7 +52,8 @@ typedef struct ERPicture {
typedef struct ERContext {
AVCodecContext *avctx;
- MECmpContext *mecc;
+ MECmpContext mecc;
+ int mecc_inited;
int *mb_index2xy;
int mb_num;
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 35473df..a54124c 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -515,7 +515,6 @@ int ff_h264_context_init(H264Context *h)
if (CONFIG_ERROR_RESILIENCE) {
/* init ER */
er->avctx = h->avctx;
- er->mecc = &h->mecc;
er->decode_mb = h264_er_decode_mb;
er->opaque = h;
er->quarter_sample = 1;
@@ -652,8 +651,6 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
h->current_sps_id = -1;
/* needed so that IDCT permutation is known early */
- if (CONFIG_ERROR_RESILIENCE)
- ff_me_cmp_init(&h->mecc, h->avctx);
ff_videodsp_init(&h->vdsp, 8);
memset(h->pps.scaling_matrix4, 16, 6 * 16 * sizeof(uint8_t));
@@ -1272,8 +1269,6 @@ int ff_h264_set_parameter_from_sps(H264Context *h)
ff_h264_pred_init(&h->hpc, h->avctx->codec_id, h->sps.bit_depth_luma,
h->sps.chroma_format_idc);
- if (CONFIG_ERROR_RESILIENCE)
- ff_me_cmp_init(&h->mecc, h->avctx);
ff_videodsp_init(&h->vdsp, h->sps.bit_depth_luma);
} else {
av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth %d\n",
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index cf4998f..f4fa209 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -37,7 +37,6 @@
#include "h264pred.h"
#include "h264qpel.h"
#include "internal.h" // for avpriv_find_start_code()
-#include "me_cmp.h"
#include "mpegutils.h"
#include "parser.h"
#include "qpeldsp.h"
@@ -340,7 +339,6 @@ typedef struct H264Picture {
typedef struct H264Context {
AVClass *av_class;
AVCodecContext *avctx;
- MECmpContext mecc;
VideoDSPContext vdsp;
H264DSPContext h264dsp;
H264ChromaContext h264chroma;
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 6d19c73..c7e6dd3 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1207,9 +1207,6 @@ static int h264_slice_header_init(H264Context *h, int reinit)
goto fail;
}
c->avctx = h->avctx;
- if (CONFIG_ERROR_RESILIENCE) {
- c->mecc = h->mecc;
- }
c->vdsp = h->vdsp;
c->h264dsp = h->h264dsp;
c->h264qpel = h->h264qpel;
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 6966572..eadca4b 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -384,7 +384,6 @@ static av_cold int dct_init(MpegEncContext *s)
ff_blockdsp_init(&s->bdsp, s->avctx);
ff_h264chroma_init(&s->h264chroma, 8); //for lowres
ff_hpeldsp_init(&s->hdsp, s->avctx->flags);
- ff_me_cmp_init(&s->mecc, s->avctx);
ff_mpegvideodsp_init(&s->mdsp);
ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample);
@@ -1139,7 +1138,6 @@ static int init_er(MpegEncContext *s)
int i;
er->avctx = s->avctx;
- er->mecc = &s->mecc;
er->mb_index2xy = s->mb_index2xy;
er->mb_num = s->mb_num;
OpenPOWER on IntegriCloud