diff options
author | Diego Biurrun <diego@biurrun.de> | 2014-06-20 06:05:45 -0700 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2014-06-22 17:36:37 -0700 |
commit | 7b9ef8d701c319c26f7d0664fe977e176764c74e (patch) | |
tree | 651afd8b680afd86e1aca7d6c89fe27514bb9d20 /libavcodec | |
parent | f2f2e7627f0c878d13275af5d166ec5932665e28 (diff) | |
download | ffmpeg-7b9ef8d701c319c26f7d0664fe977e176764c74e.tar.gz |
mpeg: Split error resilience bits off into a separate file
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/Makefile | 1 | ||||
-rw-r--r-- | libavcodec/h261dec.c | 1 | ||||
-rw-r--r-- | libavcodec/h263dec.c | 1 | ||||
-rw-r--r-- | libavcodec/mpeg12dec.c | 1 | ||||
-rw-r--r-- | libavcodec/mpeg_er.c | 59 | ||||
-rw-r--r-- | libavcodec/mpeg_er.h | 26 | ||||
-rw-r--r-- | libavcodec/mpegvideo.c | 40 | ||||
-rw-r--r-- | libavcodec/mpegvideo.h | 3 | ||||
-rw-r--r-- | libavcodec/mss2.c | 1 | ||||
-rw-r--r-- | libavcodec/rv10.c | 1 | ||||
-rw-r--r-- | libavcodec/rv34.c | 1 | ||||
-rw-r--r-- | libavcodec/vc1dec.c | 1 |
12 files changed, 93 insertions, 43 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 8f6afb01fc..5b1fdefe5f 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -55,6 +55,7 @@ OBJS-$(CONFIG_LIBXVID) += libxvid_rc.o OBJS-$(CONFIG_LPC) += lpc.o OBJS-$(CONFIG_LSP) += lsp.o OBJS-$(CONFIG_MDCT) += mdct_fixed.o mdct_float.o +OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o OBJS-$(CONFIG_MPEGAUDIO) += mpegaudio.o mpegaudiodata.o \ mpegaudiodecheader.o OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \ diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index 73f6a59bf9..d83fb3114c 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -26,6 +26,7 @@ */ #include "avcodec.h" +#include "mpeg_er.h" #include "mpegutils.h" #include "mpegvideo.h" #include "h263.h" diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index b081e30dfe..cdd55446c7 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -32,6 +32,7 @@ #include "h263.h" #include "h263_parser.h" #include "internal.h" +#include "mpeg_er.h" #include "mpeg4video.h" #include "mpeg4video_parser.h" #include "mpegvideo.h" diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 91f9343bfb..0bf3c20c37 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -36,6 +36,7 @@ #include "dsputil.h" #include "error_resilience.h" #include "internal.h" +#include "mpeg_er.h" #include "mpeg12.h" #include "mpeg12data.h" #include "mpegutils.h" diff --git a/libavcodec/mpeg_er.c b/libavcodec/mpeg_er.c new file mode 100644 index 0000000000..7a1b6b2764 --- /dev/null +++ b/libavcodec/mpeg_er.c @@ -0,0 +1,59 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * 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. + * + * Libav is distributed in the hope that it will be useful, + * 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 + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "error_resilience.h" +#include "mpegvideo.h" +#include "mpeg_er.h" + +static void set_erpic(ERPicture *dst, Picture *src) +{ + int i; + + if (!src) { + dst->f = NULL; + dst->tf = NULL; + return; + } + + dst->f = src->f; + dst->tf = &src->tf; + + for (i = 0; i < 2; i++) { + dst->motion_val[i] = src->motion_val[i]; + dst->ref_index[i] = src->ref_index[i]; + } + + dst->mb_type = src->mb_type; + dst->field_picture = src->field_picture; +} + +void ff_mpeg_er_frame_start(MpegEncContext *s) +{ + ERContext *er = &s->er; + + set_erpic(&er->cur_pic, s->current_picture_ptr); + set_erpic(&er->next_pic, s->next_picture_ptr); + set_erpic(&er->last_pic, s->last_picture_ptr); + + er->pp_time = s->pp_time; + er->pb_time = s->pb_time; + er->quarter_sample = s->quarter_sample; + er->partitioned_frame = s->partitioned_frame; + + ff_er_frame_start(er); +} diff --git a/libavcodec/mpeg_er.h b/libavcodec/mpeg_er.h new file mode 100644 index 0000000000..19681843d7 --- /dev/null +++ b/libavcodec/mpeg_er.h @@ -0,0 +1,26 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * 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. + * + * Libav is distributed in the hope that it will be useful, + * 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 + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_MPEG_ER_H +#define AVCODEC_MPEG_ER_H + +#include "mpegvideo.h" + +void ff_mpeg_er_frame_start(MpegEncContext *s); + +#endif /* AVCODEC_MPEG_ER_H */ diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index f32aad2382..f602dd6f23 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -2466,43 +2466,3 @@ void ff_MPV_report_decode_progress(MpegEncContext *s) if (s->pict_type != AV_PICTURE_TYPE_B && !s->partitioned_frame && !s->er.error_occurred) ff_thread_report_progress(&s->current_picture_ptr->tf, s->mb_y, 0); } - -#if CONFIG_ERROR_RESILIENCE -static void set_erpic(ERPicture *dst, Picture *src) -{ - int i; - - if (!src) { - dst->f = NULL; - dst->tf = NULL; - return; - } - - dst->f = src->f; - dst->tf = &src->tf; - - for (i = 0; i < 2; i++) { - dst->motion_val[i] = src->motion_val[i]; - dst->ref_index[i] = src->ref_index[i]; - } - - dst->mb_type = src->mb_type; - dst->field_picture = src->field_picture; -} - -void ff_mpeg_er_frame_start(MpegEncContext *s) -{ - ERContext *er = &s->er; - - set_erpic(&er->cur_pic, s->current_picture_ptr); - set_erpic(&er->next_pic, s->next_picture_ptr); - set_erpic(&er->last_pic, s->last_picture_ptr); - - er->pp_time = s->pp_time; - er->pb_time = s->pb_time; - er->quarter_sample = s->quarter_sample; - er->partitioned_frame = s->partitioned_frame; - - ff_er_frame_start(er); -} -#endif /* CONFIG_ERROR_RESILIENCE */ diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 36b3358dd8..6409a86b1e 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -723,9 +723,6 @@ void ff_MPV_report_decode_progress(MpegEncContext *s); int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src); void ff_set_qscale(MpegEncContext * s, int qscale); -/* Error resilience */ -void ff_mpeg_er_frame_start(MpegEncContext *s); - int ff_dct_common_init(MpegEncContext *s); void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64], const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra); diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index 1f5dcc3dfd..ffbba6d0fd 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -26,6 +26,7 @@ #include "libavutil/avassert.h" #include "error_resilience.h" #include "internal.h" +#include "mpeg_er.h" #include "msmpeg4data.h" #include "qpeldsp.h" #include "vc1.h" diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index f5533df06a..0e76f63189 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -33,6 +33,7 @@ #include "error_resilience.h" #include "h263.h" #include "internal.h" +#include "mpeg_er.h" #include "mpegvideo.h" #include "mpeg4video.h" diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index ba4cc67cc4..0c3634801c 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -33,6 +33,7 @@ #include "golomb.h" #include "internal.h" #include "mathops.h" +#include "mpeg_er.h" #include "qpeldsp.h" #include "rectangle.h" #include "thread.h" diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index c36b249b29..6d6c1ec4fa 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -29,6 +29,7 @@ #include "internal.h" #include "avcodec.h" #include "error_resilience.h" +#include "mpeg_er.h" #include "mpegutils.h" #include "mpegvideo.h" #include "h263.h" |