1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge commit '7b9ef8d701c319c26f7d0664fe977e176764c74e'

* commit '7b9ef8d701c319c26f7d0664fe977e176764c74e':
  mpeg: Split error resilience bits off into a separate file

Conflicts:
	configure
	libavcodec/Makefile
	libavcodec/mpegvideo.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-06-23 03:48:30 +02:00
commit 56afbe8dbc
13 changed files with 107 additions and 55 deletions

24
configure vendored
View File

@ -1818,6 +1818,7 @@ CONFIG_EXTRA="
llauddsp llauddsp
llviddsp llviddsp
lpc lpc
mpeg_er
mpegaudio mpegaudio
mpegaudiodsp mpegaudiodsp
mpegvideo mpegvideo
@ -1995,6 +1996,7 @@ frame_thread_encoder_deps="encoders threads"
intrax8_select="error_resilience" intrax8_select="error_resilience"
mdct_select="fft" mdct_select="fft"
rdft_select="fft" rdft_select="fft"
mpeg_er_select="error_resilience"
mpegaudio_select="mpegaudiodsp" mpegaudio_select="mpegaudiodsp"
mpegaudiodsp_select="dct" mpegaudiodsp_select="dct"
mpegvideo_select="blockdsp dsputil h264chroma hpeldsp videodsp" mpegvideo_select="blockdsp dsputil h264chroma hpeldsp videodsp"
@ -2063,9 +2065,9 @@ fourxm_decoder_select="blockdsp dsputil"
fraps_decoder_select="dsputil huffman" fraps_decoder_select="dsputil huffman"
g2m_decoder_select="blockdsp dsputil zlib" g2m_decoder_select="blockdsp dsputil zlib"
g729_decoder_select="dsputil" g729_decoder_select="dsputil"
h261_decoder_select="error_resilience mpegvideo" h261_decoder_select="mpeg_er mpegvideo"
h261_encoder_select="aandcttables mpegvideoenc" h261_encoder_select="aandcttables mpegvideoenc"
h263_decoder_select="error_resilience h263_parser h263dsp mpegvideo qpeldsp" h263_decoder_select="error_resilience h263_parser h263dsp mpeg_er mpegvideo qpeldsp"
h263_encoder_select="aandcttables h263dsp mpegvideoenc" h263_encoder_select="aandcttables h263dsp mpegvideoenc"
h263i_decoder_select="h263_decoder" h263i_decoder_select="h263_decoder"
h263p_encoder_select="h263_encoder" h263p_encoder_select="h263_encoder"
@ -2106,9 +2108,9 @@ mpc7_decoder_select="dsputil mpegaudiodsp"
mpc8_decoder_select="mpegaudiodsp" mpc8_decoder_select="mpegaudiodsp"
mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h" mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
mpeg_xvmc_decoder_select="mpeg2video_decoder" mpeg_xvmc_decoder_select="mpeg2video_decoder"
mpeg1video_decoder_select="error_resilience mpegvideo" mpeg1video_decoder_select="error_resilience mpeg_er mpegvideo"
mpeg1video_encoder_select="aandcttables mpegvideoenc h263dsp" mpeg1video_encoder_select="aandcttables mpegvideoenc h263dsp"
mpeg2video_decoder_select="error_resilience mpegvideo" mpeg2video_decoder_select="error_resilience mpeg_er mpegvideo"
mpeg2video_encoder_select="aandcttables mpegvideoenc h263dsp" mpeg2video_encoder_select="aandcttables mpegvideoenc h263dsp"
mpeg4_decoder_select="h263_decoder mpeg4video_parser" mpeg4_decoder_select="h263_decoder mpeg4video_parser"
mpeg4_encoder_select="h263_encoder" mpeg4_encoder_select="h263_encoder"
@ -2117,7 +2119,7 @@ msmpeg4v2_decoder_select="h263_decoder"
msmpeg4v2_encoder_select="h263_encoder" msmpeg4v2_encoder_select="h263_encoder"
msmpeg4v3_decoder_select="h263_decoder" msmpeg4v3_decoder_select="h263_decoder"
msmpeg4v3_encoder_select="h263_encoder" msmpeg4v3_encoder_select="h263_encoder"
mss2_decoder_select="error_resilience qpeldsp vc1_decoder" mss2_decoder_select="error_resilience mpeg_er qpeldsp vc1_decoder"
mxpeg_decoder_select="mjpeg_decoder" mxpeg_decoder_select="mjpeg_decoder"
nellymoser_decoder_select="mdct sinewin" nellymoser_decoder_select="mdct sinewin"
nellymoser_encoder_select="audio_frame_queue mdct sinewin" nellymoser_encoder_select="audio_frame_queue mdct sinewin"
@ -2134,12 +2136,12 @@ ra_144_encoder_select="audio_frame_queue lpc"
ralf_decoder_select="golomb" ralf_decoder_select="golomb"
rawvideo_decoder_select="dsputil" rawvideo_decoder_select="dsputil"
rtjpeg_decoder_select="dsputil" rtjpeg_decoder_select="dsputil"
rv10_decoder_select="error_resilience h263_decoder h263dsp" rv10_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
rv10_encoder_select="h263_encoder" rv10_encoder_select="h263_encoder"
rv20_decoder_select="error_resilience h263_decoder h263dsp" rv20_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
rv20_encoder_select="h263_encoder" rv20_encoder_select="h263_encoder"
rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp" rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpeg_er mpegvideo videodsp"
rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp" rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpeg_er mpegvideo videodsp"
shorten_decoder_select="golomb" shorten_decoder_select="golomb"
sipr_decoder_select="lsp" sipr_decoder_select="lsp"
snow_decoder_select="dsputil dwt h264qpel hpeldsp rangecoder" snow_decoder_select="dsputil dwt h264qpel hpeldsp rangecoder"
@ -2165,7 +2167,7 @@ twinvq_decoder_select="mdct lsp sinewin"
utvideo_decoder_select="dsputil" utvideo_decoder_select="dsputil"
utvideo_encoder_select="dsputil huffman huffyuvencdsp" utvideo_encoder_select="dsputil huffman huffyuvencdsp"
vble_decoder_select="huffyuvdsp" vble_decoder_select="huffyuvdsp"
vc1_decoder_select="blockdsp error_resilience h263_decoder h264chroma h264qpel intrax8 qpeldsp" vc1_decoder_select="blockdsp error_resilience h263_decoder h264chroma h264qpel intrax8 mpeg_er qpeldsp"
vc1image_decoder_select="vc1_decoder" vc1image_decoder_select="vc1_decoder"
vorbis_decoder_select="mdct" vorbis_decoder_select="mdct"
vorbis_encoder_select="mdct" vorbis_encoder_select="mdct"
@ -2271,7 +2273,7 @@ wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
h264_parser_select="h264_decoder" h264_parser_select="h264_decoder"
hevc_parser_select="hevc_decoder" hevc_parser_select="hevc_decoder"
mpegvideo_parser_select="mpegvideo" mpegvideo_parser_select="mpegvideo"
mpeg4video_parser_select="error_resilience h263dsp mpegvideo qpeldsp" mpeg4video_parser_select="error_resilience h263dsp mpeg_er mpegvideo qpeldsp"
vc1_parser_select="mpegvideo vc1_decoder" vc1_parser_select="mpegvideo vc1_decoder"
# external libraries # external libraries

