summaryrefslogtreecommitdiff
path: root/libavcodec/h264dec.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-05-08 15:46:24 -0300
committerJames Almer <jamrial@gmail.com>2017-05-26 11:15:45 -0300
commit07596e45c5a0195b6e4e57597497ec7066817739 (patch)
treec4fa896c8d8042d0f10d87c9ba04725458faf302 /libavcodec/h264dec.c
parent6505e8cfd02b9112e24bb40c145d6c760f15d622 (diff)
downloadffmpeg-07596e45c5a0195b6e4e57597497ec7066817739.tar.gz
avcodec/h264dec: export cropping information instead of handling it internally
This merges commit c3e84820d67cb1d8cfb4196f9b43971308a81571 from libav, originally written by Anton Khirnov and skipped in fc63d5ceb357c4b760cb02772de0b50d0557140f. libavcodec/h264_picture.c | 3 --- libavcodec/h264_ps.c | 9 --------- libavcodec/h264_slice.c | 25 +++++++++++++++++++------ libavcodec/h264dec.c | 13 +------------ libavcodec/h264dec.h | 9 +++++---- 5 files changed, 25 insertions(+), 34 deletions(-)
Diffstat (limited to 'libavcodec/h264dec.c')
-rw-r--r--libavcodec/h264dec.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index a8d07df1e7..c7abd9d45d 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -848,8 +848,6 @@ static int get_consumed_bytes(int pos, int buf_size)
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
{
AVFrame *src = srcp->f;
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(src->format);
- int i;
int ret;
if (src->format == AV_PIX_FMT_VIDEOTOOLBOX && src->buf[0]->size == 1)
@@ -863,16 +861,7 @@ static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
if (srcp->sei_recovery_frame_cnt == 0)
dst->key_frame = 1;
- if (!srcp->crop)
- return 0;
- for (i = 0; i < desc->nb_components; i++) {
- int hshift = (i > 0) ? desc->log2_chroma_w : 0;
- int vshift = (i > 0) ? desc->log2_chroma_h : 0;
- int off = ((srcp->crop_left >> hshift) << h->pixel_shift) +
- (srcp->crop_top >> vshift) * dst->linesize[i];
- dst->data[i] += off;
- }
return 0;
}
@@ -1081,7 +1070,7 @@ AVCodec ff_h264_decoder = {
.capabilities = /*AV_CODEC_CAP_DRAW_HORIZ_BAND |*/ AV_CODEC_CAP_DR1 |
AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS |
AV_CODEC_CAP_FRAME_THREADS,
- .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
+ .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_EXPORTS_CROPPING,
.flush = flush_dpb,
.init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy),
.update_thread_context = ONLY_IF_THREADS_ENABLED(ff_h264_update_thread_context),