mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
mpegvideo: move ff_draw_horiz_band() to mpegutils.c
Drop the mpegvideo dependency for svq3 in configure.
This commit is contained in:
parent
e0c16e4e32
commit
be039278b5
2
configure
vendored
2
configure
vendored
@ -1820,7 +1820,7 @@ sipr_decoder_select="lsp"
|
|||||||
sp5x_decoder_select="mjpeg_decoder"
|
sp5x_decoder_select="mjpeg_decoder"
|
||||||
svq1_decoder_select="hpeldsp"
|
svq1_decoder_select="hpeldsp"
|
||||||
svq1_encoder_select="aandcttables dsputil hpeldsp mpegvideoenc"
|
svq1_encoder_select="aandcttables dsputil hpeldsp mpegvideoenc"
|
||||||
svq3_decoder_select="h264_decoder hpeldsp mpegvideo"
|
svq3_decoder_select="h264_decoder hpeldsp"
|
||||||
svq3_decoder_suggest="zlib"
|
svq3_decoder_suggest="zlib"
|
||||||
tak_decoder_select="dsputil"
|
tak_decoder_select="dsputil"
|
||||||
theora_decoder_select="vp3_decoder"
|
theora_decoder_select="vp3_decoder"
|
||||||
|
@ -57,7 +57,8 @@ OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \
|
|||||||
mpegaudiodsp_data.o \
|
mpegaudiodsp_data.o \
|
||||||
mpegaudiodsp_fixed.o \
|
mpegaudiodsp_fixed.o \
|
||||||
mpegaudiodsp_float.o
|
mpegaudiodsp_float.o
|
||||||
OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideo_motion.o
|
OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideo_motion.o \
|
||||||
|
mpegutils.o
|
||||||
OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \
|
OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \
|
||||||
motion_est.o ratecontrol.o
|
motion_est.o ratecontrol.o
|
||||||
OBJS-$(CONFIG_RANGECODER) += rangecoder.o
|
OBJS-$(CONFIG_RANGECODER) += rangecoder.o
|
||||||
@ -335,7 +336,7 @@ OBJS-$(CONFIG_SUNRAST_ENCODER) += sunrastenc.o
|
|||||||
OBJS-$(CONFIG_SVQ1_DECODER) += svq1dec.o svq1.o svq13.o h263.o
|
OBJS-$(CONFIG_SVQ1_DECODER) += svq1dec.o svq1.o svq13.o h263.o
|
||||||
OBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o svq1.o \
|
OBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o svq1.o \
|
||||||
h263.o ituh263enc.o
|
h263.o ituh263enc.o
|
||||||
OBJS-$(CONFIG_SVQ3_DECODER) += svq3.o svq13.o
|
OBJS-$(CONFIG_SVQ3_DECODER) += svq3.o svq13.o mpegutils.o
|
||||||
OBJS-$(CONFIG_TAK_DECODER) += takdec.o tak.o
|
OBJS-$(CONFIG_TAK_DECODER) += takdec.o tak.o
|
||||||
OBJS-$(CONFIG_TARGA_DECODER) += targa.o
|
OBJS-$(CONFIG_TARGA_DECODER) += targa.o
|
||||||
OBJS-$(CONFIG_TARGA_ENCODER) += targaenc.o rle.o
|
OBJS-$(CONFIG_TARGA_ENCODER) += targaenc.o rle.o
|
||||||
|
80
libavcodec/mpegutils.c
Normal file
80
libavcodec/mpegutils.c
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* Mpeg video formats-related defines and utility functions
|
||||||
|
*
|
||||||
|
* 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 <stdint.h>
|
||||||
|
|
||||||
|
#include "libavutil/common.h"
|
||||||
|
#include "libavutil/frame.h"
|
||||||
|
#include "libavutil/pixdesc.h"
|
||||||
|
|
||||||
|
#include "avcodec.h"
|
||||||
|
#include "mpegutils.h"
|
||||||
|
|
||||||
|
void ff_draw_horiz_band(AVCodecContext *avctx,
|
||||||
|
AVFrame *cur, AVFrame *last,
|
||||||
|
int y, int h, int picture_structure,
|
||||||
|
int first_field, int low_delay)
|
||||||
|
{
|
||||||
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
||||||
|
int vshift = desc->log2_chroma_h;
|
||||||
|
const int field_pic = picture_structure != PICT_FRAME;
|
||||||
|
if (field_pic) {
|
||||||
|
h <<= 1;
|
||||||
|
y <<= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
h = FFMIN(h, avctx->height - y);
|
||||||
|
|
||||||
|
if (field_pic && first_field &&
|
||||||
|
!(avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (avctx->draw_horiz_band) {
|
||||||
|
AVFrame *src;
|
||||||
|
int offset[AV_NUM_DATA_POINTERS];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (cur->pict_type == AV_PICTURE_TYPE_B || low_delay ||
|
||||||
|
(avctx->slice_flags & SLICE_FLAG_CODED_ORDER))
|
||||||
|
src = cur;
|
||||||
|
else if (last)
|
||||||
|
src = last;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (cur->pict_type == AV_PICTURE_TYPE_B &&
|
||||||
|
picture_structure == PICT_FRAME &&
|
||||||
|
avctx->codec_id != AV_CODEC_ID_SVQ3) {
|
||||||
|
for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
|
||||||
|
offset[i] = 0;
|
||||||
|
} else {
|
||||||
|
offset[0]= y * src->linesize[0];
|
||||||
|
offset[1]=
|
||||||
|
offset[2]= (y >> vshift) * src->linesize[1];
|
||||||
|
for (i = 3; i < AV_NUM_DATA_POINTERS; i++)
|
||||||
|
offset[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
emms_c();
|
||||||
|
|
||||||
|
avctx->draw_horiz_band(avctx, src, offset,
|
||||||
|
y, picture_structure, h);
|
||||||
|
}
|
||||||
|
}
|
@ -21,8 +21,14 @@
|
|||||||
#ifndef AVCODEC_MPEGUTILS_H
|
#ifndef AVCODEC_MPEGUTILS_H
|
||||||
#define AVCODEC_MPEGUTILS_H
|
#define AVCODEC_MPEGUTILS_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "libavutil/frame.h"
|
||||||
|
|
||||||
|
#include "avcodec.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
/* picture type */
|
/* picture type */
|
||||||
#define PICT_TOP_FIELD 1
|
#define PICT_TOP_FIELD 1
|
||||||
#define PICT_BOTTOM_FIELD 2
|
#define PICT_BOTTOM_FIELD 2
|
||||||
@ -108,4 +114,14 @@
|
|||||||
|
|
||||||
#define CANDIDATE_MB_TYPE_DIRECT0 (1 << 12)
|
#define CANDIDATE_MB_TYPE_DIRECT0 (1 << 12)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw a horizontal band if supported.
|
||||||
|
*
|
||||||
|
* @param h is the normal height, this will be reduced automatically if needed
|
||||||
|
*/
|
||||||
|
void ff_draw_horiz_band(AVCodecContext *avctx, AVFrame *cur, AVFrame *last,
|
||||||
|
int y, int h, int picture_structure, int first_field,
|
||||||
|
int low_delay);
|
||||||
|
|
||||||
#endif /* AVCODEC_PICTTYPE_H */
|
#endif /* AVCODEC_PICTTYPE_H */
|
||||||
|
@ -2311,59 +2311,6 @@ void ff_MPV_decode_mb(MpegEncContext *s, int16_t block[12][64]){
|
|||||||
MPV_decode_mb_internal(s, block, 0);
|
MPV_decode_mb_internal(s, block, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param h is the normal height, this will be reduced automatically if needed for the last row
|
|
||||||
*/
|
|
||||||
void ff_draw_horiz_band(AVCodecContext *avctx,
|
|
||||||
AVFrame *cur, AVFrame *last,
|
|
||||||
int y, int h, int picture_structure,
|
|
||||||
int first_field, int low_delay)
|
|
||||||
{
|
|
||||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
|
||||||
int vshift = desc->log2_chroma_h;
|
|
||||||
const int field_pic = picture_structure != PICT_FRAME;
|
|
||||||
if(field_pic){
|
|
||||||
h <<= 1;
|
|
||||||
y <<= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
h = FFMIN(h, avctx->height - y);
|
|
||||||
|
|
||||||
if(field_pic && first_field && !(avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return;
|
|
||||||
|
|
||||||
if (avctx->draw_horiz_band) {
|
|
||||||
AVFrame *src;
|
|
||||||
int offset[AV_NUM_DATA_POINTERS];
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (cur->pict_type == AV_PICTURE_TYPE_B || low_delay ||
|
|
||||||
(avctx->slice_flags & SLICE_FLAG_CODED_ORDER))
|
|
||||||
src = cur;
|
|
||||||
else if (last)
|
|
||||||
src = last;
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (cur->pict_type == AV_PICTURE_TYPE_B &&
|
|
||||||
picture_structure == PICT_FRAME &&
|
|
||||||
avctx->codec_id != AV_CODEC_ID_SVQ3) {
|
|
||||||
for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
|
|
||||||
offset[i] = 0;
|
|
||||||
}else{
|
|
||||||
offset[0]= y * src->linesize[0];
|
|
||||||
offset[1]=
|
|
||||||
offset[2]= (y >> vshift) * src->linesize[1];
|
|
||||||
for (i = 3; i < AV_NUM_DATA_POINTERS; i++)
|
|
||||||
offset[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
emms_c();
|
|
||||||
|
|
||||||
avctx->draw_horiz_band(avctx, src, offset,
|
|
||||||
y, picture_structure, h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
|
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
|
||||||
{
|
{
|
||||||
ff_draw_horiz_band(s->avctx, &s->current_picture.f,
|
ff_draw_horiz_band(s->avctx, &s->current_picture.f,
|
||||||
|
@ -710,9 +710,6 @@ void ff_MPV_common_init_x86(MpegEncContext *s);
|
|||||||
void ff_MPV_common_init_arm(MpegEncContext *s);
|
void ff_MPV_common_init_arm(MpegEncContext *s);
|
||||||
void ff_MPV_common_init_ppc(MpegEncContext *s);
|
void ff_MPV_common_init_ppc(MpegEncContext *s);
|
||||||
void ff_clean_intra_table_entries(MpegEncContext *s);
|
void ff_clean_intra_table_entries(MpegEncContext *s);
|
||||||
void ff_draw_horiz_band(AVCodecContext *avctx, AVFrame *cur, AVFrame *last,
|
|
||||||
int y, int h, int picture_structure, int first_field,
|
|
||||||
int low_delay);
|
|
||||||
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h);
|
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h);
|
||||||
void ff_mpeg_flush(AVCodecContext *avctx);
|
void ff_mpeg_flush(AVCodecContext *avctx);
|
||||||
void ff_print_debug_info(MpegEncContext *s, Picture *p);
|
void ff_print_debug_info(MpegEncContext *s, Picture *p);
|
||||||
|
Loading…
Reference in New Issue
Block a user