Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/hevc_refs.c')
-rw-r--r--libavcodec/hevc_refs.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index 2fbe9e787c..0ca3f403af 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -1,31 +1,31 @@
/*
- * HEVC video decoder
+ * HEVC video Decoder
*
* Copyright (C) 2012 - 2013 Guillaume Martres
* Copyright (C) 2012 - 2013 Gildas Cocherel
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * 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 Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/pixdesc.h"
+#include "hevc.h"
#include "internal.h"
#include "thread.h"
-#include "hevc.h"
void ff_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, int flags)
{
@@ -109,8 +109,9 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
for (j = 0; j < frame->ctb_count; j++)
frame->rpl_tab[j] = (RefPicListTab *)frame->rpl_buf->data;
+ frame->frame->top_field_first = s->picture_struct == AV_PICTURE_STRUCTURE_TOP_FIELD;
+ frame->frame->interlaced_frame = (s->picture_struct == AV_PICTURE_STRUCTURE_TOP_FIELD) || (s->picture_struct == AV_PICTURE_STRUCTURE_BOTTOM_FIELD);
return frame;
-
fail:
ff_hevc_unref_frame(s, frame, ~0);
return NULL;
@@ -156,7 +157,7 @@ int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)
do {
int nb_output = 0;
int min_poc = INT_MAX;
- int i, min_idx, ret;
+ int i, j, min_idx, ret;
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) {
HEVCFrame *frame = &s->DPB[i];
@@ -177,25 +178,22 @@ int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)
if (nb_output) {
HEVCFrame *frame = &s->DPB[min_idx];
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->frame->format);
- int pixel_shift;
+ AVFrame *dst = out;
+ AVFrame *src = frame->frame;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(src->format);
+ int pixel_shift = !!(desc->comp[0].depth_minus1 > 7);
- if (!desc)
- return AVERROR_BUG;
-
- pixel_shift = desc->comp[0].depth_minus1 > 7;
-
- ret = av_frame_ref(out, frame->frame);
+ ret = av_frame_ref(out, src);
ff_hevc_unref_frame(s, frame, HEVC_FRAME_FLAG_OUTPUT);
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;
+ for (j = 0; j < 3; j++) {
+ int hshift = (j > 0) ? desc->log2_chroma_w : 0;
+ int vshift = (j > 0) ? desc->log2_chroma_h : 0;
int off = ((frame->window.left_offset >> hshift) << pixel_shift) +
- (frame->window.top_offset >> vshift) * out->linesize[i];
- out->data[i] += off;
+ (frame->window.top_offset >> vshift) * dst->linesize[j];
+ dst->data[j] += off;
}
av_log(s->avctx, AV_LOG_DEBUG,
"Output frame with POC %d.\n", frame->poc);
@@ -265,7 +263,7 @@ int ff_hevc_slice_rpl(HEVCContext *s)
for (j = 0; j < rps->nb_refs && rpl_tmp.nb_refs < MAX_REFS; j++) {
rpl_tmp.list[rpl_tmp.nb_refs] = rps->list[j];
rpl_tmp.ref[rpl_tmp.nb_refs] = rps->ref[j];
- rpl_tmp.isLongTerm[rpl_tmp.nb_refs] = i == 2;
+ rpl_tmp.isLongTerm[rpl_tmp.nb_refs] = (i == 2);
rpl_tmp.nb_refs++;
}
}
@@ -314,7 +312,7 @@ static HEVCFrame *find_ref_idx(HEVCContext *s, int poc)
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) {
HEVCFrame *ref = &s->DPB[i];
- if (ref->frame->buf[0] && ref->sequence == s->seq_decode) {
+ if (ref->frame->buf[0] && (ref->sequence == s->seq_decode)) {
if (ref->poc == poc || (ref->poc & LtMask) == poc)
return ref;
}
@@ -357,7 +355,8 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
frame->sequence = s->seq_decode;
frame->flags = 0;
- ff_thread_report_progress(&frame->tf, INT_MAX, 0);
+ if (s->threads_type == FF_THREAD_FRAME)
+ ff_thread_report_progress(&frame->tf, INT_MAX, 0);
return frame;
}
@@ -451,9 +450,9 @@ int ff_hevc_compute_poc(HEVCContext *s, int poc_lsb)
int prev_poc_msb = s->pocTid0 - prev_poc_lsb;
int poc_msb;
- if (poc_lsb < prev_poc_lsb && prev_poc_lsb - poc_lsb >= max_poc_lsb / 2)
+ if ((poc_lsb < prev_poc_lsb) && ((prev_poc_lsb - poc_lsb) >= max_poc_lsb / 2))
poc_msb = prev_poc_msb + max_poc_lsb;
- else if (poc_lsb > prev_poc_lsb && poc_lsb - prev_poc_lsb > max_poc_lsb / 2)
+ else if ((poc_lsb > prev_poc_lsb) && ((poc_lsb - prev_poc_lsb) > (max_poc_lsb / 2)))
poc_msb = prev_poc_msb - max_poc_lsb;
else
poc_msb = prev_poc_msb;