Commit f578e5d9 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/hevc: Adjust white-spaces to reduce difference to 064698d3

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 38612379
This diff is collapsed.
......@@ -132,8 +132,7 @@ static const int elem_offset[sizeof(num_bins_in_se)] = {
* Indexed by init_type
*/
static const uint8_t init_values[3][HEVC_CONTEXTS] = {
{
// sao_merge_flag
{ // sao_merge_flag
153,
// sao_type_idx
200,
......@@ -195,10 +194,8 @@ static const uint8_t init_values[3][HEVC_CONTEXTS] = {
140, 92, 137, 138, 140, 152, 138, 139, 153, 74, 149, 92, 139, 107,
122, 152, 140, 179, 166, 182, 140, 227, 122, 197,
// coeff_abs_level_greater2_flag
138, 153, 136, 167, 152, 152,
},
{
// sao_merge_flag
138, 153, 136, 167, 152, 152, },
{ // sao_merge_flag
153,
// sao_type_idx
185,
......@@ -260,10 +257,8 @@ static const uint8_t init_values[3][HEVC_CONTEXTS] = {
154, 196, 196, 167, 154, 152, 167, 182, 182, 134, 149, 136, 153, 121,
136, 137, 169, 194, 166, 167, 154, 167, 137, 182,
// coeff_abs_level_greater2_flag
107, 167, 91, 122, 107, 167,
},
{
// sao_merge_flag
107, 167, 91, 122, 107, 167, },
{ // sao_merge_flag
153,
// sao_type_idx
160,
......@@ -561,7 +556,8 @@ void ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts)
(s->pps->tile_id[ctb_addr_ts] != s->pps->tile_id[ctb_addr_ts - 1])))
cabac_init_state(s);
if (!s->sh.first_slice_in_pic_flag && s->pps->entropy_coding_sync_enabled_flag) {
if (!s->sh.first_slice_in_pic_flag &&
s->pps->entropy_coding_sync_enabled_flag) {
if ((ctb_addr_ts % s->sps->ctb_width) == 0) {
if (s->sps->ctb_width == 1)
cabac_init_state(s);
......@@ -662,9 +658,9 @@ int ff_hevc_skip_flag_decode(HEVCContext *s, int x0, int y0, int x_cb, int y_cb)
int y0b = y0 & ((1 << s->sps->log2_ctb_size) - 1);
if (s->HEVClc->ctb_left_flag || x0b)
inc = !!SAMPLE_CTB(s->skip_flag, x_cb-1, y_cb);
inc = !!SAMPLE_CTB(s->skip_flag, x_cb - 1, y_cb);
if (s->HEVClc->ctb_up_flag || y0b)
inc += !!SAMPLE_CTB(s->skip_flag, x_cb, y_cb-1);
inc += !!SAMPLE_CTB(s->skip_flag, x_cb, y_cb - 1);
return GET_CABAC(elem_offset[SKIP_FLAG] + inc);
}
......@@ -713,12 +709,13 @@ int ff_hevc_split_coding_unit_flag_decode(HEVCContext *s, int ct_depth, int x0,
int y_cb = y0 >> s->sps->log2_min_cb_size;
if (s->HEVClc->ctb_left_flag || x0b)
depth_left = s->tab_ct_depth[(y_cb)*s->sps->min_cb_width + x_cb-1];
depth_left = s->tab_ct_depth[(y_cb) * s->sps->min_cb_width + x_cb - 1];
if (s->HEVClc->ctb_up_flag || y0b)
depth_top = s->tab_ct_depth[(y_cb-1)*s->sps->min_cb_width + x_cb];
depth_top = s->tab_ct_depth[(y_cb - 1) * s->sps->min_cb_width + x_cb];
inc += (depth_left > ct_depth);
inc += (depth_top > ct_depth);
return GET_CABAC(elem_offset[SPLIT_CODING_UNIT_FLAG] + inc);
}
......
This diff is collapsed.
......@@ -38,7 +38,8 @@ static const uint8_t l0_l1_cand_idx[12][2] = {
{ 3, 2, },
};
void ff_hevc_set_neighbour_available(HEVCContext *s, int x0, int y0, int nPbW, int nPbH)
void ff_hevc_set_neighbour_available(HEVCContext *s, int x0, int y0,
int nPbW, int nPbH)
{
HEVCLocalContext *lc = s->HEVClc;
int x0b = x0 & ((1 << s->sps->log2_ctb_size) - 1);
......@@ -80,7 +81,6 @@ static int z_scan_block_avail(HEVCContext *s, int xCurr, int yCurr,
return N <= Curr;
}
static int same_prediction_block(HEVCLocalContext *lc, int log2_cb_size,
int x0, int y0, int nPbW, int nPbH,
int xA1, int yA1, int partIdx)
......@@ -184,12 +184,12 @@ static int check_mvset(Mv *mvLXCol, Mv *mvCol,
check_mvset(mvLXCol, temp_col.mv + l, \
colPic, s->poc, \
refPicList, X, refIdxLx, \
refPicList_col, L##l, temp_col.ref_idx[l])
refPicList_col, L ## l, temp_col.ref_idx[l])
// derive the motion vectors section 8.5.3.1.8
static int derive_temporal_colocated_mvs(HEVCContext *s, MvField temp_col,
int refIdxLx, Mv* mvLXCol, int X,
int colPic, RefPicList* refPicList_col)
int refIdxLx, Mv *mvLXCol, int X,
int colPic, RefPicList *refPicList_col)
{
RefPicList *refPicList = s->ref->refPicList;
......@@ -233,7 +233,7 @@ static int derive_temporal_colocated_mvs(HEVCContext *s, MvField temp_col,
tab_mvf[(y) * min_pu_width + x]
#define TAB_MVF_PU(v) \
TAB_MVF(x##v##_pu, y##v##_pu)
TAB_MVF(x ## v ## _pu, y ## v ## _pu)
#define DERIVE_TEMPORAL_COLOCATED_MVS \
derive_temporal_colocated_mvs(s, temp_col, \
......@@ -245,7 +245,7 @@ static int derive_temporal_colocated_mvs(HEVCContext *s, MvField temp_col,
*/
static int temporal_luma_motion_vector(HEVCContext *s, int x0, int y0,
int nPbW, int nPbH, int refIdxLx,
Mv* mvLXCol, int X)
Mv *mvLXCol, int X)
{
MvField *tab_mvf;
MvField temp_col;
......@@ -301,7 +301,7 @@ static int temporal_luma_motion_vector(HEVCContext *s, int x0, int y0,
#define PRED_BLOCK_AVAILABLE(v) \
check_prediction_block_available(s, log2_cb_size, \
x0, y0, nPbW, nPbH, \
x##v, y##v, part_idx)
x ## v, y ## v, part_idx)
#define COMPARE_MV_REFIDX(a, b) \
compareMVrefidx(TAB_MVF_PU(a), TAB_MVF_PU(b))
......@@ -310,7 +310,8 @@ static int temporal_luma_motion_vector(HEVCContext *s, int x0, int y0,
* 8.5.3.1.2 Derivation process for spatial merging candidates
*/
static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0,
int nPbW, int nPbH, int log2_cb_size,
int nPbW, int nPbH,
int log2_cb_size,
int singleMCLFlag, int part_idx,
struct MvField mergecandlist[])
{
......@@ -560,7 +561,7 @@ void ff_hevc_luma_mv_merge_mode(HEVCContext *s, int x0, int y0, int nPbW,
*mv = mergecand_list[merge_idx];
}
static av_always_inline void dist_scale(HEVCContext *s, Mv * mv,
static av_always_inline void dist_scale(HEVCContext *s, Mv *mv,
int min_pu_width, int x, int y,
int elist, int ref_idx_curr, int ref_idx)
{
......@@ -589,7 +590,6 @@ static int mv_mp_mode_mx(HEVCContext *s, int x, int y, int pred_flag_index,
return 0;
}
static int mv_mp_mode_mx_lt(HEVCContext *s, int x, int y, int pred_flag_index,
Mv *mv, int ref_idx_curr, int ref_idx)
{
......@@ -602,20 +602,22 @@ static int mv_mp_mode_mx_lt(HEVCContext *s, int x, int y, int pred_flag_index,
int colIsLongTerm =
refPicList[pred_flag_index].isLongTerm[(TAB_MVF(x, y).ref_idx[pred_flag_index])];
if (TAB_MVF(x, y).pred_flag[pred_flag_index] && colIsLongTerm == currIsLongTerm) {
if (TAB_MVF(x, y).pred_flag[pred_flag_index] &&
colIsLongTerm == currIsLongTerm) {
*mv = TAB_MVF(x, y).mv[pred_flag_index];
if (!currIsLongTerm)
dist_scale(s, mv, min_pu_width, x, y, pred_flag_index, ref_idx_curr, ref_idx);
dist_scale(s, mv, min_pu_width, x, y,
pred_flag_index, ref_idx_curr, ref_idx);
return 1;
}
return 0;
}
#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,
......@@ -800,7 +802,8 @@ void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW,
if (numMVPCandLX < 2 && s->sh.slice_temporal_mvp_enabled_flag) {
Mv mv_col;
int available_col = temporal_luma_motion_vector(s, x0, y0, nPbW,
nPbH, ref_idx, &mv_col, LX);
nPbH, ref_idx,
&mv_col, LX);
if (available_col)
mvpcand_list[numMVPCandLX++] = mv_col;
}
......
......@@ -21,6 +21,7 @@
*/
#include "libavutil/common.h"
#include "parser.h"
#include "hevc.h"
#include "golomb.h"
......@@ -36,7 +37,8 @@ typedef struct HEVCParseContext {
* Find the end of the current frame in the bitstream.
* @return the position of the first byte of the next frame, or END_NOT_FOUND
*/
static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf, int buf_size)
static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf,
int buf_size)
{
int i;
ParseContext *pc = &((HEVCParseContext *)s->priv_data)->pc;
......@@ -82,8 +84,7 @@ static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf, int
* @param buf buffer with field/frame data.
* @param buf_size size of the buffer.
*/
static inline int parse_nal_units(AVCodecParserContext *s,
AVCodecContext *avctx,
static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx,
const uint8_t *buf, int buf_size)
{
HEVCContext *h = &((HEVCParseContext *)s->priv_data)->h;
......
......@@ -273,7 +273,8 @@ static void decode_sublayer_hrd(HEVCContext *s, int nb_cpb,
}
}
static void decode_hrd(HEVCContext *s, int common_inf_present, int max_sublayers)
static void decode_hrd(HEVCContext *s, int common_inf_present,
int max_sublayers)
{
GetBitContext *gb = &s->HEVClc->gb;
int nal_params_present = 0, vcl_params_present = 0;
......@@ -643,7 +644,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
}
skip_bits1(gb); // temporal_id_nesting_flag
if (decode_profile_tier_level(s, &sps->ptl, sps->max_sub_layers) < 0) {
if (decode_profile_tier_level(s, &sps->ptl,
sps->max_sub_layers) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "error decoding profile tier level\n");
ret = AVERROR_INVALIDDATA;
goto err;
......@@ -820,7 +822,8 @@ 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;
......@@ -872,8 +875,7 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
ret = AVERROR_INVALIDDATA;
goto err;
}
av_log(s->avctx, AV_LOG_WARNING,
"Displaying the whole video surface.\n");
av_log(s->avctx, AV_LOG_WARNING, "Displaying the whole video surface.\n");
sps->pic_conf_win.left_offset =
sps->pic_conf_win.right_offset =
sps->pic_conf_win.top_offset =
......
......@@ -49,16 +49,17 @@ void ff_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, int flags)
}
}
RefPicList* ff_hevc_get_ref_list(HEVCContext *s, HEVCFrame *ref, int x0, int y0)
RefPicList *ff_hevc_get_ref_list(HEVCContext *s, HEVCFrame *ref, int x0, int y0)
{
if (x0 < 0 || y0 < 0) {
return s->ref->refPicList;
} else {
int x_cb = x0 >> s->sps->log2_ctb_size;
int y_cb = y0 >> s->sps->log2_ctb_size;
int pic_width_cb = (s->sps->width + (1<<s->sps->log2_ctb_size)-1 ) >> s->sps->log2_ctb_size;
int pic_width_cb = (s->sps->width + (1 << s->sps->log2_ctb_size) - 1) >>
s->sps->log2_ctb_size;
int ctb_addr_ts = s->pps->ctb_addr_rs_to_ts[y_cb * pic_width_cb + x_cb];
return (RefPicList*) ref->rpl_tab[ctb_addr_ts];
return (RefPicList *)ref->rpl_tab[ctb_addr_ts];
}
}
......@@ -67,7 +68,8 @@ void ff_hevc_clear_refs(HEVCContext *s)
int i;
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++)
ff_hevc_unref_frame(s, &s->DPB[i],
HEVC_FRAME_FLAG_SHORT_REF | HEVC_FRAME_FLAG_LONG_REF);
HEVC_FRAME_FLAG_SHORT_REF |
HEVC_FRAME_FLAG_LONG_REF);
}
void ff_hevc_flush_dpb(HEVCContext *s)
......@@ -85,7 +87,8 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
if (frame->frame->buf[0])
continue;
ret = ff_thread_get_buffer(s->avctx, &frame->tf, AV_GET_BUFFER_FLAG_REF);
ret = ff_thread_get_buffer(s->avctx, &frame->tf,
AV_GET_BUFFER_FLAG_REF);
if (ret < 0)
return NULL;
......@@ -96,15 +99,15 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
frame->tab_mvf_buf = av_buffer_pool_get(s->tab_mvf_pool);
if (!frame->tab_mvf_buf)
goto fail;
frame->tab_mvf = (MvField*)frame->tab_mvf_buf->data;
frame->tab_mvf = (MvField *)frame->tab_mvf_buf->data;
frame->rpl_tab_buf = av_buffer_pool_get(s->rpl_tab_pool);
if (!frame->rpl_tab_buf)
goto fail;
frame->rpl_tab = (RefPicListTab**)frame->rpl_tab_buf->data;
frame->rpl_tab = (RefPicListTab **)frame->rpl_tab_buf->data;
frame->ctb_count = s->sps->ctb_width * s->sps->ctb_height;
for (j = 0; j < frame->ctb_count; j++)
frame->rpl_tab[j] = (RefPicListTab*)frame->rpl_buf->data;
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);
......@@ -140,8 +143,8 @@ int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc)
*frame = ref->frame;
s->ref = ref;
ref->poc = poc;
ref->poc = poc;
ref->flags = HEVC_FRAME_FLAG_OUTPUT | HEVC_FRAME_FLAG_SHORT_REF;
ref->sequence = s->seq_decode;
ref->window = s->sps->output_window;
......@@ -192,7 +195,8 @@ int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)
(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);
av_log(s->avctx, AV_LOG_DEBUG,
"Output frame with POC %d.\n", frame->poc);
return 1;
}
......@@ -216,9 +220,9 @@ static int init_slice_rpl(HEVCContext *s)
return AVERROR_INVALIDDATA;
for (i = ctb_addr_ts; i < ctb_count; i++)
frame->rpl_tab[i] = (RefPicListTab*)frame->rpl_buf->data + s->slice_idx;
frame->rpl_tab[i] = (RefPicListTab *)frame->rpl_buf->data + s->slice_idx;
frame->refPicList = (RefPicList*)frame->rpl_tab[ctb_addr_ts];
frame->refPicList = (RefPicList *)frame->rpl_tab[ctb_addr_ts];
return 0;
}
......@@ -247,8 +251,7 @@ int ff_hevc_slice_rpl(HEVCContext *s)
/* The order of the elements is
* ST_CURR_BEF - ST_CURR_AFT - LT_CURR for the L0 and
* ST_CURR_AFT - ST_CURR_BEF - LT_CURR for the L1
*/
* ST_CURR_AFT - ST_CURR_BEF - LT_CURR for the L1 */
int cand_lists[3] = { list_idx ? ST_CURR_AFT : ST_CURR_BEF,
list_idx ? ST_CURR_BEF : ST_CURR_AFT,
LT_CURR };
......@@ -331,7 +334,6 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
HEVCFrame *frame;
int i, x, y;
frame = alloc_frame(s);
if (!frame)
return NULL;
......
......@@ -25,7 +25,8 @@
#include "hevc.h"
#include "golomb.h"
static void decode_nal_sei_decoded_picture_hash(HEVCContext *s, int payload_size)
static void decode_nal_sei_decoded_picture_hash(HEVCContext *s,
int payload_size)
{
int cIdx, i;
uint8_t hash_type;
......@@ -34,17 +35,16 @@ static void decode_nal_sei_decoded_picture_hash(HEVCContext *s, int payload_size
GetBitContext *gb = &s->HEVClc->gb;
hash_type = get_bits(gb, 8);
for( cIdx = 0; cIdx < 3/*((s->sps->chroma_format_idc == 0) ? 1 : 3)*/; cIdx++ ) {
if ( hash_type == 0 ) {
for (cIdx = 0; cIdx < 3/*((s->sps->chroma_format_idc == 0) ? 1 : 3)*/; cIdx++) {
if (hash_type == 0) {
s->is_md5 = 1;
for( i = 0; i < 16; i++) {
for (i = 0; i < 16; i++) {
s->md5[cIdx][i] = get_bits(gb, 8);
}
} else if( hash_type == 1 ) {
} else if( hash_type == 1) {
// picture_crc = get_bits(gb, 16);
skip_bits(gb, 16);
} else if( hash_type == 2 ) {
} else if (hash_type == 2) {
// picture_checksum = get_bits(gb, 32);
skip_bits(gb, 32);
}
......@@ -101,7 +101,8 @@ static int decode_pic_timing(HEVCContext *s)
return 1;
}
static void active_parameter_sets(HEVCContext *s) {
static void active_parameter_sets(HEVCContext *s)
{
GetBitContext *gb = &s->HEVClc->gb;
int num_sps_ids_minus1;
int i;
......
......@@ -91,13 +91,13 @@ static const int8_t transform[32][32] = {
};
DECLARE_ALIGNED(16, const int8_t, ff_hevc_epel_filters[7][16]) = {
{ -2, 58, 10, -2,-2, 58, 10, -2,-2, 58, 10, -2,-2, 58, 10, -2 },
{ -4, 54, 16, -2,-4, 54, 16, -2,-4, 54, 16, -2,-4, 54, 16, -2 },
{ -6, 46, 28, -4,-6, 46, 28, -4,-6, 46, 28, -4,-6, 46, 28, -4 },
{ -4, 36, 36, -4,-4, 36, 36, -4,-4, 36, 36, -4,-4, 36, 36, -4 },
{ -4, 28, 46, -6,-4, 28, 46, -6,-4, 28, 46, -6,-4, 28, 46, -6 },
{ -2, 16, 54, -4,-2, 16, 54, -4,-2, 16, 54, -4,-2, 16, 54, -4 },
{ -2, 10, 58, -2,-2, 10, 58, -2,-2, 10, 58, -2,-2, 10, 58, -2 },
{ -2, 58, 10, -2, -2, 58, 10, -2, -2, 58, 10, -2, -2, 58, 10, -2 },
{ -4, 54, 16, -2, -4, 54, 16, -2, -4, 54, 16, -2, -4, 54, 16, -2 },
{ -6, 46, 28, -4, -6, 46, 28, -4, -6, 46, 28, -4, -6, 46, 28, -4 },
{ -4, 36, 36, -4, -4, 36, 36, -4, -4, 36, 36, -4, -4, 36, 36, -4 },
{ -4, 28, 46, -6, -4, 28, 46, -6, -4, 28, 46, -6, -4, 28, 46, -6 },
{ -2, 16, 54, -4, -2, 16, 54, -4, -2, 16, 54, -4, -2, 16, 54, -4 },
{ -2, 10, 58, -2, -2, 10, 58, -2, -2, 10, 58, -2, -2, 10, 58, -2 },
};
#define BIT_DEPTH 8
......@@ -177,7 +177,6 @@ void ff_hevc_dsp_init(HEVCDSPContext *hevcdsp, int bit_depth)
hevcdsp->hevc_h_loop_filter_chroma_c = FUNC(hevc_h_loop_filter_chroma, depth); \
hevcdsp->hevc_v_loop_filter_chroma_c = FUNC(hevc_v_loop_filter_chroma, depth);
switch (bit_depth) {
case 9:
HEVC_DSP(9);
......
This diff is collapsed.
......@@ -47,9 +47,9 @@ void ff_hevc_pred_init(HEVCPredContext *hpc, int bit_depth)
hpc->pred_planar[2] = FUNC(pred_planar_2, depth); \
hpc->pred_planar[3] = FUNC(pred_planar_3, depth); \
hpc->pred_dc = FUNC(pred_dc, depth); \
hpc->pred_angular[0] = FUNC(pred_angular_0, depth);\
hpc->pred_angular[1] = FUNC(pred_angular_1, depth);\
hpc->pred_angular[2] = FUNC(pred_angular_2, depth);\
hpc->pred_angular[0] = FUNC(pred_angular_0, depth); \
hpc->pred_angular[1] = FUNC(pred_angular_1, depth); \
hpc->pred_angular[2] = FUNC(pred_angular_2, depth); \
hpc->pred_angular[3] = FUNC(pred_angular_3, depth);
switch (bit_depth) {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment