From b23692b3a8e0ada389d28e28a78a58ac1e15af0e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 2 Nov 2013 11:59:02 +0100 Subject: libavcodec/hevc: reduce whitespace differences to 064698d381e1e7790f21b0199a8930ea04e2e942 Signed-off-by: Michael Niedermayer --- libavcodec/hevc.c | 13 +++-- libavcodec/hevc.h | 3 +- libavcodec/hevc_parser.c | 2 +- libavcodec/hevc_ps.c | 13 +++-- libavcodec/hevc_sei.c | 24 ++++----- libavcodec/hevcdsp_template.c | 114 +++++++++++++++++++++++------------------ libavcodec/hevcpred_template.c | 2 +- 7 files changed, 91 insertions(+), 80 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c index 62ae09bbe8..77543a3ed7 100644 --- a/libavcodec/hevc.c +++ b/libavcodec/hevc.c @@ -29,7 +29,6 @@ #include "libavutil/internal.h" #include "libavutil/md5.h" #include "libavutil/opt.h" - #include "libavutil/pixdesc.h" #include "bytestream.h" @@ -1705,6 +1704,7 @@ static int hls_coding_quadtree(HEVCContext *s, int x0, int y0, const int cb_size_split = cb_size >> 1; const int x1 = x0 + cb_size_split; const int y1 = y0 + cb_size_split; + int more_data = 0; more_data = hls_coding_quadtree(s, x0, y0, log2_cb_size - 1, cb_depth + 1); @@ -2056,7 +2056,7 @@ static void restore_tqb_pixels(HEVCContext *s) static int hevc_frame_start(HEVCContext *s) { - HEVCLocalContext *lc = s->HEVClc; + HEVCLocalContext *lc = s->HEVClc; int ret; memset(s->horizontal_bs, 0, 2 * s->bs_width * (s->bs_height + 1)); @@ -2209,7 +2209,6 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length) ctb_addr_ts = hls_slice_data_wpp(s, nal, length); else ctb_addr_ts = hls_slice_data(s); - if (ctb_addr_ts >= (s->sps->ctb_width * s->sps->ctb_height)) { s->is_decoded = 1; if ((s->pps->transquant_bypass_enable_flag || @@ -2380,12 +2379,12 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) if (length < 4) { av_log(s->avctx, AV_LOG_ERROR, "No start code is found.\n"); ret = AVERROR_INVALIDDATA; - goto fail; - } + goto fail; + } } - buf += 3; - length -= 3; + buf += 3; + length -= 3; } if (!s->is_nalff) diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h index a1fa85586c..b8200b8a1d 100644 --- a/libavcodec/hevc.h +++ b/libavcodec/hevc.h @@ -33,7 +33,6 @@ #include "hevcpred.h" #include "hevcdsp.h" #include "internal.h" - #include "thread.h" #include "videodsp.h" @@ -780,6 +779,7 @@ typedef struct HEVCContext { AVFrame *sao_frame; AVFrame *tmp_frame; AVFrame *output_frame; + HEVCVPS *vps; const HEVCSPS *sps; HEVCPPS *pps; @@ -952,6 +952,7 @@ int ff_hevc_transform_skip_flag_decode(HEVCContext *s, int c_idx); * Get the number of candidate references for the current frame. */ int ff_hevc_frame_nb_refs(HEVCContext *s); + int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc); /** diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c index 09de43fcd8..1ba9508297 100644 --- a/libavcodec/hevc_parser.c +++ b/libavcodec/hevc_parser.c @@ -278,7 +278,7 @@ static int hevc_parse(AVCodecParserContext *s, parse_nal_units(s, avctx, buf, buf_size); - *poutbuf = buf; + *poutbuf = buf; *poutbuf_size = buf_size; return next; } diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 073ec7396b..247e1f76bb 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -822,8 +822,7 @@ int ff_hevc_decode_nal_sps(HEVCContext *s) sps->nb_st_rps = get_ue_golomb_long(gb); if (sps->nb_st_rps > MAX_SHORT_TERM_RPS_COUNT) { - av_log(s->avctx, AV_LOG_ERROR, - "Too many short term RPS: %d.\n", + av_log(s->avctx, AV_LOG_ERROR, "Too many short term RPS: %d.\n", sps->nb_st_rps); ret = AVERROR_INVALIDDATA; goto err; @@ -1084,8 +1083,8 @@ int ff_hevc_decode_nal_pps(HEVCContext *s) if (pps->num_tile_columns == 0 || pps->num_tile_columns >= sps->width) { av_log(s->avctx, AV_LOG_ERROR, "num_tile_columns_minus1 out of range: %d\n", - pps->num_tile_columns - 1); - ret = AVERROR_INVALIDDATA; + pps->num_tile_columns - 1); + ret = AVERROR_INVALIDDATA; goto err; } if (pps->num_tile_rows == 0 || @@ -1233,9 +1232,9 @@ int ff_hevc_decode_nal_pps(HEVCContext *s) pps->min_tb_addr_zs = av_malloc_array(pic_area_in_min_tbs, sizeof(*pps->min_tb_addr_zs)); if (!pps->ctb_addr_rs_to_ts || !pps->ctb_addr_ts_to_rs || !pps->tile_id || !pps->min_cb_addr_zs || !pps->min_tb_addr_zs) { - ret = AVERROR(ENOMEM); - goto err; - } + ret = AVERROR(ENOMEM); + goto err; + } for (ctb_addr_rs = 0; ctb_addr_rs < pic_area_in_ctbs; ctb_addr_rs++) { int tb_x = ctb_addr_rs % sps->ctb_width; diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c index 2de9ac0107..d6e4adbb71 100644 --- a/libavcodec/hevc_sei.c +++ b/libavcodec/hevc_sei.c @@ -55,9 +55,9 @@ static void decode_nal_sei_frame_packing_arrangement(HEVCContext *s) GetBitContext *gb = &s->HEVClc->gb; int cancel, type, quincunx; - get_ue_golomb(gb); // frame_packing_arrangement_id - cancel = get_bits1(gb); // frame_packing_cancel_flag - if ( cancel == 0 ) + 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 @@ -68,12 +68,12 @@ static void decode_nal_sei_frame_packing_arrangement(HEVCContext *s) // frame0_self_contained_flag frame1_self_contained_flag skip_bits(gb, 6); - if ( quincunx == 0 && type != 5 ) - skip_bits(gb, 16); // frame[01]_grid_position_[xy] - skip_bits(gb, 8); // frame_packing_arrangement_reserved_byte - skip_bits1(gb); // frame_packing_arrangement_persistance_flag + if (quincunx == 0 && type != 5) + skip_bits(gb, 16); // frame[01]_grid_position_[xy] + skip_bits(gb, 8); // frame_packing_arrangement_reserved_byte + skip_bits1(gb); // frame_packing_arrangement_persistance_flag } - skip_bits1(gb); // upsampled_aspect_ratio_flag + skip_bits1(gb); // upsampled_aspect_ratio_flag } static int decode_pic_timing(HEVCContext *s) @@ -127,12 +127,12 @@ static int decode_nal_sei_message(HEVCContext *s) av_log(s->avctx, AV_LOG_DEBUG, "Decoding SEI\n"); while (byte == 0xFF) { - byte = get_bits(gb, 8); + byte = get_bits(gb, 8); payload_type += byte; } byte = 0xFF; while (byte == 0xFF) { - byte = get_bits(gb, 8); + byte = get_bits(gb, 8); payload_size += byte; } if (s->nal_unit_type == NAL_SEI_PREFIX) { @@ -145,7 +145,7 @@ static int decode_nal_sei_message(HEVCContext *s) } else if (payload_type == 1){ int ret = decode_pic_timing(s); av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", payload_type); - skip_bits(gb, 8*payload_size); + skip_bits(gb, 8 * payload_size); return ret; } else if (payload_type == 129){ active_parameter_sets(s); @@ -161,7 +161,7 @@ static int decode_nal_sei_message(HEVCContext *s) decode_nal_sei_decoded_picture_hash(s, payload_size); else { av_log(s->avctx, AV_LOG_DEBUG, "Skipped SUFFIX SEI %d\n", payload_type); - skip_bits(gb, 8*payload_size); + skip_bits(gb, 8 * payload_size); } return 1; } diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c index eea3cca54b..44100671bc 100644 --- a/libavcodec/hevcdsp_template.c +++ b/libavcodec/hevcdsp_template.c @@ -34,7 +34,8 @@ static void FUNC(put_pcm)(uint8_t *_dst, ptrdiff_t _stride, int size, GetBitContext *gb, int pcm_bit_depth) { int x, y; - pixel *dst = (pixel*)_dst; + pixel *dst = (pixel *)_dst; + ptrdiff_t stride = _stride / sizeof(pixel); for (y = 0; y < size; y++) { @@ -44,10 +45,12 @@ static void FUNC(put_pcm)(uint8_t *_dst, ptrdiff_t _stride, int size, } } -static void FUNC(transquant_bypass4x4)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t _stride) +static void FUNC(transquant_bypass4x4)(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t _stride) { int x, y; - pixel *dst = (pixel *)_dst; + pixel *dst = (pixel *)_dst; + ptrdiff_t stride = _stride / sizeof(pixel); for (y = 0; y < 4; y++) { @@ -57,13 +60,14 @@ static void FUNC(transquant_bypass4x4)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t } dst += stride; } - } -static void FUNC(transquant_bypass8x8)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t _stride) +static void FUNC(transquant_bypass8x8)(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t _stride) { int x, y; - pixel *dst = (pixel*)_dst; + pixel *dst = (pixel *)_dst; + ptrdiff_t stride = _stride / sizeof(pixel); for (y = 0; y < 8; y++) { @@ -75,10 +79,12 @@ static void FUNC(transquant_bypass8x8)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t } } -static void FUNC(transquant_bypass16x16)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t _stride) +static void FUNC(transquant_bypass16x16)(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t _stride) { int x, y; - pixel *dst = (pixel*)_dst; + pixel *dst = (pixel *)_dst; + ptrdiff_t stride = _stride / sizeof(pixel); for (y = 0; y < 16; y++) { @@ -88,13 +94,14 @@ static void FUNC(transquant_bypass16x16)(uint8_t *_dst, int16_t *coeffs, ptrdiff } dst += stride; } - } -static void FUNC(transquant_bypass32x32)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t _stride) +static void FUNC(transquant_bypass32x32)(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t _stride) { int x, y; - pixel *dst = (pixel*)_dst; + pixel *dst = (pixel *)_dst; + ptrdiff_t stride = _stride / sizeof(pixel); for (y = 0; y < 32; y++) { @@ -106,11 +113,12 @@ static void FUNC(transquant_bypass32x32)(uint8_t *_dst, int16_t *coeffs, ptrdiff } } -static void FUNC(transform_skip)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t _stride) +static void FUNC(transform_skip)(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t _stride) { - pixel *dst = (pixel*)_dst; + pixel *dst = (pixel *)_dst; ptrdiff_t stride = _stride / sizeof(pixel); - int shift = 13 - BIT_DEPTH; + int shift = 13 - BIT_DEPTH; #if BIT_DEPTH <= 13 int offset = 1 << (shift - 1); #else @@ -142,10 +150,10 @@ static void FUNC(transform_4x4_luma_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff } while (0) int i; - pixel *dst = (pixel*)_dst; + pixel *dst = (pixel *)_dst; ptrdiff_t stride = _stride / sizeof(pixel); int shift = 7; - int add = 1 << (shift - 1); + int add = 1 << (shift - 1); int16_t *src = coeffs; for (i = 0; i < 4; i++) { @@ -154,11 +162,11 @@ static void FUNC(transform_4x4_luma_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff } shift = 20 - BIT_DEPTH; - add = 1 << (shift - 1); + add = 1 << (shift - 1); for (i = 0; i < 4; i++) { TR_4x4_LUMA(dst, coeffs, 1, ADD_AND_SCALE); coeffs += 4; - dst += stride; + dst += stride; } #undef TR_4x4_LUMA @@ -186,10 +194,10 @@ static void FUNC(transform_4x4_luma_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff static void FUNC(transform_4x4_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t _stride) { int i; - pixel *dst = (pixel*)_dst; + pixel *dst = (pixel *)_dst; ptrdiff_t stride = _stride / sizeof(pixel); int shift = 7; - int add = 1 << (shift - 1); + int add = 1 << (shift - 1); int16_t *src = coeffs; for (i = 0; i < 4; i++) { @@ -198,16 +206,16 @@ static void FUNC(transform_4x4_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t _s } shift = 20 - BIT_DEPTH; - add = 1 << (shift - 1); + add = 1 << (shift - 1); for (i = 0; i < 4; i++) { TR_4_2(dst, coeffs); coeffs += 4; - dst += stride; + dst += stride; } } -#define TR_8(dst, src, dstep, sstep, assign) \ - do { \ +#define TR_8(dst, src, dstep, sstep, assign) \ + do { \ int i, j; \ int e_8[4]; \ int o_8[4] = { 0 }; \ @@ -265,10 +273,10 @@ static void FUNC(transform_4x4_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t _s static void FUNC(transform_8x8_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t _stride) { int i; - pixel *dst = (pixel *)_dst; + pixel *dst = (pixel *)_dst; ptrdiff_t stride = _stride / sizeof(pixel); int shift = 7; - int add = 1 << (shift - 1); + int add = 1 << (shift - 1); int16_t *src = coeffs; for (i = 0; i < 8; i++) { @@ -277,21 +285,22 @@ static void FUNC(transform_8x8_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t _s } shift = 20 - BIT_DEPTH; - add = 1 << (shift - 1); + add = 1 << (shift - 1); for (i = 0; i < 8; i++) { TR_8_2(dst, coeffs); coeffs += 8; - dst += stride; + dst += stride; } } -static void FUNC(transform_16x16_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t _stride) +static void FUNC(transform_16x16_add)(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t _stride) { int i; - pixel *dst = (pixel*)_dst; + pixel *dst = (pixel *)_dst; ptrdiff_t stride = _stride / sizeof(pixel); int shift = 7; - int add = 1 << (shift - 1); + int add = 1 << (shift - 1); int16_t *src = coeffs; for (i = 0; i < 16; i++) { @@ -300,15 +309,16 @@ static void FUNC(transform_16x16_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t } shift = 20 - BIT_DEPTH; - add = 1 << (shift - 1); + add = 1 << (shift - 1); for (i = 0; i < 16; i++) { TR_16_2(dst, coeffs); coeffs += 16; - dst += stride; + dst += stride; } } -static void FUNC(transform_32x32_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t _stride) +static void FUNC(transform_32x32_add)(uint8_t *_dst, int16_t *coeffs, + ptrdiff_t _stride) { #define IT32x32_even(i,w) ( src[ 0*w] * transform[ 0][i] ) + ( src[16*w] * transform[16][i] ) #define IT32x32_odd(i,w) ( src[ 8*w] * transform[ 8][i] ) + ( src[24*w] * transform[24][i] ) @@ -320,10 +330,10 @@ static void FUNC(transform_32x32_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t ( src[17*w] * transform[17][i] ) + ( src[19*w] * transform[19][i] ) + ( src[21*w] * transform[21][i] ) + ( src[23*w] * transform[23][i] ) + \ ( src[25*w] * transform[25][i] ) + ( src[27*w] * transform[27][i] ) + ( src[29*w] * transform[29][i] ) + ( src[31*w] * transform[31][i] ) int i; - pixel *dst = (pixel*)_dst; + pixel *dst = (pixel *)_dst; ptrdiff_t stride = _stride / sizeof(pixel); int shift = 7; - int add = 1 << (shift - 1); + int add = 1 << (shift - 1); int16_t *src = coeffs; for (i = 0; i < 32; i++) { @@ -336,7 +346,7 @@ static void FUNC(transform_32x32_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t for (i = 0; i < 32; i++) { TR_32_2(dst, coeffs); coeffs += 32; - dst += stride; + dst += stride; } #undef IT32x32_even #undef IT32x32_odd @@ -347,16 +357,16 @@ static void FUNC(transform_32x32_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t static void FUNC(sao_band_filter)(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride, SAOParams *sao, - int *borders, int width, int height, + int *borders, int width, int height, int c_idx, int class) { - pixel *dst = (pixel*)_dst; - pixel *src = (pixel*)_src; + pixel *dst = (pixel *)_dst; + pixel *src = (pixel *)_src; ptrdiff_t stride = _stride / sizeof(pixel); int offset_table[32] = { 0 }; int k, y, x; int chroma = !!c_idx; - int shift = BIT_DEPTH - 5; + int shift = BIT_DEPTH - 5; int *sao_offset_val = sao->offset_val[c_idx]; int sao_left_class = sao->band_position[c_idx]; int init_y = 0, init_x = 0; @@ -423,7 +433,8 @@ static void FUNC(sao_band_filter_2)(uint8_t *dst, uint8_t *src, int *borders, int width, int height, int c_idx) { - FUNC(sao_band_filter)(dst, src, stride, sao, borders, width, height, c_idx, 2); + FUNC(sao_band_filter)(dst, src, stride, sao, borders, + width, height, c_idx, 2); } static void FUNC(sao_band_filter_3)(uint8_t *_dst, uint8_t *_src, @@ -431,7 +442,8 @@ static void FUNC(sao_band_filter_3)(uint8_t *_dst, uint8_t *_src, int *borders, int width, int height, int c_idx) { - FUNC(sao_band_filter)(_dst, _src, _stride, sao, borders, width, height, c_idx, 3); + FUNC(sao_band_filter)(_dst, _src, _stride, sao, borders, + width, height, c_idx, 3); } static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src, @@ -441,12 +453,12 @@ static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src, uint8_t vert_edge, uint8_t horiz_edge, uint8_t diag_edge) { int x, y; - pixel *dst = (pixel*)_dst; - pixel *src = (pixel*)_src; + pixel *dst = (pixel *)_dst; + pixel *src = (pixel *)_src; ptrdiff_t stride = _stride / sizeof(pixel); int chroma = !!c_idx; int *sao_offset_val = sao->offset_val[c_idx]; - int sao_eo_class = sao->eo_class[c_idx]; + int sao_eo_class = sao->eo_class[c_idx]; static const int8_t pos[4][2][2] = { { { -1, 0 }, { 1, 0 } }, // horizontal @@ -1080,7 +1092,7 @@ static void FUNC(weighted_pred)(uint8_t denom, int16_t wlxFlag, int16_t olxFlag, int log2Wd; int wx; int ox; - int x , y; + int x, y; int offset; pixel *dst = (pixel *)_dst; ptrdiff_t dststride = _dststride / sizeof(pixel); @@ -1118,7 +1130,7 @@ static void FUNC(weighted_pred_avg)(uint8_t denom, int w1; int o0; int o1; - int x , y; + int x, y; pixel *dst = (pixel *)_dst; ptrdiff_t dststride = _dststride / sizeof(pixel); @@ -1153,9 +1165,9 @@ static void FUNC(weighted_pred_avg)(uint8_t denom, #define TP3 pix[-4 * xstride + 3 * ystride] #define TP2 pix[-3 * xstride + 3 * ystride] #define TP1 pix[-2 * xstride + 3 * ystride] -#define TP0 pix[-xstride+3 * ystride] +#define TP0 pix[-xstride + 3 * ystride] #define TQ0 pix[3 * ystride] -#define TQ1 pix[xstride+3 * ystride] +#define TQ1 pix[xstride + 3 * ystride] #define TQ2 pix[2 * xstride + 3 * ystride] #define TQ3 pix[3 * xstride + 3 * ystride] @@ -1176,7 +1188,7 @@ static void FUNC(hevc_loop_filter_luma)(uint8_t *_pix, const int dq3 = abs(TQ2 - 2 * TQ1 + TQ0); const int d0 = dp0 + dq0; const int d3 = dp3 + dq3; - int beta = _beta[j] << (BIT_DEPTH - 8); + int beta = _beta[j] << (BIT_DEPTH - 8); const int tc = _tc[j] << (BIT_DEPTH - 8); const int no_p = _no_p[j]; const int no_q = _no_q[j]; diff --git a/libavcodec/hevcpred_template.c b/libavcodec/hevcpred_template.c index 07bc1ea795..81fa97e2dd 100644 --- a/libavcodec/hevcpred_template.c +++ b/libavcodec/hevcpred_template.c @@ -310,7 +310,7 @@ static void FUNC(intra_pred)(HEVCContext *s, int x0, int y0, int log2_size, int if (c_idx == 0 && mode != INTRA_DC && size != 4) { int intra_hor_ver_dist_thresh[] = { 7, 1, 0 }; int min_dist_vert_hor = FFMIN(FFABS((int)(mode - 26U)), - FFABS((int)(mode - 10U))); + FFABS((int)(mode - 10U))); if (min_dist_vert_hor > intra_hor_ver_dist_thresh[log2_size - 3]) { int threshold = 1 << (BIT_DEPTH - 5); if (s->sps->sps_strong_intra_smoothing_enable_flag && -- cgit v1.2.3