diff options
Diffstat (limited to 'libavcodec/hevc_mvs.c')
-rw-r--r-- | libavcodec/hevc_mvs.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/libavcodec/hevc_mvs.c b/libavcodec/hevc_mvs.c index 49d5ff25d8..6b3a8da143 100644 --- a/libavcodec/hevc_mvs.c +++ b/libavcodec/hevc_mvs.c @@ -1,23 +1,23 @@ /* - * HEVC video decoder + * HEVC video Decoder * * Copyright (C) 2012 - 2013 Guillaume Martres * Copyright (C) 2013 Anand Meher Kotra * - * 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 */ @@ -41,7 +41,7 @@ static const uint8_t l0_l1_cand_idx[12][2] = { void ff_hevc_set_neighbour_available(HEVCContext *s, int x0, int y0, int nPbW, int nPbH) { - HEVCLocalContext *lc = &s->HEVClc; + HEVCLocalContext *lc = s->HEVClc; int x0b = x0 & ((1 << s->sps->log2_ctb_size) - 1); int y0b = y0 & ((1 << s->sps->log2_ctb_size) - 1); @@ -70,9 +70,9 @@ static int z_scan_block_avail(HEVCContext *s, int xCurr, int yCurr, yCurr >> s->sps->log2_min_tb_size); int N; - if (xN < 0 || yN < 0 || - xN >= s->sps->width || - yN >= s->sps->height) + if ((xN < 0) || (yN < 0) || + (xN >= s->sps->width) || + (yN >= s->sps->height)) return 0; N = MIN_TB_ADDR_ZS(xN >> s->sps->log2_min_tb_size, @@ -98,7 +98,7 @@ static int check_prediction_block_available(HEVCContext *s, int log2_cb_size, int x0, int y0, int nPbW, int nPbH, int xA1, int yA1, int partIdx) { - HEVCLocalContext *lc = &s->HEVClc; + HEVCLocalContext *lc = s->HEVClc; if (lc->cu.x < xA1 && lc->cu.y < yA1 && (lc->cu.x + (1 << log2_cb_size)) > xA1 && @@ -249,7 +249,8 @@ static int temporal_luma_motion_vector(HEVCContext *s, int x0, int y0, { MvField *tab_mvf; MvField temp_col; - int x, y, x_pu, y_pu; + int x, y; + int x_pu, y_pu; int min_pu_width = s->sps->min_pu_width; int availableFlagLXCol = 0; int colPic; @@ -266,7 +267,8 @@ static int temporal_luma_motion_vector(HEVCContext *s, int x0, int y0, x = x0 + nPbW; y = y0 + nPbH; - ff_thread_await_progress(&ref->tf, y, 0); + if (s->threads_type == FF_THREAD_FRAME ) + ff_thread_await_progress(&ref->tf, y, 0); if (tab_mvf && (y0 >> s->sps->log2_ctb_size) == (y >> s->sps->log2_ctb_size) && y < s->sps->height && @@ -313,7 +315,7 @@ static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0, int singleMCLFlag, int part_idx, struct MvField mergecandlist[]) { - HEVCLocalContext *lc = &s->HEVClc; + HEVCLocalContext *lc = s->HEVClc; RefPicList *refPicList = s->ref->refPicList; MvField *tab_mvf = s->ref->tab_mvf; @@ -477,7 +479,7 @@ static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0, // combined bi-predictive merge candidates (applies for B slices) if (s->sh.slice_type == B_SLICE && nb_orig_merge_cand > 1 && nb_orig_merge_cand < s->sh.max_num_merge_cand) { - int comb_idx; + int comb_idx = 0; for (comb_idx = 0; nb_merge_cand < s->sh.max_num_merge_cand && comb_idx < nb_orig_merge_cand * (nb_orig_merge_cand - 1); comb_idx++) { @@ -514,8 +516,8 @@ static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0, mergecandlist[nb_merge_cand].mv[1].x = 0; mergecandlist[nb_merge_cand].mv[1].y = 0; mergecandlist[nb_merge_cand].is_intra = 0; - mergecandlist[nb_merge_cand].ref_idx[0] = zero_idx < nb_refs ? zero_idx : 0; - mergecandlist[nb_merge_cand].ref_idx[1] = zero_idx < nb_refs ? zero_idx : 0; + mergecandlist[nb_merge_cand].ref_idx[0] = (zero_idx < nb_refs) ? zero_idx : 0; + mergecandlist[nb_merge_cand].ref_idx[1] = (zero_idx < nb_refs) ? zero_idx : 0; nb_merge_cand++; zero_idx++; @@ -534,7 +536,7 @@ void ff_hevc_luma_mv_merge_mode(HEVCContext *s, int x0, int y0, int nPbW, struct MvField mergecand_list[MRG_MAX_NUM_CANDS] = { { { { 0 } } } }; int nPbW2 = nPbW; int nPbH2 = nPbH; - HEVCLocalContext *lc = &s->HEVClc; + HEVCLocalContext *lc = s->HEVClc; if (s->pps->log2_parallel_merge_level > 2 && nCS == 8) { singleMCLFlag = 1; @@ -612,19 +614,17 @@ static int mv_mp_mode_mx_lt(HEVCContext *s, int x, int y, int pred_flag_index, } #define MP_MX(v, pred, mx) \ - mv_mp_mode_mx(s, x ## v ## _pu, y ## v ## _pu, pred, \ - &mx, ref_idx_curr, ref_idx) + mv_mp_mode_mx(s, x ## v ## _pu, y ## v ## _pu, pred, &mx, ref_idx_curr, ref_idx) #define MP_MX_LT(v, pred, mx) \ - mv_mp_mode_mx_lt(s, x ## v ## _pu, y ## v ## _pu, pred, \ - &mx, ref_idx_curr, ref_idx) + mv_mp_mode_mx_lt(s, x ## v ## _pu, y ## v ## _pu, pred, &mx, ref_idx_curr, ref_idx) void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW, int nPbH, int log2_cb_size, int part_idx, int merge_idx, MvField *mv, int mvp_lx_flag, int LX) { - HEVCLocalContext *lc = &s->HEVClc; + HEVCLocalContext *lc = s->HEVClc; MvField *tab_mvf = s->ref->tab_mvf; int isScaledFlag_L0 = 0; int availableFlagLXA0 = 0; @@ -691,8 +691,9 @@ void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW, yA1_pu = yA1 >> s->sps->log2_min_pu_size; is_available_a1 = AVAILABLE(cand_left, A1); - if (is_available_a0 || is_available_a1) + if (is_available_a0 || is_available_a1) { isScaledFlag_L0 = 1; + } if (is_available_a0) { availableFlagLXA0 = MP_MX(A0, pred_flag_index_l0, mxA); |