View File

@ -65,6 +65,7 @@ OBJS-$(CONFIG_LLVIDDSP) += lossless_videodsp.o
OBJS-$(CONFIG_LPC) += lpc.o OBJS-$(CONFIG_LPC) += lpc.o
OBJS-$(CONFIG_LSP) += lsp.o OBJS-$(CONFIG_LSP) += lsp.o
OBJS-$(CONFIG_MDCT) += mdct_fixed.o mdct_float.o mdct_fixed_32.o OBJS-$(CONFIG_MDCT) += mdct_fixed.o mdct_float.o mdct_fixed_32.o
OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o
OBJS-$(CONFIG_MPEGAUDIO) += mpegaudio.o mpegaudiodata.o \ OBJS-$(CONFIG_MPEGAUDIO) += mpegaudio.o mpegaudiodata.o \
mpegaudiodecheader.o mpegaudiodecheader.o
OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \ OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \

View File

@ -27,6 +27,7 @@
#include "libavutil/avassert.h" #include "libavutil/avassert.h"
#include "avcodec.h" #include "avcodec.h"
#include "mpeg_er.h"
#include "mpegutils.h" #include "mpegutils.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "h263.h" #include "h263.h"

View File

@ -34,6 +34,7 @@
#include "h263.h" #include "h263.h"
#include "h263_parser.h" #include "h263_parser.h"
#include "internal.h" #include "internal.h"
#include "mpeg_er.h"
#include "mpeg4video.h" #include "mpeg4video.h"
#include "mpeg4video_parser.h" #include "mpeg4video_parser.h"
#include "mpegvideo.h" #include "mpegvideo.h"

