diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c index 6de90112c21c23a17bba6adf60d215778fce47e3..1335bb42daf86b79232436463f32ffdec97cd160 100644 --- a/libavcodec/hevc_filter.c +++ b/libavcodec/hevc_filter.c @@ -1,5 +1,5 @@ /* - * HEVC video Decoder + * HEVC video decoder * * Copyright (C) 2012 - 2013 Guillaume Martres * Copyright (C) 2013 Seppo Tomperi @@ -52,9 +52,7 @@ static int chroma_tc(HEVCContext *s, int qp_y, int c_idx, int tc_offset) static const int qp_c[] = { 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37 }; - int qp_i, offset; - int qp; - int idxt; + int qp, qp_i, offset, idxt; // slice qp offset is not used for deblocking if (c_idx == 1) @@ -91,9 +89,7 @@ static int get_qPy_pred(HEVCContext *s, int xC, int yC, (xQgBase & ctb_size_mask); int availableB = (yBase & ctb_size_mask) && (yQgBase & ctb_size_mask); - int qPy_pred; - int qPy_a; - int qPy_b; + int qPy_pred, qPy_a ,qPy_b; // qPy_pred if (lc->first_qp_group) { @@ -343,9 +339,7 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0) uint8_t *src; int x, y; int chroma; - int c_tc[2]; - int beta[2]; - int tc[2]; + int c_tc[2], beta[2], tc[2]; uint8_t no_p[2] = { 0 }; uint8_t no_q[2] = { 0 }; @@ -563,8 +557,7 @@ static int boundary_strength(HEVCContext *s, MvField *curr, } } else { // 1 MV Mv A, B; - int ref_A; - int ref_B; + int ref_A, ref_B; if (curr->pred_flag[0]) { A = curr->mv[0]; @@ -607,8 +600,7 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int min_tu_width = s->sps->min_tb_width; int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width + (x0 >> log2_min_pu_size)].is_intra; - int i, j; - int bs; + int i, j, bs; if (y0 > 0 && (y0 & 7) == 0) { int yp_pu = (y0 - 1) >> log2_min_pu_size; diff --git a/libavcodec/hevc_mvs.c b/libavcodec/hevc_mvs.c index a25f7abb37e8692663fcc8f3a5564595cfdc8729..b4e067b87664476672daef637c5df773a47c12c0 100644 --- a/libavcodec/hevc_mvs.c +++ b/libavcodec/hevc_mvs.c @@ -1,5 +1,5 @@ /* - * HEVC video Decoder + * HEVC video decoder * * Copyright (C) 2012 - 2013 Guillaume Martres * Copyright (C) 2013 Anand Meher Kotra @@ -249,8 +249,7 @@ static int temporal_luma_motion_vector(HEVCContext *s, int x0, int y0, { MvField *tab_mvf; MvField temp_col; - int x, y; - int x_pu, y_pu; + int x, y, x_pu, y_pu; int min_pu_width = s->sps->min_pu_width; int availableFlagLXCol = 0; int colPic; diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c index 1fe7b10d3c6a0d7aa752c0b16582af00249a3b33..118688f55f2ce520942dad2dcc1f468297375f8a 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -23,9 +23,9 @@ #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) { @@ -157,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, j, min_idx, ret; + int i, min_idx, ret; for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { HEVCFrame *frame = &s->DPB[i]; @@ -188,12 +188,12 @@ int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush) if (ret < 0) return ret; - for (j = 0; j < 3; j++) { - int hshift = (j > 0) ? desc->log2_chroma_w : 0; - int vshift = (j > 0) ? desc->log2_chroma_h : 0; + 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[j]; - dst->data[j] += off; + (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); diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c index d6e4adbb71107312052292f889171d39d1ce67b4..5b4347488545b52f3602d0a394b938a9971723c5 100644 --- a/libavcodec/hevc_sei.c +++ b/libavcodec/hevc_sei.c @@ -57,11 +57,10 @@ static void decode_nal_sei_frame_packing_arrangement(HEVCContext *s) get_ue_golomb(gb); // frame_packing_arrangement_id cancel = get_bits1(gb); // frame_packing_cancel_flag - if (cancel == 0 ) - { - type = get_bits(gb, 7); // frame_packing_arrangement_type - quincunx = get_bits1(gb); // quincunx_sampling_flag - skip_bits(gb, 6); // content_interpretation_type + if (cancel == 0 ){ + type = get_bits(gb, 7); // frame_packing_arrangement_type + quincunx = get_bits1(gb); // quincunx_sampling_flag + skip_bits(gb, 6); // content_interpretation_type // the following skips spatial_flipping_flag frame0_flipped_flag // field_views_flag current_frame_is_frame0_flag diff --git a/libavcodec/hevcdsp.c b/libavcodec/hevcdsp.c index 6fb86692d449f80f6f5a10aeee87b576d11c8caa..b3abc9d8a58186bae912514c2940e5336cc7fe4a 100644 --- a/libavcodec/hevcdsp.c +++ b/libavcodec/hevcdsp.c @@ -1,5 +1,5 @@ /* - * HEVC video Decoder + * HEVC video decoder * * Copyright (C) 2012 - 2013 Guillaume Martres * diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c index 2b2421ed16a5033c60a4d0104c74b33af29e524e..c1bb4d28db18c107b164878fc884989f571b97fe 100644 --- a/libavcodec/hevcdsp_template.c +++ b/libavcodec/hevcdsp_template.c @@ -278,7 +278,8 @@ static void FUNC(transform_4x4_add)(uint8_t *_dst, int16_t *coeffs, #define TR_16_2(dst, src) TR_16(dst, src, 1, 1, ADD_AND_SCALE) #define TR_32_2(dst, src) TR_32(dst, src, 1, 1, ADD_AND_SCALE) -static void FUNC(transform_8x8_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t stride) +static void FUNC(transform_8x8_add)(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t stride) { int i; pixel *dst = (pixel *)_dst; @@ -461,8 +462,8 @@ static void FUNC(sao_band_filter_3)(uint8_t *_dst, uint8_t *_src, static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride, SAOParams *sao, int *borders, int _width, int _height, - int c_idx, - uint8_t vert_edge, uint8_t horiz_edge, uint8_t diag_edge) + int c_idx, uint8_t vert_edge, + uint8_t horiz_edge, uint8_t diag_edge) { int x, y; pixel *dst = (pixel *)_dst; @@ -470,6 +471,7 @@ static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src, int chroma = !!c_idx; int *sao_offset_val = sao->offset_val[c_idx]; int sao_eo_class = sao->eo_class[c_idx]; + int init_x = 0, init_y = 0, width = _width, height = _height; static const int8_t pos[4][2][2] = { { { -1, 0 }, { 1, 0 } }, // horizontal @@ -479,10 +481,9 @@ static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src, }; static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; - int init_x = 0, init_y = 0, width = _width, height = _height; - stride /= sizeof(pixel); #define CMP(a, b) ((a) > (b) ? 1 : ((a) == (b) ? 0 : -1)) + stride /= sizeof(pixel); if (!borders[2]) width -= (8 >> chroma) + 2; @@ -577,6 +578,7 @@ static void FUNC(sao_edge_filter_1)(uint8_t *_dst, uint8_t *_src, int chroma = !!c_idx; int *sao_offset_val = sao->offset_val[c_idx]; int sao_eo_class = sao->eo_class[c_idx]; + int init_x = 0, init_y = 0, width = _width, height = _height; static const int8_t pos[4][2][2] = { { { -1, 0 }, { 1, 0 } }, // horizontal @@ -586,7 +588,6 @@ static void FUNC(sao_edge_filter_1)(uint8_t *_dst, uint8_t *_src, }; static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; - int init_x = 0, init_y = 0, width = _width, height = _height; #define CMP(a, b) ((a) > (b) ? 1 : ((a) == (b) ? 0 : -1)) stride /= sizeof(pixel); @@ -755,6 +756,7 @@ static void FUNC(sao_edge_filter_3)(uint8_t *_dst, uint8_t *_src, int chroma = !!c_idx; int *sao_offset_val = sao->offset_val[c_idx]; int sao_eo_class = sao->eo_class[c_idx]; + int init_x = 0, init_y = 0, width = _width, height = _height; static const int8_t pos[4][2][2] = { { { -1, 0 }, { 1, 0 } }, // horizontal @@ -764,7 +766,6 @@ static void FUNC(sao_edge_filter_3)(uint8_t *_dst, uint8_t *_src, }; static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; - int init_x = 0, init_y = 0, width = _width, height = _height; #define CMP(a, b) ((a) > (b) ? 1 : ((a) == (b) ? 0 : -1)) stride /= sizeof(pixel); @@ -1121,12 +1122,7 @@ static void FUNC(weighted_pred)(uint8_t denom, int16_t wlxFlag, int16_t olxFlag, int16_t *src, ptrdiff_t srcstride, int width, int height) { - int shift; - int log2Wd; - int wx; - int ox; - int x, y; - int offset; + int shift, log2Wd, wx, ox, x, y, offset; pixel *dst = (pixel *)_dst; ptrdiff_t dststride = _dststride / sizeof(pixel); @@ -1157,13 +1153,7 @@ static void FUNC(weighted_pred_avg)(uint8_t denom, ptrdiff_t srcstride, int width, int height) { - int shift; - int log2Wd; - int w0; - int w1; - int o0; - int o1; - int x, y; + int shift, log2Wd, w0, w1, o0, o1, x, y; pixel *dst = (pixel *)_dst; ptrdiff_t dststride = _dststride / sizeof(pixel); @@ -1189,7 +1179,7 @@ static void FUNC(weighted_pred_avg)(uint8_t denom, #define P2 pix[-3 * xstride] #define P1 pix[-2 * xstride] #define P0 pix[-1 * xstride] -#define Q0 pix[0] +#define Q0 pix[0 * xstride] #define Q1 pix[1 * xstride] #define Q2 pix[2 * xstride] #define Q3 pix[3 * xstride] @@ -1199,7 +1189,7 @@ static void FUNC(weighted_pred_avg)(uint8_t denom, #define TP2 pix[-3 * xstride + 3 * ystride] #define TP1 pix[-2 * xstride + 3 * ystride] #define TP0 pix[-1 * xstride + 3 * ystride] -#define TQ0 pix[3 * ystride] +#define TQ0 pix[0 * xstride + 3 * ystride] #define TQ1 pix[1 * xstride + 3 * ystride] #define TQ2 pix[2 * xstride + 3 * ystride] #define TQ3 pix[3 * xstride + 3 * ystride] @@ -1303,8 +1293,7 @@ static void FUNC(hevc_loop_filter_chroma)(uint8_t *_pix, ptrdiff_t _xstride, ptrdiff_t _ystride, int *_tc, uint8_t *_no_p, uint8_t *_no_q) { - int d, j; - int no_p, no_q; + int d, j, no_p, no_q; pixel *pix = (pixel *)_pix; ptrdiff_t xstride = _xstride / sizeof(pixel); ptrdiff_t ystride = _ystride / sizeof(pixel);