summaryrefslogtreecommitdiff
path: root/libavcodec/hevc_refs.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-05-08 15:46:22 -0300
committerJames Almer <jamrial@gmail.com>2017-05-26 11:15:45 -0300
commit000fb61a71c6288c377167fea1541700aef3612d (patch)
treee4a5d4c5c6ab8184017eef6617442d4907af7f0e /libavcodec/hevc_refs.c
parent43c394dcaebe9eec5802b420f273385473380909 (diff)
avcodec/hevcdec: export cropping information instead of handling it internally
This merges commit a02ae1c6837a54ed9e7735da2b1f789b2f4b6e13 from libav, originally written by Anton Khirnov and skipped in fc63d5ceb357c4b760cb02772de0b50d0557140f. libavcodec/hevc_parser.c | 6 ++++-- libavcodec/hevc_ps.c | 31 ++++++++++++------------------- libavcodec/hevc_ps.h | 2 -- libavcodec/hevc_refs.c | 18 +++++------------- libavcodec/hevcdec.c | 7 ++++--- libavcodec/hevcdec.h | 2 -- 6 files changed, 25 insertions(+), 41 deletions(-) Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/hevc_refs.c')
-rw-r--r--libavcodec/hevc_refs.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index fc1385ca55..f9818c958e 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -163,7 +163,10 @@ int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc)
ref->poc = poc;
ref->sequence = s->seq_decode;
- ref->window = s->ps.sps->output_window;
+ ref->frame->crop_left = s->ps.sps->output_window.left_offset;
+ ref->frame->crop_right = s->ps.sps->output_window.right_offset;
+ ref->frame->crop_top = s->ps.sps->output_window.top_offset;
+ ref->frame->crop_bottom = s->ps.sps->output_window.bottom_offset;
return 0;
}
@@ -204,12 +207,8 @@ int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)
if (nb_output) {
HEVCFrame *frame = &s->DPB[min_idx];
- AVFrame *dst = out;
- AVFrame *src = frame->frame;
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(src->format);
- int pixel_shift = !!(desc->comp[0].depth > 8);
- ret = av_frame_ref(out, src);
+ ret = av_frame_ref(out, frame->frame);
if (frame->flags & HEVC_FRAME_FLAG_BUMPING)
ff_hevc_unref_frame(s, frame, HEVC_FRAME_FLAG_OUTPUT | HEVC_FRAME_FLAG_BUMPING);
else
@@ -217,13 +216,6 @@ int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)
if (ret < 0)
return ret;
- for (i = 0; i < 3; i++) {
- int hshift = (i > 0) ? desc->log2_chroma_w : 0;
- int vshift = (i > 0) ? desc->log2_chroma_h : 0;
- int off = ((frame->window.left_offset >> hshift) << pixel_shift) +
- (frame->window.top_offset >> vshift) * dst->linesize[i];
- dst->data[i] += off;
- }
av_log(s->avctx, AV_LOG_DEBUG,
"Output frame with POC %d.\n", frame->poc);
return 1;