1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

hevc : cosmetic changes(cherry picked from commit 7308c0ccf13f18cebe4851e6dcd6b5c0b09be1dd)

Decreases the difference to Anton Khirnovs patch v5

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Mickaël Raulet 2013-10-27 12:56:48 +01:00 committed by Michael Niedermayer
parent dbe6f9f2c2
commit 3c3ece24ea
8 changed files with 203 additions and 190 deletions

View File

@ -82,7 +82,7 @@ static void pic_arrays_free(HEVCContext *s)
/* allocate arrays that depend on frame dimensions */
static int pic_arrays_init(HEVCContext *s)
{
int log2_min_cb_size = s->sps->log2_min_coding_block_size;
int log2_min_cb_size = s->sps->log2_min_cb_size;
int width = s->sps->width;
int height = s->sps->height;
int pic_size = width * height;
@ -92,8 +92,8 @@ static int pic_arrays_init(HEVCContext *s)
int pic_width_in_min_pu = width >> s->sps->log2_min_pu_size;
int pic_height_in_min_pu = height >> s->sps->log2_min_pu_size;
int pic_size_in_min_pu = pic_width_in_min_pu * pic_height_in_min_pu;
int pic_width_in_min_tu = width >> s->sps->log2_min_transform_block_size;
int pic_height_in_min_tu = height >> s->sps->log2_min_transform_block_size;
int pic_width_in_min_tu = width >> s->sps->log2_min_tb_size;
int pic_height_in_min_tu = height >> s->sps->log2_min_tb_size;
s->bs_width = width >> 3;
s->bs_height = height >> 3;
@ -566,7 +566,7 @@ static int hls_slice_header(HEVCContext *s)
sh->tc_offset = get_se_golomb(gb) * 2;
}
} else {
sh->disable_deblocking_filter_flag = s->pps->pps_disable_deblocking_filter_flag;
sh->disable_deblocking_filter_flag = s->pps->disable_dbf;
sh->beta_offset = s->pps->beta_offset;
sh->tc_offset = s->pps->tc_offset;
}
@ -576,7 +576,6 @@ static int hls_slice_header(HEVCContext *s)
sh->tc_offset = 0;
}
if (s->pps->seq_loop_filter_across_slices_enabled_flag &&
(sh->slice_sample_adaptive_offset_flag[0] ||
sh->slice_sample_adaptive_offset_flag[1] ||
@ -713,7 +712,7 @@ static void hls_sao_param(HEVCContext *s, int rx, int ry)
}
// Inferred parameters
sao->offset_val[c_idx][0] = 0; //avoid undefined values
sao->offset_val[c_idx][0] = 0;
for (i = 0; i < 4; i++) {
sao->offset_val[c_idx][i + 1] = sao->offset_abs[c_idx][i] << shift;
if (sao->type_idx[c_idx] == SAO_EDGE) {
@ -846,7 +845,7 @@ static void hls_transform_tree(HEVCContext *s, int x0, int y0, int xBase, int yB
lc->cu.part_mode != PART_2Nx2N && trafo_depth == 0);
if (log2_trafo_size <= s->sps->log2_max_trafo_size &&
log2_trafo_size > s->sps->log2_min_transform_block_size &&
log2_trafo_size > s->sps->log2_min_tb_size &&
trafo_depth < lc->cu.max_trafo_depth &&
!(lc->cu.intra_split_flag && trafo_depth == 0)) {
split_transform_flag = ff_hevc_split_transform_flag_decode(s, log2_trafo_size);
@ -882,8 +881,8 @@ static void hls_transform_tree(HEVCContext *s, int x0, int y0, int xBase, int yB
hls_transform_tree(s, x1, y1, x0, y0, cb_xBase, cb_yBase, log2_cb_size,
log2_trafo_size - 1, trafo_depth + 1, 3);
} else {
int min_tu_size = 1 << s->sps->log2_min_transform_block_size;
int log2_min_tu_size = s->sps->log2_min_transform_block_size;
int min_tu_size = 1 << s->sps->log2_min_tb_size;
int log2_min_tu_size = s->sps->log2_min_tb_size;
int pic_width_in_min_tu = s->sps->width >> log2_min_tu_size;
int i, j;
@ -1083,8 +1082,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, int nPbW, int nP
uint8_t *dst0 = POS(0, x0, y0);
uint8_t *dst1 = POS(1, x0, y0);
uint8_t *dst2 = POS(2, x0, y0);
int log2_min_cb_size = s->sps->log2_min_coding_block_size;
int pic_width_in_ctb = s->sps->width>>log2_min_cb_size;
int log2_min_cb_size = s->sps->log2_min_cb_size;
int min_cb_width = s->sps->width>>log2_min_cb_size;
int x_cb = x0 >> log2_min_cb_size;
int y_cb = y0 >> log2_min_cb_size;
int ref_idx[2];
@ -1403,9 +1402,9 @@ static int luma_intra_pred_mode(HEVCContext *s, int x0, int y0, int pu_size,
static av_always_inline void set_ct_depth(HEVCContext *s, int x0, int y0,
int log2_cb_size, int ct_depth)
{
int length = (1 << log2_cb_size) >> s->sps->log2_min_coding_block_size;
int x_cb = x0 >> s->sps->log2_min_coding_block_size;
int y_cb = y0 >> s->sps->log2_min_coding_block_size;
int length = (1 << log2_cb_size) >> s->sps->log2_min_cb_size;
int x_cb = x0 >> s->sps->log2_min_cb_size;
int y_cb = y0 >> s->sps->log2_min_cb_size;
int y;
for (y = 0; y < length; y++)
@ -1476,9 +1475,9 @@ static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size)
{
int cb_size = 1 << log2_cb_size;
HEVCLocalContext *lc = s->HEVClc;
int log2_min_cb_size = s->sps->log2_min_coding_block_size;
int log2_min_cb_size = s->sps->log2_min_cb_size;
int length = cb_size >> log2_min_cb_size;
int pic_width_in_ctb = s->sps->width >> log2_min_cb_size;
int min_cb_width = s->sps->width >> log2_min_cb_size;
int x_cb = x0 >> log2_min_cb_size;
int y_cb = y0 >> log2_min_cb_size;
int x, y;
@ -1505,10 +1504,10 @@ static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size)
uint8_t skip_flag = ff_hevc_skip_flag_decode(s, x0, y0, x_cb, y_cb);
lc->cu.pred_mode = MODE_SKIP;
x = y_cb * pic_width_in_ctb + x_cb;
x = y_cb * min_cb_width + x_cb;
for (y = 0; y < length; y++) {
memset(&s->skip_flag[x], skip_flag, length);
x += pic_width_in_ctb;
x += min_cb_width;
}
lc->cu.pred_mode = skip_flag ? MODE_SKIP : MODE_INTER;
}
@ -1525,7 +1524,7 @@ static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size)
if (s->sh.slice_type != I_SLICE)
lc->cu.pred_mode = ff_hevc_pred_mode_decode(s);
if (lc->cu.pred_mode != MODE_INTRA ||
log2_cb_size == s->sps->log2_min_coding_block_size) {
log2_cb_size == s->sps->log2_min_cb_size) {
lc->cu.part_mode = ff_hevc_part_mode_decode(s, log2_cb_size);
lc->cu.intra_split_flag = lc->cu.part_mode == PART_NxN &&
lc->cu.pred_mode == MODE_INTRA;
@ -1611,10 +1610,10 @@ static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size)
if (s->pps->cu_qp_delta_enabled_flag && lc->tu.is_cu_qp_delta_coded == 0)
ff_hevc_set_qPy(s, x0, y0, x0, y0, log2_cb_size);
x = y_cb * pic_width_in_ctb + x_cb;
x = y_cb * min_cb_width + x_cb;
for (y = 0; y < length; y++) {
memset(&s->qp_y_tab[x], lc->qp_y, length);
x += pic_width_in_ctb;
x += min_cb_width;
}
set_ct_depth(s, x0, y0, log2_cb_size, lc->ct.depth);
@ -1630,12 +1629,12 @@ static int hls_coding_quadtree(HEVCContext *s, int x0, int y0, int log2_cb_size,
lc->ct.depth = cb_depth;
if ((x0 + (1 << log2_cb_size) <= s->sps->width) &&
(y0 + (1 << log2_cb_size) <= s->sps->height) &&
log2_cb_size > s->sps->log2_min_coding_block_size) {
log2_cb_size > s->sps->log2_min_cb_size) {
SAMPLE(s->split_cu_flag, x0, y0) =
ff_hevc_split_coding_unit_flag_decode(s, cb_depth, x0, y0);
} else {
SAMPLE(s->split_cu_flag, x0, y0) =
(log2_cb_size > s->sps->log2_min_coding_block_size);
(log2_cb_size > s->sps->log2_min_cb_size);
}
if (s->pps->cu_qp_delta_enabled_flag &&
log2_cb_size >= s->sps->log2_ctb_size - s->pps->diff_cu_qp_delta_depth) {
@ -2007,8 +2006,8 @@ static int hevc_frame_start(HEVCContext *s)
HEVCLocalContext *lc = s->HEVClc;
int pic_width_in_min_pu = s->sps->width >> s->sps->log2_min_pu_size;
int pic_height_in_min_pu = s->sps->height >> s->sps->log2_min_pu_size;
int pic_width_in_min_tu = s->sps->width >> s->sps->log2_min_transform_block_size;
int pic_height_in_min_tu = s->sps->height >> s->sps->log2_min_transform_block_size;
int pic_width_in_min_tu = s->sps->width >> s->sps->log2_min_tb_size;
int pic_height_in_min_tu = s->sps->height >> s->sps->log2_min_tb_size;
int ret;
memset(s->horizontal_bs, 0, 2 * s->bs_width * (s->bs_height + 1));

View File

@ -76,7 +76,7 @@
* Value of the luma sample at position (x, y) in the 2D array tab.
*/
#define SAMPLE(tab, x, y) ((tab)[(y) * s->sps->width + (x)])
#define SAMPLE_CTB(tab, x, y) ((tab)[(y) * pic_width_in_ctb + (x)])
#define SAMPLE_CTB(tab, x, y) ((tab)[(y) * min_cb_width + (x)])
#define SAMPLE_CBF(tab, x, y) ((tab)[((y) & ((1<<log2_trafo_size)-1)) * MAX_CU_SIZE + ((x) & ((1<<log2_trafo_size)-1))])
#define IS_IDR(s) (s->nal_unit_type == NAL_IDR_W_RADL || s->nal_unit_type == NAL_IDR_N_LP)
@ -424,9 +424,9 @@ typedef struct HEVCSPS {
uint8_t sps_temporal_mvp_enabled_flag;
uint8_t sps_strong_intra_smoothing_enable_flag;
unsigned int log2_min_coding_block_size;
unsigned int log2_min_cb_size;
unsigned int log2_diff_max_min_coding_block_size;
unsigned int log2_min_transform_block_size;
unsigned int log2_min_tb_size;
unsigned int log2_max_trafo_size;
unsigned int log2_ctb_size;
unsigned int log2_min_pu_size;
@ -444,6 +444,8 @@ typedef struct HEVCSPS {
int min_cb_height;
int min_tb_width;
int min_tb_height;
int min_pu_width;
int min_pu_height;
int hshift[3];
int vshift[3];
@ -489,7 +491,7 @@ typedef struct HEVCPPS {
uint8_t deblocking_filter_control_present_flag;
uint8_t deblocking_filter_override_enabled_flag;
uint8_t pps_disable_deblocking_filter_flag;
uint8_t disable_dbf;
int beta_offset; ///< beta_offset_div2 * 2
int tc_offset; ///< tc_offset_div2 * 2
@ -540,37 +542,41 @@ typedef struct SliceHeader {
ShortTermRPS slice_rps;
const ShortTermRPS *short_term_rps;
LongTermRPS long_term_rps;
uint8_t rpl_modification_flag[2];
unsigned int list_entry_lx[2][32];
uint8_t rpl_modification_flag[2];
uint8_t no_output_of_prior_pics_flag;
uint8_t slice_sample_adaptive_offset_flag[3];
uint8_t slice_temporal_mvp_enabled_flag;
unsigned int nb_refs[2];
uint8_t slice_sample_adaptive_offset_flag[3];
uint8_t mvd_l1_zero_flag;
uint8_t cabac_init_flag;
uint8_t disable_deblocking_filter_flag; ///< slice_header_disable_deblocking_filter_flag
uint8_t slice_loop_filter_across_slices_enabled_flag;
uint8_t collocated_list;
unsigned int collocated_ref_idx;
int slice_qp_delta;
int slice_cb_qp_offset;
int slice_cr_qp_offset;
uint8_t disable_deblocking_filter_flag; ///< slice_header_disable_deblocking_filter_flag
int beta_offset; ///< beta_offset_div2 * 2
int tc_offset; ///< tc_offset_div2 * 2
int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand
uint8_t slice_loop_filter_across_slices_enabled_flag;
int *entry_point_offset;
int * offset;
int * size;
int num_entry_point_offsets;
int8_t slice_qp;
uint8_t luma_log2_weight_denom;
int16_t chroma_log2_weight_denom;
@ -579,15 +585,12 @@ typedef struct SliceHeader {
int16_t chroma_weight_l1[16][2];
int16_t luma_weight_l1[16];
int16_t luma_offset_l0[16];
int16_t chroma_offset_l0[16][2];
int16_t luma_offset_l1[16];
int16_t chroma_offset_l1[16][2];
// Inferred parameters
int8_t slice_qp;
int slice_ctb_addr_rs;
} SliceHeader;
@ -596,10 +599,12 @@ typedef struct CodingTree {
} CodingTree;
typedef struct CodingUnit {
uint8_t cu_transquant_bypass_flag;
int x;
int y;
enum PredMode pred_mode; ///< PredMode
enum PartMode part_mode; ///< PartMode
uint8_t rqt_root_cbf;
uint8_t pcm_flag;
@ -607,10 +612,7 @@ typedef struct CodingUnit {
// Inferred parameters
uint8_t intra_split_flag; ///< IntraSplitFlag
uint8_t max_trafo_depth; ///< MaxTrafoDepth
int x;
int y;
uint8_t cu_transquant_bypass_flag;
} CodingUnit;
typedef struct Mv {
@ -635,12 +637,12 @@ typedef struct NeighbourAvailable {
} NeighbourAvailable;
typedef struct PredictionUnit {
uint8_t merge_flag;
int mpm_idx;
int rem_intra_luma_pred_mode;
uint8_t intra_pred_mode[4];
uint8_t intra_pred_mode_c;
Mv mvd;
uint8_t merge_flag;
uint8_t intra_pred_mode_c;
} PredictionUnit;
typedef struct TransformTree {
@ -656,13 +658,11 @@ typedef struct TransformUnit {
int cu_qp_delta;
// Inferred parameters;
uint8_t is_cu_qp_delta_coded;
int cur_intra_pred_mode;
uint8_t is_cu_qp_delta_coded;
} TransformUnit;
typedef struct SAOParams {
uint8_t type_idx[3]; ///< sao_type_idx
int offset_abs[3][4]; ///< sao_offset_abs
int offset_sign[3][4]; ///< sao_offset_sign
@ -670,8 +670,9 @@ typedef struct SAOParams {
int eo_class[3]; ///< sao_eo_class
// Inferred parameters
int offset_val[3][5]; ///<SaoOffsetVal
uint8_t type_idx[3]; ///< sao_type_idx
} SAOParams;
typedef struct DBParams {
@ -686,17 +687,18 @@ typedef struct DBParams {
typedef struct HEVCFrame {
AVFrame *frame;
ThreadFrame tf;
int poc;
MvField *tab_mvf;
RefPicList *refPicList;
RefPicListTab **rpl_tab;
int ctb_count;
int poc;
struct HEVCFrame *collocated_ref;
/**
* A combination of HEVC_FRAME_FLAG_*
*/
uint8_t flags;
HEVCWindow window;
AVBufferRef *tab_mvf_buf;
AVBufferRef *rpl_tab_buf;
AVBufferRef *rpl_buf;
/**
* A sequence counter, so that old frames are output first
@ -704,31 +706,35 @@ typedef struct HEVCFrame {
*/
uint16_t sequence;
HEVCWindow window;
AVBufferRef *tab_mvf_buf;
AVBufferRef *rpl_tab_buf;
AVBufferRef *rpl_buf;
/**
* A combination of HEVC_FRAME_FLAG_*
*/
uint8_t flags;
} HEVCFrame;
typedef struct HEVCNAL {
uint8_t *rbsp_buffer;
int rbsp_buffer_size;
const uint8_t *data;
int size;
const uint8_t *data;
} HEVCNAL;
typedef struct HEVCLocalContext {
DECLARE_ALIGNED(16, int16_t, mc_buffer[(MAX_PB_SIZE + 7) * MAX_PB_SIZE]);
uint8_t cabac_state[HEVC_CONTEXTS];
uint8_t first_qp_group;
GetBitContext gb;
CABACContext cc;
TransformTree tt;
TransformUnit tu;
uint8_t first_qp_group;
int8_t qp_y;
int8_t curr_qp_y;
uint8_t slice_or_tiles_left_boundary;
uint8_t slice_or_tiles_up_boundary;
TransformUnit tu;
uint8_t ctb_left_flag;
uint8_t ctb_up_flag;
uint8_t ctb_up_right_flag;
@ -742,7 +748,9 @@ typedef struct HEVCLocalContext {
CodingUnit cu;
PredictionUnit pu;
NeighbourAvailable na;
DECLARE_ALIGNED(16, int16_t, mc_buffer[(MAX_PB_SIZE + 7) * MAX_PB_SIZE]);
uint8_t slice_or_tiles_left_boundary;
uint8_t slice_or_tiles_up_boundary;
} HEVCLocalContext;
typedef struct HEVCContext {
@ -762,6 +770,9 @@ typedef struct HEVCContext {
uint8_t *cabac_state;
/** 1 if the independent slice segment header was successfully parsed */
uint8_t slice_initialized;
AVFrame *frame;
AVFrame *sao_frame;
AVFrame *tmp_frame;
@ -773,6 +784,9 @@ typedef struct HEVCContext {
AVBufferRef *sps_list[MAX_SPS_COUNT];
AVBufferRef *pps_list[MAX_PPS_COUNT];
AVBufferPool *tab_mvf_pool;
AVBufferPool *rpl_tab_pool;
///< candidate references for the current frame
RefPicList rps[5];
@ -844,25 +858,19 @@ typedef struct HEVCContext {
int nb_nals;
int nals_allocated;
int nuh_layer_id;
// for checking the frame checksums
struct AVMD5 *md5_ctx;
uint8_t md5[3][16];
uint8_t is_md5;
/** 1 if the independent slice segment header was successfully parsed */
uint8_t slice_initialized;
int strict_def_disp_win;
int context_initialized;
int is_nalff; ///< this flag is != 0 if bitstream is encapsulated
///< as a format defined in 14496-15
int strict_def_disp_win;
int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4)
int nuh_layer_id;
AVBufferPool *tab_mvf_pool;
AVBufferPool *rpl_tab_pool;
} HEVCContext;
int ff_hevc_decode_short_term_rps(HEVCContext *s, ShortTermRPS *rps,

View File

@ -656,7 +656,7 @@ int ff_hevc_cu_transquant_bypass_flag_decode(HEVCContext *s)
int ff_hevc_skip_flag_decode(HEVCContext *s, int x0, int y0, int x_cb, int y_cb)
{
int pic_width_in_ctb = s->sps->width >> s->sps->log2_min_coding_block_size;
int min_cb_width = s->sps->width >> s->sps->log2_min_cb_size;
int inc = 0;
int x0b = x0 & ((1 << s->sps->log2_ctb_size) - 1);
int y0b = y0 & ((1 << s->sps->log2_ctb_size) - 1);
@ -709,8 +709,8 @@ int ff_hevc_split_coding_unit_flag_decode(HEVCContext *s, int ct_depth, int x0,
int inc = 0, depth_left = 0, depth_top = 0;
int x0b = x0 & ((1 << s->sps->log2_ctb_size) - 1);
int y0b = y0 & ((1 << s->sps->log2_ctb_size) - 1);
int x_cb = x0 >> s->sps->log2_min_coding_block_size;
int y_cb = y0 >> s->sps->log2_min_coding_block_size;
int x_cb = x0 >> s->sps->log2_min_cb_size;
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];
@ -726,7 +726,7 @@ int ff_hevc_part_mode_decode(HEVCContext *s, int log2_cb_size)
{
if (GET_CABAC(elem_offset[PART_MODE])) // 1
return PART_2Nx2N;
if (log2_cb_size == s->sps->log2_min_coding_block_size) {
if (log2_cb_size == s->sps->log2_min_cb_size) {
if (s->HEVClc->cu.pred_mode == MODE_INTRA) // 0
return PART_NxN;
if (GET_CABAC(elem_offset[PART_MODE] + 1)) // 01

View File

@ -78,10 +78,10 @@ static int get_qPy_pred(HEVCContext *s, int xC, int yC, int xBase, int yBase, in
int MinCuQpDeltaSizeMask = (1 << (s->sps->log2_ctb_size - s->pps->diff_cu_qp_delta_depth)) - 1;
int xQgBase = xBase - ( xBase & MinCuQpDeltaSizeMask );
int yQgBase = yBase - ( yBase & MinCuQpDeltaSizeMask );
int pic_width = s->sps->width >> s->sps->log2_min_coding_block_size;
int pic_height = s->sps->height >> s->sps->log2_min_coding_block_size;
int x_cb = xQgBase >> s->sps->log2_min_coding_block_size;
int y_cb = yQgBase >> s->sps->log2_min_coding_block_size;
int min_cb_width = s->sps->min_cb_width;
int min_cb_height = s->sps->min_cb_height;
int x_cb = xQgBase >> s->sps->log2_min_cb_size;
int y_cb = yQgBase >> s->sps->log2_min_cb_size;
int availableA = (xBase & ctb_size_mask) && (xQgBase & ctb_size_mask);
int availableB = (yBase & ctb_size_mask) && (yQgBase & ctb_size_mask);
int qPy_pred;
@ -115,22 +115,22 @@ static int get_qPy_pred(HEVCContext *s, int xC, int yC, int xBase, int yBase, in
{ 1, 0, 3, 2, 5, 4, 7, 6},
{ 0, 1, 2, 3, 4, 5, 6, 7}
};
int xC0b = (xC - (xC & ctb_size_mask)) >> s->sps->log2_min_coding_block_size;
int yC0b = (yC - (yC & ctb_size_mask)) >> s->sps->log2_min_coding_block_size;
int idxX = (xQgBase & ctb_size_mask) >> s->sps->log2_min_coding_block_size;
int idxY = (yQgBase & ctb_size_mask) >> s->sps->log2_min_coding_block_size;
int idx_mask = ctb_size_mask >> s->sps->log2_min_coding_block_size;
int xC0b = (xC - (xC & ctb_size_mask)) >> s->sps->log2_min_cb_size;
int yC0b = (yC - (yC & ctb_size_mask)) >> s->sps->log2_min_cb_size;
int idxX = (xQgBase & ctb_size_mask) >> s->sps->log2_min_cb_size;
int idxY = (yQgBase & ctb_size_mask) >> s->sps->log2_min_cb_size;
int idx_mask = ctb_size_mask >> s->sps->log2_min_cb_size;
int x, y;
x = FFMIN(xC0b + offsetX[idxX][idxY], pic_width - 1);
y = FFMIN(yC0b + (offsetY[idxX][idxY] & idx_mask), pic_height - 1);
x = FFMIN(xC0b + offsetX[idxX][idxY], min_cb_width - 1);
y = FFMIN(yC0b + (offsetY[idxX][idxY] & idx_mask), min_cb_height - 1);
if (xC0b == (lc->start_of_tiles_x >> s->sps->log2_min_coding_block_size) &&
if (xC0b == (lc->start_of_tiles_x >> s->sps->log2_min_cb_size) &&
offsetX[idxX][idxY] == -1) {
x = (lc->end_of_tiles_x >> s->sps->log2_min_coding_block_size) - 1;
x = (lc->end_of_tiles_x >> s->sps->log2_min_cb_size) - 1;
y = yC0b - 1;
}
qPy_pred = s->qp_y_tab[y * pic_width + x];
qPy_pred = s->qp_y_tab[y * min_cb_width + x];
}
}
@ -138,13 +138,13 @@ static int get_qPy_pred(HEVCContext *s, int xC, int yC, int xBase, int yBase, in
if (availableA == 0)
qPy_a = qPy_pred;
else
qPy_a = s->qp_y_tab[(x_cb - 1) + y_cb * pic_width];
qPy_a = s->qp_y_tab[(x_cb - 1) + y_cb * min_cb_width];
// qPy_b
if (availableB == 0)
qPy_b = qPy_pred;
else
qPy_b = s->qp_y_tab[x_cb + (y_cb - 1) * pic_width];
qPy_b = s->qp_y_tab[x_cb + (y_cb - 1) * min_cb_width];
return (qPy_a + qPy_b + 1) >> 1;
}
@ -162,11 +162,10 @@ void ff_hevc_set_qPy(HEVCContext *s, int xC, int yC, int xBase, int yBase, int l
static int get_qPy(HEVCContext *s, int xC, int yC)
{
int log2_min_cb_size = s->sps->log2_min_coding_block_size;
int pic_width = s->sps->width>>log2_min_cb_size;
int log2_min_cb_size = s->sps->log2_min_cb_size;
int x = xC >> log2_min_cb_size;
int y = yC >> log2_min_cb_size;
return s->qp_y_tab[x + y * pic_width];
return s->qp_y_tab[x + y * s->sps->min_cb_width];
}
static void copy_CTB(uint8_t *dst, uint8_t *src, int width, int height, int stride)
@ -300,14 +299,13 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
static int get_pcm(HEVCContext *s, int x, int y)
{
int log2_min_pu_size = s->sps->log2_min_pu_size;
int pic_width_in_min_pu = s->sps->width >> s->sps->log2_min_pu_size;
int pic_height_in_min_pu = s->sps->height >> s->sps->log2_min_pu_size;
int x_pu = x >> log2_min_pu_size;
int y_pu = y >> log2_min_pu_size;
if (x < 0 || x_pu >= pic_width_in_min_pu || y < 0 || y_pu >= pic_height_in_min_pu)
if (x < 0 || x_pu >= s->sps->min_pu_width ||
y < 0 || y_pu >= s->sps->min_pu_height)
return 2;
return s->is_pcm[y_pu * pic_width_in_min_pu + x_pu];
return s->is_pcm[y_pu * s->sps->min_pu_width + x_pu];
}
#define TC_CALC(qp, bs) tctable[av_clip((qp) + DEFAULT_INTRA_TC_OFFSET * ((bs) - 1) + ((tc_offset >> 1) << 1), 0, MAX_QP + DEFAULT_INTRA_TC_OFFSET)]
@ -555,10 +553,10 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int l
{
MvField *tab_mvf = s->ref->tab_mvf;
int log2_min_pu_size = s->sps->log2_min_pu_size;
int log2_min_tu_size = s->sps->log2_min_transform_block_size;
int pic_width_in_min_pu = s->sps->width >> log2_min_pu_size;
int pic_width_in_min_tu = s->sps->width >> log2_min_tu_size;
int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * pic_width_in_min_pu + (x0 >> log2_min_pu_size)].is_intra;
int log2_min_tu_size = s->sps->log2_min_tb_size;
int min_pu_width = s->sps->min_pu_width;
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;
@ -572,10 +570,10 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int l
for (i = 0; i < (1 << log2_trafo_size); i += 4) {
int x_pu = (x0 + i) >> log2_min_pu_size;
int x_tu = (x0 + i) >> log2_min_tu_size;
MvField *top = &tab_mvf[yp_pu * pic_width_in_min_pu + x_pu];
MvField *curr = &tab_mvf[yq_pu * pic_width_in_min_pu + x_pu];
uint8_t top_cbf_luma = s->cbf_luma[yp_tu * pic_width_in_min_tu + x_tu];
uint8_t curr_cbf_luma = s->cbf_luma[yq_tu * pic_width_in_min_tu + x_tu];
MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu];
MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
uint8_t top_cbf_luma = s->cbf_luma[yp_tu * min_tu_width + x_tu];
uint8_t curr_cbf_luma = s->cbf_luma[yq_tu * min_tu_width + x_tu];
RefPicList* top_refPicList = ff_hevc_get_ref_list(s, s->ref, x0 + i, y0 - 1);
bs = boundary_strength(s, curr, curr_cbf_luma, top, top_cbf_luma, top_refPicList, 1);
@ -602,10 +600,10 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int l
for (i = 0; i < (1<<log2_trafo_size); i += 4) {
int x_pu = (x0 + i) >> log2_min_pu_size;
int x_tu = (x0 + i) >> log2_min_tu_size;
MvField *top = &tab_mvf[yp_pu * pic_width_in_min_pu + x_pu];
MvField *curr = &tab_mvf[yq_pu * pic_width_in_min_pu + x_pu];
uint8_t top_cbf_luma = s->cbf_luma[yp_tu * pic_width_in_min_tu + x_tu];
uint8_t curr_cbf_luma = s->cbf_luma[yq_tu * pic_width_in_min_tu + x_tu];
MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu];
MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
uint8_t top_cbf_luma = s->cbf_luma[yp_tu * min_tu_width + x_tu];
uint8_t curr_cbf_luma = s->cbf_luma[yq_tu * min_tu_width + x_tu];
RefPicList* top_refPicList = ff_hevc_get_ref_list(s, s->ref, x0 + i, y0 + j - 1);
bs = boundary_strength(s, curr, curr_cbf_luma, top, top_cbf_luma, top_refPicList, 0);
@ -626,11 +624,11 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int l
for (i = 0; i < (1 << log2_trafo_size); i += 4) {
int y_pu = (y0 + i) >> log2_min_pu_size;
int y_tu = (y0 + i) >> log2_min_tu_size;
MvField *left = &tab_mvf[y_pu * pic_width_in_min_pu + xp_pu];
MvField *curr = &tab_mvf[y_pu * pic_width_in_min_pu + xq_pu];
MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
uint8_t left_cbf_luma = s->cbf_luma[y_tu * pic_width_in_min_tu + xp_tu];
uint8_t curr_cbf_luma = s->cbf_luma[y_tu * pic_width_in_min_tu + xq_tu];
uint8_t left_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xp_tu];
uint8_t curr_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xq_tu];
RefPicList* left_refPicList = ff_hevc_get_ref_list(s, s->ref, x0 - 1, y0 + i);
bs = boundary_strength(s, curr, curr_cbf_luma, left, left_cbf_luma, left_refPicList, 1);
@ -656,10 +654,10 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int l
int xq_pu = (x0 + i) >> log2_min_pu_size;
int xp_tu = (x0 + i - 1) >> log2_min_tu_size;
int xq_tu = (x0 + i) >> log2_min_tu_size;
MvField *left = &tab_mvf[y_pu * pic_width_in_min_pu + xp_pu];
MvField *curr = &tab_mvf[y_pu * pic_width_in_min_pu + xq_pu];
uint8_t left_cbf_luma = s->cbf_luma[y_tu * pic_width_in_min_tu + xp_tu];
uint8_t curr_cbf_luma = s->cbf_luma[y_tu * pic_width_in_min_tu + xq_tu];
MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
uint8_t left_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xp_tu];
uint8_t curr_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xq_tu];
RefPicList* left_refPicList = ff_hevc_get_ref_list(s, s->ref, x0 + i - 1, y0 + j);
bs = boundary_strength(s, curr, curr_cbf_luma, left, left_cbf_luma, left_refPicList, 0);

View File

@ -65,8 +65,8 @@ static int z_scan_block_avail(HEVCContext *s, int xCurr, int yCurr,
{
#define MIN_TB_ADDR_ZS(x, y) \
s->pps->min_tb_addr_zs[(y) * s->sps->min_tb_width + (x)]
int Curr = MIN_TB_ADDR_ZS(xCurr >> s->sps->log2_min_transform_block_size,
yCurr >> s->sps->log2_min_transform_block_size);
int Curr = MIN_TB_ADDR_ZS(xCurr >> s->sps->log2_min_tb_size,
yCurr >> s->sps->log2_min_tb_size);
int N;
if ((xN < 0) || (yN < 0) ||
@ -74,8 +74,8 @@ static int z_scan_block_avail(HEVCContext *s, int xCurr, int yCurr,
(yN >= s->sps->height))
return 0;
N = MIN_TB_ADDR_ZS(xN >> s->sps->log2_min_transform_block_size,
yN >> s->sps->log2_min_transform_block_size);
N = MIN_TB_ADDR_ZS(xN >> s->sps->log2_min_tb_size,
yN >> s->sps->log2_min_tb_size);
return N <= Curr;
}
@ -230,7 +230,7 @@ static int derive_temporal_colocated_mvs(HEVCContext *s, MvField temp_col,
}
#define TAB_MVF(x, y) \
tab_mvf[(y) * pic_width_in_min_pu + x]
tab_mvf[(y) * min_pu_width + x]
#define TAB_MVF_PU(v) \
TAB_MVF(x##v##_pu, y##v##_pu)
@ -256,7 +256,7 @@ static int temporal_luma_motion_vector(HEVCContext *s, int x0, int y0,
int xPCtr, yPCtr;
int xPCtr_pu;
int yPCtr_pu;
int pic_width_in_min_pu = s->sps->width >> s->sps->log2_min_pu_size;
int min_pu_width = s->sps->width >> s->sps->log2_min_pu_size;
int availableFlagLXCol = 0;
int colPic;
@ -342,7 +342,7 @@ static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0,
int xA1 = x0 - 1;
int yA1 = y0 + nPbH - 1;
int is_available_a1;
int pic_width_in_min_pu = s->sps->width >> s->sps->log2_min_pu_size;
int min_pu_width = s->sps->width >> s->sps->log2_min_pu_size;
int check_MER = 1;
int check_MER_1 = 1;
@ -734,7 +734,7 @@ void ff_hevc_luma_mv_merge_mode(HEVCContext *s, int x0, int y0, int nPbW,
}
static av_always_inline void dist_scale(HEVCContext *s, Mv * mv,
int pic_width_in_min_pu, int x, int y,
int min_pu_width, int x, int y,
int elist, int ref_idx_curr, int ref_idx)
{
RefPicList *refPicList = s->ref->refPicList;
@ -750,7 +750,7 @@ static int mv_mp_mode_mx(HEVCContext *s, int x, int y, int pred_flag_index,
Mv *mv, int ref_idx_curr, int ref_idx)
{
MvField *tab_mvf = s->ref->tab_mvf;
int pic_width_in_min_pu = s->sps->width >> s->sps->log2_min_pu_size;
int min_pu_width = s->sps->min_pu_width;
RefPicList *refPicList = s->ref->refPicList;
@ -767,7 +767,7 @@ 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)
{
MvField *tab_mvf = s->ref->tab_mvf;
int pic_width_in_min_pu = s->sps->width >> s->sps->log2_min_pu_size;
int min_pu_width = s->sps->min_pu_width;
RefPicList *refPicList = s->ref->refPicList;
int currIsLongTerm = refPicList[ref_idx_curr].isLongTerm[ref_idx];
@ -778,7 +778,7 @@ static int mv_mp_mode_mx_lt(HEVCContext *s, int x, int y, int pred_flag_index,
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, pic_width_in_min_pu, 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;
@ -802,7 +802,7 @@ void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW,
int availableFlagLXB0 = 0;
int availableFlagLXCol = 0;
int numMVPCandLX = 0;
int pic_width_in_min_pu = s->sps->width >> s->sps->log2_min_pu_size;
int min_pu_width = s->sps->min_pu_width;
int xA0, yA0;
int xA0_pu, yA0_pu;

View File

@ -552,7 +552,7 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
sps->max_sub_layers = get_bits(gb, 3) + 1;
if (sps->max_sub_layers > MAX_SUB_LAYERS) {
av_log(s->avctx, AV_LOG_ERROR, "vps_max_sub_layers out of range: %d\n",
av_log(s->avctx, AV_LOG_ERROR, "sps_max_sub_layers out of range: %d\n",
sps->max_sub_layers);
ret = AVERROR_INVALIDDATA;
goto err;
@ -685,14 +685,14 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
}
}
sps->log2_min_coding_block_size = get_ue_golomb_long(gb) + 3;
sps->log2_min_cb_size = get_ue_golomb_long(gb) + 3;
sps->log2_diff_max_min_coding_block_size = get_ue_golomb_long(gb);
sps->log2_min_transform_block_size = get_ue_golomb_long(gb) + 2;
sps->log2_min_tb_size = get_ue_golomb_long(gb) + 2;
log2_diff_max_min_transform_block_size = get_ue_golomb_long(gb);
sps->log2_max_trafo_size = log2_diff_max_min_transform_block_size + sps->log2_min_transform_block_size;
sps->log2_max_trafo_size = log2_diff_max_min_transform_block_size + sps->log2_min_tb_size;
if (sps->log2_min_transform_block_size >= sps->log2_min_coding_block_size) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid value for log2_min_transform_block_size");
if (sps->log2_min_tb_size >= sps->log2_min_cb_size) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid value for log2_min_tb_size");
ret = AVERROR_INVALIDDATA;
goto err;
}
@ -795,23 +795,25 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
}
// Inferred parameters
sps->log2_ctb_size = sps->log2_min_coding_block_size
sps->log2_ctb_size = sps->log2_min_cb_size
+ sps->log2_diff_max_min_coding_block_size;
sps->log2_min_pu_size = sps->log2_min_cb_size - 1;
sps->ctb_width = (sps->width + (1 << sps->log2_ctb_size) - 1) >> sps->log2_ctb_size;
sps->ctb_height = (sps->height + (1 << sps->log2_ctb_size) - 1) >> sps->log2_ctb_size;
sps->ctb_size = sps->ctb_width * sps->ctb_height;
sps->min_cb_width = sps->width >> sps->log2_min_coding_block_size;
sps->min_cb_height = sps->height >> sps->log2_min_coding_block_size;
sps->min_tb_width = sps->width >> sps->log2_min_transform_block_size;
sps->min_tb_height = sps->height >> sps->log2_min_transform_block_size;
sps->log2_min_pu_size = sps->log2_min_coding_block_size - 1;
sps->min_cb_width = sps->width >> sps->log2_min_cb_size;
sps->min_cb_height = sps->height >> sps->log2_min_cb_size;
sps->min_tb_width = sps->width >> sps->log2_min_tb_size;
sps->min_tb_height = sps->height >> sps->log2_min_tb_size;
sps->min_pu_width = sps->width >> sps->log2_min_pu_size;
sps->min_pu_height = sps->height >> sps->log2_min_pu_size;
sps->qp_bd_offset = 6 * (sps->bit_depth - 8);
if (sps->width & ((1 << sps->log2_min_coding_block_size) - 1) ||
sps->height & ((1 << sps->log2_min_coding_block_size) - 1)) {
if (sps->width & ((1 << sps->log2_min_cb_size) - 1) ||
sps->height & ((1 << sps->log2_min_cb_size) - 1)) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid coded frame dimensions.\n");
goto err;
}
@ -820,12 +822,12 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
av_log(s->avctx, AV_LOG_ERROR, "CTB size out of range: 2^%d\n", sps->log2_ctb_size);
goto err;
}
if (sps->max_transform_hierarchy_depth_inter > sps->log2_ctb_size - sps->log2_min_transform_block_size) {
if (sps->max_transform_hierarchy_depth_inter > sps->log2_ctb_size - sps->log2_min_tb_size) {
av_log(s->avctx, AV_LOG_ERROR, "max_transform_hierarchy_depth_inter out of range: %d\n",
sps->max_transform_hierarchy_depth_inter);
goto err;
}
if (sps->max_transform_hierarchy_depth_intra > sps->log2_ctb_size - sps->log2_min_transform_block_size) {
if (sps->max_transform_hierarchy_depth_intra > sps->log2_ctb_size - sps->log2_min_tb_size) {
av_log(s->avctx, AV_LOG_ERROR, "max_transform_hierarchy_depth_intra out of range: %d\n",
sps->max_transform_hierarchy_depth_intra);
goto err;
@ -915,7 +917,7 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
pps->num_tile_columns = 1;
pps->num_tile_rows = 1;
pps->uniform_spacing_flag = 1;
pps->pps_disable_deblocking_filter_flag = 0;
pps->disable_dbf = 0;
pps->beta_offset = 0;
pps->tc_offset = 0;
@ -1042,8 +1044,8 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
pps->deblocking_filter_control_present_flag = get_bits1(gb);
if (pps->deblocking_filter_control_present_flag) {
pps->deblocking_filter_override_enabled_flag = get_bits1(gb);
pps->pps_disable_deblocking_filter_flag = get_bits1(gb);
if (!pps->pps_disable_deblocking_filter_flag) {
pps->disable_dbf = get_bits1(gb);
if (!pps->disable_dbf) {
pps->beta_offset = get_se_golomb(gb) * 2;
pps->tc_offset = get_se_golomb(gb) * 2;
if (pps->beta_offset/2 < -6 || pps->beta_offset/2 > 6) {
@ -1206,7 +1208,7 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
}
}
log2_diff_ctb_min_tb_size = sps->log2_ctb_size - sps->log2_min_transform_block_size;
log2_diff_ctb_min_tb_size = sps->log2_ctb_size - sps->log2_min_tb_size;
for (y = 0; y < sps->min_tb_height; y++) {
for (x = 0; x < sps->min_tb_width; x++) {
int tb_x = x >> log2_diff_ctb_min_tb_size;

View File

@ -149,11 +149,11 @@ int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc)
int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)
{
do {
int nb_output = 0;
int min_poc = 0xFFFF;
int min_poc = INT_MAX;
int i, j, min_idx, ret;
do {
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) {
HEVCFrame *frame = &s->DPB[i];
if ((frame->flags & HEVC_FRAME_FLAG_OUTPUT) &&
@ -255,7 +255,7 @@ int ff_hevc_slice_rpl(HEVCContext *s)
while (rpl_tmp.nb_refs < sh->nb_refs[list_idx]) {
for (i = 0; i < FF_ARRAY_ELEMS(cand_lists); i++) {
RefPicList *rps = &s->rps[cand_lists[i]];
for (j = 0; j < rps->nb_refs; j++) {
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);
@ -340,8 +340,8 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
frame->frame->buf[i]->size);
} else {
for (i = 0; frame->frame->data[i]; i++)
for (y = 0; y < (s->height >> s->sps->vshift[i]); y++)
for (x = 0; x < (s->width >> s->sps->hshift[i]); x++) {
for (y = 0; y < (s->sps->height >> s->sps->vshift[i]); y++)
for (x = 0; x < (s->sps->width >> s->sps->hshift[i]); x++) {
AV_WN16(frame->frame->data[i] + y * frame->frame->linesize[i] + 2 * x,
1 << (s->sps->bit_depth - 1));
}
@ -387,8 +387,10 @@ int ff_hevc_frame_rps(HEVCContext *s)
RefPicList *rps = s->rps;
int i, ret;
if (!short_rps)
if (!short_rps) {
rps[0].nb_refs = rps[1].nb_refs = 0;
return 0;
}
/* clear the reference flags on all frames except the current one */
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) {

View File

@ -31,7 +31,7 @@ static void FUNC(intra_pred)(HEVCContext *s, int x0, int y0, int log2_size, int
#define PU(x) \
((x) >> s->sps->log2_min_pu_size)
#define MVF(x, y) \
(s->ref->tab_mvf[(x) + (y) * pic_width_in_min_pu])
(s->ref->tab_mvf[(x) + (y) * min_pu_width])
#define MVF_PU(x, y) \
MVF(PU(x0 + ((x) << hshift)), PU(y0 + ((y) << vshift)))
#define IS_INTRA(x, y) \
@ -71,17 +71,17 @@ static void FUNC(intra_pred)(HEVCContext *s, int x0, int y0, int log2_size, int
int vshift = s->sps->vshift[c_idx];
int size = (1 << log2_size);
int size_in_luma = size << hshift;
int size_in_tbs = size_in_luma >> s->sps->log2_min_transform_block_size;
int size_in_tbs = size_in_luma >> s->sps->log2_min_tb_size;
int x = x0 >> hshift;
int y = y0 >> vshift;
int x_tb = x0 >> s->sps->log2_min_transform_block_size;
int y_tb = y0 >> s->sps->log2_min_transform_block_size;
int x_tb = x0 >> s->sps->log2_min_tb_size;
int y_tb = y0 >> s->sps->log2_min_tb_size;
int cur_tb_addr = MIN_TB_ADDR_ZS(x_tb, y_tb);
ptrdiff_t stride = s->frame->linesize[c_idx] / sizeof(pixel);
pixel *src = (pixel*)s->frame->data[c_idx] + x + y * stride;
int pic_width_in_min_pu = PU(s->sps->width);
int min_pu_width = s->sps->min_pu_width;
enum IntraPredMode mode = c_idx ? lc->pu.intra_pred_mode_c :
lc->tu.cur_intra_pred_mode;
@ -116,15 +116,17 @@ static void FUNC(intra_pred)(HEVCContext *s, int x0, int y0, int log2_size, int
if (cand_bottom_left == 1 && on_pu_edge_x) {
int x_left_pu = PU(x0 - 1);
int y_bottom_pu = PU(y0 + size_in_luma);
int max = FFMIN(size_in_luma_pu, s->sps->min_pu_height - y_bottom_pu);
cand_bottom_left = 0;
for(i = 0; i < size_in_luma_pu; i++)
for (i = 0; i < max; i++)
cand_bottom_left |= MVF(x_left_pu, y_bottom_pu + i).is_intra;
}
if (cand_left == 1 && on_pu_edge_x) {
int x_left_pu = PU(x0 - 1);
int y_left_pu = PU(y0);
int max = FFMIN(size_in_luma_pu, s->sps->min_pu_height - y_left_pu);
cand_left = 0;
for(i = 0; i < size_in_luma_pu; i++)
for (i = 0; i < max; i++)
cand_left |= MVF(x_left_pu, y_left_pu + i).is_intra;
}
if (cand_up_left == 1) {
@ -135,15 +137,17 @@ static void FUNC(intra_pred)(HEVCContext *s, int x0, int y0, int log2_size, int
if (cand_up == 1 && on_pu_edge_y) {
int x_top_pu = PU(x0);
int y_top_pu = PU(y0 - 1);
int max = FFMIN(size_in_luma_pu, s->sps->min_pu_width - x_top_pu);
cand_up = 0;
for(i = 0; i < size_in_luma_pu; i++)
for (i = 0; i < max; i++)
cand_up |= MVF(x_top_pu + i, y_top_pu).is_intra;
}
if (cand_up_right == 1 && on_pu_edge_y) {
int y_top_pu = PU(y0 - 1);
int x_right_pu = PU(x0 + size_in_luma);
int max = FFMIN(size_in_luma_pu, s->sps->min_pu_width - x_right_pu);
cand_up_right = 0;
for(i = 0; i < size_in_luma_pu; i++)
for (i = 0; i < max; i++)
cand_up_right |= MVF(x_right_pu + i, y_top_pu).is_intra;
}
for (i = 0; i < 2 * MAX_TB_SIZE; i++) {