View File

@ -37,6 +37,7 @@
#include "dsputil.h" #include "dsputil.h"
#include "error_resilience.h" #include "error_resilience.h"
#include "internal.h" #include "internal.h"
#include "mpeg_er.h"
#include "mpeg12.h" #include "mpeg12.h"
#include "mpeg12data.h" #include "mpeg12data.h"
#include "mpegutils.h" #include "mpegutils.h"

60
libavcodec/mpeg_er.c Normal file
View File

@ -0,0 +1,60 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; 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;
memset(dst, 0, sizeof(*dst));
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);
}

26
libavcodec/mpeg_er.h Normal file
View File

@ -0,0 +1,26 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; 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 */

View File

@ -3235,44 +3235,3 @@ void ff_MPV_report_decode_progress(MpegEncContext *s)
if (s->pict_type != AV_PICTURE_TYPE_B && !s->partitioned_frame && !s->er.error_occurred) 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); 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;
memset(dst, 0, sizeof(*dst));
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 */

View File

@ -753,9 +753,6 @@ void ff_MPV_report_decode_progress(MpegEncContext *s);
int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src); int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);
void ff_set_qscale(MpegEncContext * s, int qscale); 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); int ff_dct_common_init(MpegEncContext *s);
int ff_dct_encode_init(MpegEncContext *s); int ff_dct_encode_init(MpegEncContext *s);
void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64], void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64],

View File

@ -26,6 +26,7 @@
#include "libavutil/avassert.h" #include "libavutil/avassert.h"
#include "error_resilience.h" #include "error_resilience.h"
#include "internal.h" #include "internal.h"
#include "mpeg_er.h"
#include "msmpeg4data.h" #include "msmpeg4data.h"
#include "qpeldsp.h" #include "qpeldsp.h"
#include "vc1.h" #include "vc1.h"

View File

@ -33,6 +33,7 @@
#include "error_resilience.h" #include "error_resilience.h"
#include "h263.h" #include "h263.h"
#include "internal.h" #include "internal.h"
#include "mpeg_er.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "mpeg4video.h" #include "mpeg4video.h"

View File

@ -34,6 +34,7 @@
#include "golomb.h" #include "golomb.h"
#include "internal.h" #include "internal.h"
#include "mathops.h" #include "mathops.h"
#include "mpeg_er.h"
#include "qpeldsp.h" #include "qpeldsp.h"
#include "rectangle.h" #include "rectangle.h"
#include "thread.h" #include "thread.h"

View File

@ -29,6 +29,7 @@
#include "internal.h" #include "internal.h"
#include "avcodec.h" #include "avcodec.h"
#include "error_resilience.h" #include "error_resilience.h"
#include "mpeg_er.h"
#include "mpegutils.h" #include "mpegutils.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "h263.h" #include "h263.h"