1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-07-11 14:30:22 +02:00

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer
2013-11-02 00:31:49 +01:00
parent 38612379bf
commit f578e5d937
12 changed files with 1122 additions and 1013 deletions

View File

@ -112,8 +112,10 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps)
goto fail; goto fail;
s->filter_slice_edges = av_malloc(ctb_count); s->filter_slice_edges = av_malloc(ctb_count);
s->tab_slice_address = av_malloc(pic_size_in_ctb * sizeof(*s->tab_slice_address)); s->tab_slice_address = av_malloc(pic_size_in_ctb *
s->qp_y_tab = av_malloc(pic_size_in_ctb * sizeof(*s->qp_y_tab)); sizeof(*s->tab_slice_address));
s->qp_y_tab = av_malloc(pic_size_in_ctb *
sizeof(*s->qp_y_tab));
if (!s->qp_y_tab || !s->filter_slice_edges || !s->tab_slice_address) if (!s->qp_y_tab || !s->filter_slice_edges || !s->tab_slice_address)
goto fail; goto fail;
@ -130,6 +132,7 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps)
goto fail; goto fail;
return 0; return 0;
fail: fail:
pic_arrays_free(s); pic_arrays_free(s);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@ -308,6 +311,7 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps)
s->sps = sps; s->sps = sps;
s->vps = s->vps_list[s->sps->vps_id]; s->vps = s->vps_list[s->sps->vps_id];
return 0; return 0;
fail: fail:
pic_arrays_free(s); pic_arrays_free(s);
s->sps = NULL; s->sps = NULL;
@ -366,7 +370,8 @@ static int hls_slice_header(HEVCContext *s)
s->sps->ctb_height); s->sps->ctb_height);
sh->slice_segment_addr = get_bits(gb, slice_address_length); sh->slice_segment_addr = get_bits(gb, slice_address_length);
if (sh->slice_segment_addr >= s->sps->ctb_width * s->sps->ctb_height) { if (sh->slice_segment_addr >= s->sps->ctb_width * s->sps->ctb_height) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n", av_log(s->avctx, AV_LOG_ERROR,
"Invalid slice segment address: %u.\n",
sh->slice_segment_addr); sh->slice_segment_addr);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
@ -388,7 +393,8 @@ static int hls_slice_header(HEVCContext *s)
skip_bits(gb, 1); // slice_reserved_undetermined_flag[] skip_bits(gb, 1); // slice_reserved_undetermined_flag[]
sh->slice_type = get_ue_golomb_long(gb); sh->slice_type = get_ue_golomb_long(gb);
if (!(sh->slice_type == I_SLICE || sh->slice_type == P_SLICE || if (!(sh->slice_type == I_SLICE ||
sh->slice_type == P_SLICE ||
sh->slice_type == B_SLICE)) { sh->slice_type == B_SLICE)) {
av_log(s->avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n", av_log(s->avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n",
sh->slice_type); sh->slice_type);
@ -537,7 +543,8 @@ static int hls_slice_header(HEVCContext *s)
sh->collocated_ref_idx = get_ue_golomb_long(gb); sh->collocated_ref_idx = get_ue_golomb_long(gb);
if (sh->collocated_ref_idx >= sh->nb_refs[sh->collocated_list]) { if (sh->collocated_ref_idx >= sh->nb_refs[sh->collocated_list]) {
av_log(s->avctx, AV_LOG_ERROR, av_log(s->avctx, AV_LOG_ERROR,
"Invalid collocated_ref_idx: %d.\n", sh->collocated_ref_idx); "Invalid collocated_ref_idx: %d.\n",
sh->collocated_ref_idx);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
} }
@ -714,7 +721,8 @@ static void hls_sao_param(HEVCContext *s, int rx, int ry)
if (sao->type_idx[c_idx] == SAO_BAND) { if (sao->type_idx[c_idx] == SAO_BAND) {
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (sao->offset_abs[c_idx][i]) { if (sao->offset_abs[c_idx][i]) {
SET_SAO(offset_sign[c_idx][i], ff_hevc_sao_offset_sign_decode(s)); SET_SAO(offset_sign[c_idx][i],
ff_hevc_sao_offset_sign_decode(s));
} else { } else {
sao->offset_sign[c_idx][i] = 0; sao->offset_sign[c_idx][i] = 0;
} }
@ -741,7 +749,6 @@ static void hls_sao_param(HEVCContext *s, int rx, int ry)
#undef SET_SAO #undef SET_SAO
#undef CTB #undef CTB
static void hls_transform_unit(HEVCContext *s, int x0, int y0, static void hls_transform_unit(HEVCContext *s, int x0, int y0,
int xBase, int yBase, int cb_xBase, int cb_yBase, int xBase, int yBase, int cb_xBase, int cb_yBase,
int log2_cb_size, int log2_trafo_size, int log2_cb_size, int log2_trafo_size,
@ -761,7 +768,8 @@ static void hls_transform_unit(HEVCContext *s, int x0, int y0,
s->hpc.intra_pred(s, x0, y0, log2_trafo_size - 1, 2); s->hpc.intra_pred(s, x0, y0, log2_trafo_size - 1, 2);
} else if (blk_idx == 3) { } else if (blk_idx == 3) {
trafo_size = trafo_size << (s->sps->hshift[1]); trafo_size = trafo_size << (s->sps->hshift[1]);
ff_hevc_set_neighbour_available(s, xBase, yBase, trafo_size, trafo_size); ff_hevc_set_neighbour_available(s, xBase, yBase,
trafo_size, trafo_size);
s->hpc.intra_pred(s, xBase, yBase, log2_trafo_size, 1); s->hpc.intra_pred(s, xBase, yBase, log2_trafo_size, 1);
s->hpc.intra_pred(s, xBase, yBase, log2_trafo_size, 2); s->hpc.intra_pred(s, xBase, yBase, log2_trafo_size, 2);
} }
@ -860,7 +868,8 @@ static void hls_transform_tree(HEVCContext *s, int x0, int y0,
lc->tt.inter_split_flag = (s->sps->max_transform_hierarchy_depth_inter == 0 && lc->tt.inter_split_flag = (s->sps->max_transform_hierarchy_depth_inter == 0 &&
lc->cu.pred_mode == MODE_INTER && lc->cu.pred_mode == MODE_INTER &&
lc->cu.part_mode != PART_2Nx2N && trafo_depth == 0); lc->cu.part_mode != PART_2Nx2N &&
trafo_depth == 0);
if (log2_trafo_size <= s->sps->log2_max_trafo_size && if (log2_trafo_size <= s->sps->log2_max_trafo_size &&
log2_trafo_size > s->sps->log2_min_tb_size && log2_trafo_size > s->sps->log2_min_tb_size &&
@ -880,7 +889,8 @@ static void hls_transform_tree(HEVCContext *s, int x0, int y0,
ff_hevc_cbf_cb_cr_decode(s, trafo_depth); ff_hevc_cbf_cb_cr_decode(s, trafo_depth);
} }
if (trafo_depth == 0 || SAMPLE_CBF(lc->tt.cbf_cr[trafo_depth - 1], xBase, yBase)) { if (trafo_depth == 0 ||
SAMPLE_CBF(lc->tt.cbf_cr[trafo_depth - 1], xBase, yBase)) {
SAMPLE_CBF(lc->tt.cbf_cr[trafo_depth], x0, y0) = SAMPLE_CBF(lc->tt.cbf_cr[trafo_depth], x0, y0) =
ff_hevc_cbf_cb_cr_decode(s, trafo_depth); ff_hevc_cbf_cb_cr_decode(s, trafo_depth);
} }
@ -926,7 +936,8 @@ static void hls_transform_tree(HEVCContext *s, int x0, int y0,
ff_hevc_deblocking_boundary_strengths(s, x0, y0, log2_trafo_size, ff_hevc_deblocking_boundary_strengths(s, x0, y0, log2_trafo_size,
lc->slice_or_tiles_up_boundary, lc->slice_or_tiles_up_boundary,
lc->slice_or_tiles_left_boundary); lc->slice_or_tiles_left_boundary);
if (s->pps->transquant_bypass_enable_flag && lc->cu.cu_transquant_bypass_flag) if (s->pps->transquant_bypass_enable_flag &&
lc->cu.cu_transquant_bypass_flag)
set_deblocking_bypass(s, x0, y0, log2_trafo_size); set_deblocking_bypass(s, x0, y0, log2_trafo_size);
} }
} }
@ -1001,7 +1012,8 @@ static void luma_mc(HEVCContext *s, int16_t *dst, ptrdiff_t dststride,
int offset = extra_top * srcstride + (extra_left << s->sps->pixel_shift); int offset = extra_top * srcstride + (extra_left << s->sps->pixel_shift);
s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, srcstride, src - offset, srcstride, s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, srcstride, src - offset, srcstride,
block_w + ff_hevc_qpel_extra[mx], block_h + ff_hevc_qpel_extra[my], block_w + ff_hevc_qpel_extra[mx],
block_h + ff_hevc_qpel_extra[my],
x_off - extra_left, y_off - extra_top, x_off - extra_left, y_off - extra_top,
pic_width, pic_height); pic_width, pic_height);
src = lc->edge_emu_buffer + offset; src = lc->edge_emu_buffer + offset;
@ -1024,8 +1036,9 @@ static void luma_mc(HEVCContext *s, int16_t *dst, ptrdiff_t dststride,
* @param block_w width of block * @param block_w width of block
* @param block_h height of block * @param block_h height of block
*/ */
static void chroma_mc(HEVCContext *s, int16_t *dst1, int16_t *dst2, ptrdiff_t dststride, AVFrame *ref, static void chroma_mc(HEVCContext *s, int16_t *dst1, int16_t *dst2,
const Mv *mv, int x_off, int y_off, int block_w, int block_h) ptrdiff_t dststride, AVFrame *ref, const Mv *mv,
int x_off, int y_off, int block_w, int block_h)
{ {
HEVCLocalContext *lc = s->HEVClc; HEVCLocalContext *lc = s->HEVClc;
uint8_t *src1 = ref->data[1]; uint8_t *src1 = ref->data[1];
@ -1124,8 +1137,11 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0,
else else
merge_idx = 0; merge_idx = 0;
ff_hevc_luma_mv_merge_mode(s, x0, y0, 1 << log2_cb_size, 1 << log2_cb_size, ff_hevc_luma_mv_merge_mode(s, x0, y0,
log2_cb_size, partIdx, merge_idx, &current_mv); 1 << log2_cb_size,
1 << log2_cb_size,
log2_cb_size, partIdx,
merge_idx, &current_mv);
x_pu = x0 >> s->sps->log2_min_pu_size; x_pu = x0 >> s->sps->log2_min_pu_size;
y_pu = y0 >> s->sps->log2_min_pu_size; y_pu = y0 >> s->sps->log2_min_pu_size;
@ -1163,7 +1179,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0,
ff_hevc_hls_mvd_coding(s, x0, y0, 0); ff_hevc_hls_mvd_coding(s, x0, y0, 0);
mvp_flag[0] = ff_hevc_mvp_lx_flag_decode(s); mvp_flag[0] = ff_hevc_mvp_lx_flag_decode(s);
ff_hevc_luma_mv_mvp_mode(s, x0, y0, nPbW, nPbH, log2_cb_size, ff_hevc_luma_mv_mvp_mode(s, x0, y0, nPbW, nPbH, log2_cb_size,
partIdx, merge_idx, &current_mv, mvp_flag[0], 0); partIdx, merge_idx, &current_mv,
mvp_flag[0], 0);
current_mv.mv[0].x += lc->pu.mvd.x; current_mv.mv[0].x += lc->pu.mvd.x;
current_mv.mv[0].y += lc->pu.mvd.y; current_mv.mv[0].y += lc->pu.mvd.y;
} }
@ -1184,7 +1201,8 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0,
current_mv.pred_flag[1] = 1; current_mv.pred_flag[1] = 1;
mvp_flag[1] = ff_hevc_mvp_lx_flag_decode(s); mvp_flag[1] = ff_hevc_mvp_lx_flag_decode(s);
ff_hevc_luma_mv_mvp_mode(s, x0, y0, nPbW, nPbH, log2_cb_size, ff_hevc_luma_mv_mvp_mode(s, x0, y0, nPbW, nPbH, log2_cb_size,
partIdx, merge_idx, &current_mv, mvp_flag[1], 1); partIdx, merge_idx, &current_mv,
mvp_flag[1], 1);
current_mv.mv[1].x += lc->pu.mvd.x; current_mv.mv[1].x += lc->pu.mvd.x;
current_mv.mv[1].y += lc->pu.mvd.y; current_mv.mv[1].y += lc->pu.mvd.y;
} }
@ -1523,11 +1541,11 @@ static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size)
lc->cu.x = x0; lc->cu.x = x0;
lc->cu.y = y0; lc->cu.y = y0;
lc->cu.rqt_root_cbf = 1; lc->cu.rqt_root_cbf = 1;
lc->cu.pred_mode = MODE_INTRA; lc->cu.pred_mode = MODE_INTRA;
lc->cu.part_mode = PART_2Nx2N; lc->cu.part_mode = PART_2Nx2N;
lc->cu.intra_split_flag = 0; lc->cu.intra_split_flag = 0;
lc->cu.pcm_flag = 0; lc->cu.pcm_flag = 0;
SAMPLE_CTB(s->skip_flag, x_cb, y_cb) = 0; SAMPLE_CTB(s->skip_flag, x_cb, y_cb) = 0;
for (x = 0; x < 4; x++) for (x = 0; x < 4; x++)
lc->pu.intra_pred_mode[x] = 1; lc->pu.intra_pred_mode[x] = 1;
@ -1725,7 +1743,8 @@ static int hls_coding_quadtree(HEVCContext *s, int x0, int y0,
return 0; return 0;
} }
static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, int ctb_addr_ts) static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb,
int ctb_addr_ts)
{ {
HEVCLocalContext *lc = s->HEVClc; HEVCLocalContext *lc = s->HEVClc;
int ctb_size = 1 << s->sps->log2_ctb_size; int ctb_size = 1 << s->sps->log2_ctb_size;
@ -2076,6 +2095,7 @@ static int hevc_frame_start(HEVCContext *s)
ff_thread_finish_setup(s->avctx); ff_thread_finish_setup(s->avctx);
return 0; return 0;
fail: fail:
if (s->ref && s->threads_type == FF_THREAD_FRAME) if (s->ref && s->threads_type == FF_THREAD_FRAME)
ff_thread_report_progress(&s->ref->tf, INT_MAX, 0); ff_thread_report_progress(&s->ref->tf, INT_MAX, 0);
@ -2316,8 +2336,8 @@ int ff_hevc_extract_rbsp(HEVCContext *s, const uint8_t *src, int length,
} }
while (si < length) while (si < length)
dst[di++] = src[si++]; dst[di++] = src[si++];
nsc:
nsc:
memset(dst + di, 0, FF_INPUT_BUFFER_PADDING_SIZE); memset(dst + di, 0, FF_INPUT_BUFFER_PADDING_SIZE);
nal->data = dst; nal->data = dst;
@ -2378,7 +2398,8 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
goto fail; goto fail;
} }
s->nals = tmp; s->nals = tmp;
memset(s->nals + s->nals_allocated, 0, (new_size - s->nals_allocated) * sizeof(*tmp)); memset(s->nals + s->nals_allocated, 0,
(new_size - s->nals_allocated) * sizeof(*tmp));
av_reallocp_array(&s->skipped_bytes_nal, new_size, sizeof(*s->skipped_bytes_nal)); av_reallocp_array(&s->skipped_bytes_nal, new_size, sizeof(*s->skipped_bytes_nal));
av_reallocp_array(&s->skipped_bytes_pos_size_nal, new_size, sizeof(*s->skipped_bytes_pos_size_nal)); av_reallocp_array(&s->skipped_bytes_pos_size_nal, new_size, sizeof(*s->skipped_bytes_pos_size_nal));
av_reallocp_array(&s->skipped_bytes_pos_nal, new_size, sizeof(*s->skipped_bytes_pos_nal)); av_reallocp_array(&s->skipped_bytes_pos_nal, new_size, sizeof(*s->skipped_bytes_pos_nal));
@ -2691,6 +2712,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx)
s->context_initialized = 1; s->context_initialized = 1;
return 0; return 0;
fail: fail:
hevc_decode_free(avctx); hevc_decode_free(avctx);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@ -2803,7 +2825,8 @@ static int hevc_decode_extradata(HEVCContext *s)
ret = decode_nal_units(s, gb.buffer, nalsize); ret = decode_nal_units(s, gb.buffer, nalsize);
if (ret < 0) { if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, av_log(avctx, AV_LOG_ERROR,
"Decoding nal unit %d %d from hvcC failed\n", type, i); "Decoding nal unit %d %d from hvcC failed\n",
type, i);
return ret; return ret;
} }
bytestream2_skip(&gb, nalsize); bytestream2_skip(&gb, nalsize);
@ -2907,5 +2930,6 @@ AVCodec ff_hevc_decoder = {
.flush = hevc_decode_flush, .flush = hevc_decode_flush,
.update_thread_context = hevc_update_thread_context, .update_thread_context = hevc_update_thread_context,
.init_thread_copy = hevc_init_thread_copy, .init_thread_copy = hevc_init_thread_copy,
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS | CODEC_CAP_FRAME_THREADS, .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY |
CODEC_CAP_SLICE_THREADS | CODEC_CAP_FRAME_THREADS,
}; };

View File

@ -132,8 +132,7 @@ static const int elem_offset[sizeof(num_bins_in_se)] = {
* Indexed by init_type * Indexed by init_type
*/ */
static const uint8_t init_values[3][HEVC_CONTEXTS] = { static const uint8_t init_values[3][HEVC_CONTEXTS] = {
{ { // sao_merge_flag
// sao_merge_flag
153, 153,
// sao_type_idx // sao_type_idx
200, 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, 140, 92, 137, 138, 140, 152, 138, 139, 153, 74, 149, 92, 139, 107,
122, 152, 140, 179, 166, 182, 140, 227, 122, 197, 122, 152, 140, 179, 166, 182, 140, 227, 122, 197,
// coeff_abs_level_greater2_flag // coeff_abs_level_greater2_flag
138, 153, 136, 167, 152, 152, 138, 153, 136, 167, 152, 152, },
}, { // sao_merge_flag
{
// sao_merge_flag
153, 153,
// sao_type_idx // sao_type_idx
185, 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, 154, 196, 196, 167, 154, 152, 167, 182, 182, 134, 149, 136, 153, 121,
136, 137, 169, 194, 166, 167, 154, 167, 137, 182, 136, 137, 169, 194, 166, 167, 154, 167, 137, 182,
// coeff_abs_level_greater2_flag // coeff_abs_level_greater2_flag
107, 167, 91, 122, 107, 167, 107, 167, 91, 122, 107, 167, },
}, { // sao_merge_flag
{
// sao_merge_flag
153, 153,
// sao_type_idx // sao_type_idx
160, 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]))) (s->pps->tile_id[ctb_addr_ts] != s->pps->tile_id[ctb_addr_ts - 1])))
cabac_init_state(s); 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 ((ctb_addr_ts % s->sps->ctb_width) == 0) {
if (s->sps->ctb_width == 1) if (s->sps->ctb_width == 1)
cabac_init_state(s); cabac_init_state(s);
@ -719,6 +715,7 @@ int ff_hevc_split_coding_unit_flag_decode(HEVCContext *s, int ct_depth, int x0,
inc += (depth_left > ct_depth); inc += (depth_left > ct_depth);
inc += (depth_top > ct_depth); inc += (depth_top > ct_depth);
return GET_CABAC(elem_offset[SPLIT_CODING_UNIT_FLAG] + inc); return GET_CABAC(elem_offset[SPLIT_CODING_UNIT_FLAG] + inc);
} }

View File

@ -48,7 +48,9 @@ static const uint8_t betatable[52] = {
static int chroma_tc(HEVCContext *s, int qp_y, int c_idx, int tc_offset) 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 }; 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_i, offset;
int qp; int qp;
int idxt; int idxt;
@ -71,19 +73,23 @@ static int chroma_tc(HEVCContext *s, int qp_y, int c_idx, int tc_offset)
return tctable[idxt]; return tctable[idxt];
} }
static int get_qPy_pred(HEVCContext *s, int xC, int yC, int xBase, int yBase, int log2_cb_size) static int get_qPy_pred(HEVCContext *s, int xC, int yC,
int xBase, int yBase, int log2_cb_size)
{ {
HEVCLocalContext *lc = s->HEVClc; HEVCLocalContext *lc = s->HEVClc;
int ctb_size_mask = (1 << s->sps->log2_ctb_size) - 1; int ctb_size_mask = (1 << s->sps->log2_ctb_size) - 1;
int MinCuQpDeltaSizeMask = (1 << (s->sps->log2_ctb_size - s->pps->diff_cu_qp_delta_depth)) - 1; int MinCuQpDeltaSizeMask = (1 << (s->sps->log2_ctb_size -
s->pps->diff_cu_qp_delta_depth)) - 1;
int xQgBase = xBase - (xBase & MinCuQpDeltaSizeMask); int xQgBase = xBase - (xBase & MinCuQpDeltaSizeMask);
int yQgBase = yBase - (yBase & MinCuQpDeltaSizeMask); int yQgBase = yBase - (yBase & MinCuQpDeltaSizeMask);
int min_cb_width = s->sps->min_cb_width; int min_cb_width = s->sps->min_cb_width;
int min_cb_height = s->sps->min_cb_height; int min_cb_height = s->sps->min_cb_height;
int x_cb = xQgBase >> s->sps->log2_min_cb_size; int x_cb = xQgBase >> s->sps->log2_min_cb_size;
int y_cb = yQgBase >> 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 availableA = (xBase & ctb_size_mask) &&
int availableB = (yBase & ctb_size_mask) && (yQgBase & ctb_size_mask); (xQgBase & ctb_size_mask);
int availableB = (yBase & ctb_size_mask) &&
(yQgBase & ctb_size_mask);
int qPy_pred; int qPy_pred;
int qPy_a; int qPy_a;
int qPy_b; int qPy_b;
@ -94,7 +100,8 @@ static int get_qPy_pred(HEVCContext *s, int xC, int yC, int xBase, int yBase, in
qPy_pred = s->sh.slice_qp; qPy_pred = s->sh.slice_qp;
} else { } else {
qPy_pred = lc->qp_y; qPy_pred = lc->qp_y;
if (log2_cb_size < s->sps->log2_ctb_size - s->pps->diff_cu_qp_delta_depth) { if (log2_cb_size < s->sps->log2_ctb_size -
s->pps->diff_cu_qp_delta_depth) {
static const int offsetX[8][8] = { static const int offsetX[8][8] = {
{ -1, 1, 3, 1, 7, 1, 3, 1 }, { -1, 1, 3, 1, 7, 1, 3, 1 },
{ 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 },
@ -149,13 +156,15 @@ static int get_qPy_pred(HEVCContext *s, int xC, int yC, int xBase, int yBase, in
return (qPy_a + qPy_b + 1) >> 1; return (qPy_a + qPy_b + 1) >> 1;
} }
void ff_hevc_set_qPy(HEVCContext *s, int xC, int yC, int xBase, int yBase, int log2_cb_size) void ff_hevc_set_qPy(HEVCContext *s, int xC, int yC,
int xBase, int yBase, int log2_cb_size)
{ {
int qp_y = get_qPy_pred(s, xC, yC, xBase, yBase, log2_cb_size); int qp_y = get_qPy_pred(s, xC, yC, xBase, yBase, log2_cb_size);
if (s->HEVClc->tu.cu_qp_delta != 0) { if (s->HEVClc->tu.cu_qp_delta != 0) {
int off = s->sps->qp_bd_offset; int off = s->sps->qp_bd_offset;
s->HEVClc->qp_y = ((qp_y + s->HEVClc->tu.cu_qp_delta + 52 + 2 * off) % (52 + off)) - off; s->HEVClc->qp_y = ((qp_y + s->HEVClc->tu.cu_qp_delta + 52 + 2 * off) %
(52 + off)) - off;
} else } else
s->HEVClc->qp_y = qp_y; s->HEVClc->qp_y = qp_y;
} }
@ -168,7 +177,8 @@ static int get_qPy(HEVCContext *s, int xC, int yC)
return s->qp_y_tab[x + y * s->sps->min_cb_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) static void copy_CTB(uint8_t *dst, uint8_t *src,
int width, int height, int stride)
{ {
int i; int i;
@ -201,7 +211,8 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
uint8_t horiz_edge[] = { 0, 0, 0, 0 }; uint8_t horiz_edge[] = { 0, 0, 0, 0 };
uint8_t diag_edge[] = { 0, 0, 0, 0 }; uint8_t diag_edge[] = { 0, 0, 0, 0 };
uint8_t lfase[3]; // current, above, left uint8_t lfase[3]; // current, above, left
uint8_t no_tile_filter = s->pps->tiles_enabled_flag && !s->pps->loop_filter_across_tiles_enabled_flag; uint8_t no_tile_filter = s->pps->tiles_enabled_flag &&
!s->pps->loop_filter_across_tiles_enabled_flag;
uint8_t left_tile_edge = 0; uint8_t left_tile_edge = 0;
uint8_t up_tile_edge = 0; uint8_t up_tile_edge = 0;
@ -249,10 +260,12 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
diag_edge[3] = diag_edge[0]; diag_edge[3] = diag_edge[0];
// Does left CTB comes after above CTB? // Does left CTB comes after above CTB?
if(CTB(s->tab_slice_address, x_ctb - 1, y_ctb) > CTB(s->tab_slice_address, x_ctb, y_ctb - 1)) { if (CTB(s->tab_slice_address, x_ctb - 1, y_ctb) >
CTB(s->tab_slice_address, x_ctb, y_ctb - 1)) {
diag_edge[2] = !lfase[2] || left_tile_edge || up_tile_edge; diag_edge[2] = !lfase[2] || left_tile_edge || up_tile_edge;
diag_edge[1] = diag_edge[2]; diag_edge[1] = diag_edge[2];
} else if(CTB(s->tab_slice_address, x_ctb - 1, y_ctb) < CTB(s->tab_slice_address, x_ctb, y_ctb - 1)) { } else if (CTB(s->tab_slice_address, x_ctb - 1, y_ctb) <
CTB(s->tab_slice_address, x_ctb, y_ctb - 1)) {
diag_edge[1] = !lfase[1] || left_tile_edge || up_tile_edge; diag_edge[1] = !lfase[1] || left_tile_edge || up_tile_edge;
diag_edge[2] = diag_edge[1]; diag_edge[2] = diag_edge[1];
} else { } else {
@ -286,10 +299,21 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
switch (sao[class_index]->type_idx[c_idx]) { switch (sao[class_index]->type_idx[c_idx]) {
case SAO_BAND: case SAO_BAND:
s->hevcdsp.sao_band_filter[classes[class_index]](dst, src, stride, sao[class_index], edges, width, height, c_idx); s->hevcdsp.sao_band_filter[classes[class_index]](dst, src,
stride,
sao[class_index],
edges, width,
height, c_idx);
break; break;
case SAO_EDGE: case SAO_EDGE:
s->hevcdsp.sao_edge_filter[classes[class_index]](dst, src, stride, sao[class_index], edges, width, height, c_idx, vert_edge[classes[class_index]], horiz_edge[classes[class_index]], diag_edge[classes[class_index]]); s->hevcdsp.sao_edge_filter[classes[class_index]](dst, src,
stride,
sao[class_index],
edges, width,
height, c_idx,
vert_edge[classes[class_index]],
horiz_edge[classes[class_index]],
diag_edge[classes[class_index]]);
break; break;
} }
} }
@ -324,12 +348,14 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
int log2_ctb_size = s->sps->log2_ctb_size; int log2_ctb_size = s->sps->log2_ctb_size;
int x_end, y_end; int x_end, y_end;
int ctb_size = 1 << log2_ctb_size; int ctb_size = 1 << log2_ctb_size;
int ctb = (x0 >> log2_ctb_size) + (y0 >> log2_ctb_size) * s->sps->ctb_width; int ctb = (x0 >> log2_ctb_size) +
(y0 >> log2_ctb_size) * s->sps->ctb_width;
int cur_tc_offset = s->deblock[ctb].tc_offset; int cur_tc_offset = s->deblock[ctb].tc_offset;
int cur_beta_offset = s->deblock[ctb].beta_offset; int cur_beta_offset = s->deblock[ctb].beta_offset;
int left_tc_offset, left_beta_offset; int left_tc_offset, left_beta_offset;
int tc_offset, beta_offset; int tc_offset, beta_offset;
int pcmf = (s->sps->pcm_enabled_flag && s->sps->pcm.loop_filter_disable_flag) || int pcmf = (s->sps->pcm_enabled_flag &&
s->sps->pcm.loop_filter_disable_flag) ||
s->pps->transquant_bypass_enable_flag; s->pps->transquant_bypass_enable_flag;
if (x0) { if (x0) {
@ -366,9 +392,13 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
no_p[1] = get_pcm(s, x - 1, y + 4); no_p[1] = get_pcm(s, x - 1, y + 4);
no_q[0] = get_pcm(s, x, y); no_q[0] = get_pcm(s, x, y);
no_q[1] = get_pcm(s, x, y + 4); no_q[1] = get_pcm(s, x, y + 4);
s->hevcdsp.hevc_v_loop_filter_luma_c(src, s->frame->linesize[LUMA], beta, tc, no_p, no_q); s->hevcdsp.hevc_v_loop_filter_luma_c(src,
s->frame->linesize[LUMA],
beta, tc, no_p, no_q);
} else } else
s->hevcdsp.hevc_v_loop_filter_luma(src, s->frame->linesize[LUMA], beta, tc, no_p, no_q); s->hevcdsp.hevc_v_loop_filter_luma(src,
s->frame->linesize[LUMA],
beta, tc, no_p, no_q);
} }
} }
} }
@ -391,9 +421,13 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
no_p[1] = get_pcm(s, x - 1, y + 8); no_p[1] = get_pcm(s, x - 1, y + 8);
no_q[0] = get_pcm(s, x, y); no_q[0] = get_pcm(s, x, y);
no_q[1] = get_pcm(s, x, y + 8); no_q[1] = get_pcm(s, x, y + 8);
s->hevcdsp.hevc_v_loop_filter_chroma_c(src, s->frame->linesize[chroma], c_tc, no_p, no_q); s->hevcdsp.hevc_v_loop_filter_chroma_c(src,
s->frame->linesize[chroma],
c_tc, no_p, no_q);
} else } else
s->hevcdsp.hevc_v_loop_filter_chroma(src, s->frame->linesize[chroma], c_tc, no_p, no_q); s->hevcdsp.hevc_v_loop_filter_chroma(src,
s->frame->linesize[chroma],
c_tc, no_p, no_q);
} }
} }
} }
@ -423,9 +457,13 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
no_p[1] = get_pcm(s, x + 4, y - 1); no_p[1] = get_pcm(s, x + 4, y - 1);
no_q[0] = get_pcm(s, x, y); no_q[0] = get_pcm(s, x, y);
no_q[1] = get_pcm(s, x + 4, y); no_q[1] = get_pcm(s, x + 4, y);
s->hevcdsp.hevc_h_loop_filter_luma_c(src, s->frame->linesize[LUMA], beta, tc, no_p, no_q); s->hevcdsp.hevc_h_loop_filter_luma_c(src,
s->frame->linesize[LUMA],
beta, tc, no_p, no_q);
} else } else
s->hevcdsp.hevc_h_loop_filter_luma(src, s->frame->linesize[LUMA], beta, tc, no_p, no_q); s->hevcdsp.hevc_h_loop_filter_luma(src,
s->frame->linesize[LUMA],
beta, tc, no_p, no_q);
} }
} }
} }
@ -461,9 +499,13 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
no_p[1] = get_pcm(s, x + 8, y - 1); no_p[1] = get_pcm(s, x + 8, y - 1);
no_q[0] = get_pcm(s, x, y); no_q[0] = get_pcm(s, x, y);
no_q[1] = get_pcm(s, x + 8, y); no_q[1] = get_pcm(s, x + 8, y);
s->hevcdsp.hevc_h_loop_filter_chroma_c(src, s->frame->linesize[chroma], c_tc, no_p, no_q); s->hevcdsp.hevc_h_loop_filter_chroma_c(src,
s->frame->linesize[chroma],
c_tc, no_p, no_q);
} else } else
s->hevcdsp.hevc_h_loop_filter_chroma(src, s->frame->linesize[chroma], c_tc, no_p, no_q); s->hevcdsp.hevc_h_loop_filter_chroma(src,
s->frame->linesize[chroma],
c_tc, no_p, no_q);
} }
} }
} }
@ -472,7 +514,8 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
static int boundary_strength(HEVCContext *s, MvField *curr, static int boundary_strength(HEVCContext *s, MvField *curr,
uint8_t curr_cbf_luma, MvField *neigh, uint8_t curr_cbf_luma, MvField *neigh,
uint8_t neigh_cbf_luma, RefPicList *neigh_refPicList, uint8_t neigh_cbf_luma,
RefPicList *neigh_refPicList,
int tu_border) int tu_border)
{ {
int mvs = curr->pred_flag[0] + curr->pred_flag[1]; int mvs = curr->pred_flag[0] + curr->pred_flag[1];
@ -548,16 +591,18 @@ static int boundary_strength(HEVCContext *s, MvField *curr,
return 1; return 1;
} }
void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int log2_trafo_size, void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
int slice_or_tiles_up_boundary, int slice_or_tiles_left_boundary) int log2_trafo_size,
int slice_or_tiles_up_boundary,
int slice_or_tiles_left_boundary)
{ {
MvField *tab_mvf = s->ref->tab_mvf; MvField *tab_mvf = s->ref->tab_mvf;
int log2_min_pu_size = s->sps->log2_min_pu_size; int log2_min_pu_size = s->sps->log2_min_pu_size;
int log2_min_tu_size = s->sps->log2_min_tb_size; int log2_min_tu_size = s->sps->log2_min_tb_size;
int min_pu_width = s->sps->min_pu_width; int min_pu_width = s->sps->min_pu_width;
int min_tu_width = s->sps->min_tb_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 is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width +
(x0 >> log2_min_pu_size)].is_intra;
int i, j; int i, j;
int bs; int bs;
@ -574,12 +619,18 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int l
MvField *curr = &tab_mvf[yq_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 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]; 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); 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); bs = boundary_strength(s, curr, curr_cbf_luma,
if (!s->sh.slice_loop_filter_across_slices_enabled_flag && (slice_or_tiles_up_boundary & 1) && (y0 % (1 << s->sps->log2_ctb_size)) == 0) top, top_cbf_luma, top_refPicList, 1);
if (!s->sh.slice_loop_filter_across_slices_enabled_flag &&
(slice_or_tiles_up_boundary & 1) &&
(y0 % (1 << s->sps->log2_ctb_size)) == 0)
bs = 0; bs = 0;
else if (!s->pps->loop_filter_across_tiles_enabled_flag && (slice_or_tiles_up_boundary & 2) && (y0 % (1 << s->sps->log2_ctb_size)) == 0) else if (!s->pps->loop_filter_across_tiles_enabled_flag &&
(slice_or_tiles_up_boundary & 2) &&
(y0 % (1 << s->sps->log2_ctb_size)) == 0)
bs = 0; bs = 0;
if (y0 == 0 || s->sh.disable_deblocking_filter_flag == 1) if (y0 == 0 || s->sh.disable_deblocking_filter_flag == 1)
bs = 0; bs = 0;
@ -596,7 +647,6 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int l
int yp_tu = (y0 + j - 1) >> log2_min_tu_size; int yp_tu = (y0 + j - 1) >> log2_min_tu_size;
int yq_tu = (y0 + j) >> log2_min_tu_size; int yq_tu = (y0 + j) >> log2_min_tu_size;
for (i = 0; i < (1 << log2_trafo_size); i += 4) { for (i = 0; i < (1 << log2_trafo_size); i += 4) {
int x_pu = (x0 + i) >> log2_min_pu_size; int x_pu = (x0 + i) >> log2_min_pu_size;
int x_tu = (x0 + i) >> log2_min_tu_size; int x_tu = (x0 + i) >> log2_min_tu_size;
@ -604,9 +654,12 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int l
MvField *curr = &tab_mvf[yq_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 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]; 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); 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); bs = boundary_strength(s, curr, curr_cbf_luma,
top, top_cbf_luma, top_refPicList, 0);
if (s->sh.disable_deblocking_filter_flag == 1) if (s->sh.disable_deblocking_filter_flag == 1)
bs = 0; bs = 0;
if (bs) if (bs)
@ -629,12 +682,18 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int l
uint8_t left_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xp_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]; 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); 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); bs = boundary_strength(s, curr, curr_cbf_luma,
if (!s->sh.slice_loop_filter_across_slices_enabled_flag && (slice_or_tiles_left_boundary & 1) && (x0 % (1 << s->sps->log2_ctb_size)) == 0) left, left_cbf_luma, left_refPicList, 1);
if (!s->sh.slice_loop_filter_across_slices_enabled_flag &&
(slice_or_tiles_left_boundary & 1) &&
(x0 % (1 << s->sps->log2_ctb_size)) == 0)
bs = 0; bs = 0;
else if (!s->pps->loop_filter_across_tiles_enabled_flag && (slice_or_tiles_left_boundary & 2) && (x0 % (1 << s->sps->log2_ctb_size)) == 0) else if (!s->pps->loop_filter_across_tiles_enabled_flag &&
(slice_or_tiles_left_boundary & 2) &&
(x0 % (1 << s->sps->log2_ctb_size)) == 0)
bs = 0; bs = 0;
if (x0 == 0 || s->sh.disable_deblocking_filter_flag == 1) if (x0 == 0 || s->sh.disable_deblocking_filter_flag == 1)
bs = 0; bs = 0;
@ -658,9 +717,12 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int l
MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_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 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]; 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); 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); bs = boundary_strength(s, curr, curr_cbf_luma,
left, left_cbf_luma, left_refPicList, 0);
if (s->sh.disable_deblocking_filter_flag == 1) if (s->sh.disable_deblocking_filter_flag == 1)
bs = 0; bs = 0;
if (bs) if (bs)
@ -668,6 +730,7 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int l
} }
} }
} }
#undef LUMA #undef LUMA
#undef CB #undef CB
#undef CR #undef CR

View File

@ -38,7 +38,8 @@ static const uint8_t l0_l1_cand_idx[12][2] = {
{ 3, 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; HEVCLocalContext *lc = s->HEVClc;
int x0b = x0 & ((1 << s->sps->log2_ctb_size) - 1); 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; return N <= Curr;
} }
static int same_prediction_block(HEVCLocalContext *lc, int log2_cb_size, static int same_prediction_block(HEVCLocalContext *lc, int log2_cb_size,
int x0, int y0, int nPbW, int nPbH, int x0, int y0, int nPbW, int nPbH,
int xA1, int yA1, int partIdx) int xA1, int yA1, int partIdx)
@ -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 * 8.5.3.1.2 Derivation process for spatial merging candidates
*/ */
static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0, 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, int singleMCLFlag, int part_idx,
struct MvField mergecandlist[]) struct MvField mergecandlist[])
{ {
@ -589,7 +590,6 @@ static int mv_mp_mode_mx(HEVCContext *s, int x, int y, int pred_flag_index,
return 0; return 0;
} }
static int mv_mp_mode_mx_lt(HEVCContext *s, int x, int y, int pred_flag_index, 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) Mv *mv, int ref_idx_curr, int ref_idx)
{ {
@ -602,10 +602,12 @@ static int mv_mp_mode_mx_lt(HEVCContext *s, int x, int y, int pred_flag_index,
int colIsLongTerm = int colIsLongTerm =
refPicList[pred_flag_index].isLongTerm[(TAB_MVF(x, y).ref_idx[pred_flag_index])]; 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]; *mv = TAB_MVF(x, y).mv[pred_flag_index];
if (!currIsLongTerm) 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 1;
} }
return 0; return 0;
@ -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) { if (numMVPCandLX < 2 && s->sh.slice_temporal_mvp_enabled_flag) {
Mv mv_col; Mv mv_col;
int available_col = temporal_luma_motion_vector(s, x0, y0, nPbW, 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) if (available_col)
mvpcand_list[numMVPCandLX++] = mv_col; mvpcand_list[numMVPCandLX++] = mv_col;
} }

View File

@ -21,6 +21,7 @@
*/ */
#include "libavutil/common.h" #include "libavutil/common.h"
#include "parser.h" #include "parser.h"
#include "hevc.h" #include "hevc.h"
#include "golomb.h" #include "golomb.h"
@ -36,7 +37,8 @@ typedef struct HEVCParseContext {
* Find the end of the current frame in the bitstream. * 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 * @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; int i;
ParseContext *pc = &((HEVCParseContext *)s->priv_data)->pc; 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 buffer with field/frame data.
* @param buf_size size of the buffer. * @param buf_size size of the buffer.
*/ */
static inline int parse_nal_units(AVCodecParserContext *s, static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx,
AVCodecContext *avctx,
const uint8_t *buf, int buf_size) const uint8_t *buf, int buf_size)
{ {
HEVCContext *h = &((HEVCParseContext *)s->priv_data)->h; HEVCContext *h = &((HEVCParseContext *)s->priv_data)->h;

View File

@ -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; GetBitContext *gb = &s->HEVClc->gb;
int nal_params_present = 0, vcl_params_present = 0; 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 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"); av_log(s->avctx, AV_LOG_ERROR, "error decoding profile tier level\n");
ret = AVERROR_INVALIDDATA; ret = AVERROR_INVALIDDATA;
goto err; goto err;
@ -820,7 +822,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
sps->nb_st_rps = get_ue_golomb_long(gb); sps->nb_st_rps = get_ue_golomb_long(gb);
if (sps->nb_st_rps > MAX_SHORT_TERM_RPS_COUNT) { 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); sps->nb_st_rps);
ret = AVERROR_INVALIDDATA; ret = AVERROR_INVALIDDATA;
goto err; goto err;
@ -872,8 +875,7 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
ret = AVERROR_INVALIDDATA; ret = AVERROR_INVALIDDATA;
goto err; goto err;
} }
av_log(s->avctx, AV_LOG_WARNING, av_log(s->avctx, AV_LOG_WARNING, "Displaying the whole video surface.\n");
"Displaying the whole video surface.\n");
sps->pic_conf_win.left_offset = sps->pic_conf_win.left_offset =
sps->pic_conf_win.right_offset = sps->pic_conf_win.right_offset =
sps->pic_conf_win.top_offset = sps->pic_conf_win.top_offset =

View File

@ -56,7 +56,8 @@ RefPicList* ff_hevc_get_ref_list(HEVCContext *s, HEVCFrame *ref, int x0, int y0)
} else { } else {
int x_cb = x0 >> s->sps->log2_ctb_size; int x_cb = x0 >> s->sps->log2_ctb_size;
int y_cb = y0 >> 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]; 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; int i;
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++)
ff_hevc_unref_frame(s, &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) void ff_hevc_flush_dpb(HEVCContext *s)
@ -85,7 +87,8 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
if (frame->frame->buf[0]) if (frame->frame->buf[0])
continue; 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) if (ret < 0)
return NULL; return NULL;
@ -140,8 +143,8 @@ int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc)
*frame = ref->frame; *frame = ref->frame;
s->ref = ref; s->ref = ref;
ref->poc = poc;
ref->poc = poc;
ref->flags = HEVC_FRAME_FLAG_OUTPUT | HEVC_FRAME_FLAG_SHORT_REF; ref->flags = HEVC_FRAME_FLAG_OUTPUT | HEVC_FRAME_FLAG_SHORT_REF;
ref->sequence = s->seq_decode; ref->sequence = s->seq_decode;
ref->window = s->sps->output_window; 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]; (frame->window.top_offset >> vshift) * dst->linesize[j];
dst->data[j] += off; 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; return 1;
} }
@ -247,8 +251,7 @@ int ff_hevc_slice_rpl(HEVCContext *s)
/* The order of the elements is /* The order of the elements is
* ST_CURR_BEF - ST_CURR_AFT - LT_CURR for the L0 and * 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, int cand_lists[3] = { list_idx ? ST_CURR_AFT : ST_CURR_BEF,
list_idx ? ST_CURR_BEF : ST_CURR_AFT, list_idx ? ST_CURR_BEF : ST_CURR_AFT,
LT_CURR }; LT_CURR };
@ -331,7 +334,6 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
HEVCFrame *frame; HEVCFrame *frame;
int i, x, y; int i, x, y;
frame = alloc_frame(s); frame = alloc_frame(s);
if (!frame) if (!frame)
return NULL; return NULL;

View File

@ -25,7 +25,8 @@
#include "hevc.h" #include "hevc.h"
#include "golomb.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; int cIdx, i;
uint8_t hash_type; uint8_t hash_type;
@ -34,7 +35,6 @@ static void decode_nal_sei_decoded_picture_hash(HEVCContext *s, int payload_size
GetBitContext *gb = &s->HEVClc->gb; GetBitContext *gb = &s->HEVClc->gb;
hash_type = get_bits(gb, 8); hash_type = get_bits(gb, 8);
for (cIdx = 0; cIdx < 3/*((s->sps->chroma_format_idc == 0) ? 1 : 3)*/; cIdx++) { for (cIdx = 0; cIdx < 3/*((s->sps->chroma_format_idc == 0) ? 1 : 3)*/; cIdx++) {
if (hash_type == 0) { if (hash_type == 0) {
s->is_md5 = 1; s->is_md5 = 1;
@ -101,7 +101,8 @@ static int decode_pic_timing(HEVCContext *s)
return 1; return 1;
} }
static void active_parameter_sets(HEVCContext *s) { static void active_parameter_sets(HEVCContext *s)
{
GetBitContext *gb = &s->HEVClc->gb; GetBitContext *gb = &s->HEVClc->gb;
int num_sps_ids_minus1; int num_sps_ids_minus1;
int i; int i;

View File

@ -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_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); hevcdsp->hevc_v_loop_filter_chroma_c = FUNC(hevc_v_loop_filter_chroma, depth);
switch (bit_depth) { switch (bit_depth) {
case 9: case 9:
HEVC_DSP(9); HEVC_DSP(9);

View File

@ -23,6 +23,7 @@
#include "get_bits.h" #include "get_bits.h"
#include "bit_depth_template.c" #include "bit_depth_template.c"
#include "hevcdsp.h" #include "hevcdsp.h"
#include "hevc.h" #include "hevc.h"
#define SET(dst, x) (dst) = (x) #define SET(dst, x) (dst) = (x)
@ -220,6 +221,7 @@ static void FUNC(transform_4x4_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t _s
assign(dst[(7 - i) * dstep], e_8[i] - o_8[i]); \ assign(dst[(7 - i) * dstep], e_8[i] - o_8[i]); \
} \ } \
} while (0) } while (0)
#define TR_16(dst, src, dstep, sstep, assign) \ #define TR_16(dst, src, dstep, sstep, assign) \
do { \ do { \
int i, j; \ int i, j; \
@ -235,6 +237,7 @@ static void FUNC(transform_4x4_add)(uint8_t *_dst, int16_t *coeffs, ptrdiff_t _s
assign(dst[(15 - i) * dstep], e_16[i] - o_16[i]); \ assign(dst[(15 - i) * dstep], e_16[i] - o_16[i]); \
} \ } \
} while (0) } while (0)
#define TR_32(dst, src, dstep, sstep, assign) \ #define TR_32(dst, src, dstep, sstep, assign) \
do { \ do { \
int i, j; \ int i, j; \
@ -402,7 +405,8 @@ static void FUNC(sao_band_filter_0)(uint8_t *dst, uint8_t *src,
int *borders, int width, int height, int *borders, int width, int height,
int c_idx) int c_idx)
{ {
FUNC(sao_band_filter)(dst, src, stride, sao, borders, width, height, c_idx, 0); FUNC(sao_band_filter)(dst, src, stride, sao, borders,
width, height, c_idx, 0);
} }
static void FUNC(sao_band_filter_1)(uint8_t *dst, uint8_t *src, static void FUNC(sao_band_filter_1)(uint8_t *dst, uint8_t *src,
@ -410,7 +414,8 @@ static void FUNC(sao_band_filter_1)(uint8_t *dst, uint8_t *src,
int *borders, int width, int height, int *borders, int width, int height,
int c_idx) int c_idx)
{ {
FUNC(sao_band_filter)(dst, src, stride, sao, borders, width, height, c_idx, 1); FUNC(sao_band_filter)(dst, src, stride, sao, borders,
width, height, c_idx, 1);
} }
static void FUNC(sao_band_filter_2)(uint8_t *dst, uint8_t *src, static void FUNC(sao_band_filter_2)(uint8_t *dst, uint8_t *src,
@ -482,7 +487,6 @@ static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src,
} }
width--; width--;
} }
} }
if (sao_eo_class != SAO_EO_HORIZ) { if (sao_eo_class != SAO_EO_HORIZ) {
if (borders[1]) { if (borders[1]) {
@ -542,8 +546,8 @@ static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src,
static void FUNC(sao_edge_filter_1)(uint8_t *_dst, uint8_t *_src, static void FUNC(sao_edge_filter_1)(uint8_t *_dst, uint8_t *_src,
ptrdiff_t _stride, SAOParams *sao, ptrdiff_t _stride, SAOParams *sao,
int *borders, int _width, int _height, int *borders, int _width, int _height,
int c_idx, int c_idx, uint8_t vert_edge,
uint8_t vert_edge, uint8_t horiz_edge, uint8_t diag_edge) uint8_t horiz_edge, uint8_t diag_edge)
{ {
int x, y; int x, y;
pixel *dst = (pixel *)_dst; pixel *dst = (pixel *)_dst;
@ -592,7 +596,6 @@ static void FUNC(sao_edge_filter_1)(uint8_t *_dst, uint8_t *_src,
} }
width--; width--;
} }
} }
{ {
int y_stride = init_y * stride; int y_stride = init_y * stride;
@ -635,8 +638,8 @@ static void FUNC(sao_edge_filter_1)(uint8_t *_dst, uint8_t *_src,
static void FUNC(sao_edge_filter_2)(uint8_t *_dst, uint8_t *_src, static void FUNC(sao_edge_filter_2)(uint8_t *_dst, uint8_t *_src,
ptrdiff_t _stride, SAOParams *sao, ptrdiff_t _stride, SAOParams *sao,
int *borders, int _width, int _height, int *borders, int _width, int _height,
int c_idx, int c_idx, uint8_t vert_edge,
uint8_t vert_edge, uint8_t horiz_edge, uint8_t diag_edge) uint8_t horiz_edge, uint8_t diag_edge)
{ {
int x, y; int x, y;
pixel *dst = (pixel *)_dst; pixel *dst = (pixel *)_dst;
@ -723,8 +726,8 @@ static void FUNC(sao_edge_filter_2)(uint8_t *_dst, uint8_t *_src,
static void FUNC(sao_edge_filter_3)(uint8_t *_dst, uint8_t *_src, static void FUNC(sao_edge_filter_3)(uint8_t *_dst, uint8_t *_src,
ptrdiff_t _stride, SAOParams *sao, ptrdiff_t _stride, SAOParams *sao,
int *borders, int _width, int _height, int *borders, int _width, int _height,
int c_idx, int c_idx, uint8_t vert_edge,
uint8_t vert_edge, uint8_t horiz_edge, uint8_t diag_edge) uint8_t horiz_edge, uint8_t diag_edge)
{ {
int x, y; int x, y;
pixel *dst = (pixel *)_dst; pixel *dst = (pixel *)_dst;
@ -829,9 +832,11 @@ static void FUNC(put_hevc_qpel_pixels)(int16_t *dst, ptrdiff_t dststride,
#define QPEL_FILTER_1(src, stride) \ #define QPEL_FILTER_1(src, stride) \
(-src[x - 3 * stride] + 4 * src[x - 2 * stride] - 10 * src[x - stride] + 58 * src[x] + \ (-src[x - 3 * stride] + 4 * src[x - 2 * stride] - 10 * src[x - stride] + 58 * src[x] + \
17 * src[x + stride] - 5 * src[x + 2 * stride] + 1 * src[x + 3 * stride]) 17 * src[x + stride] - 5 * src[x + 2 * stride] + 1 * src[x + 3 * stride])
#define QPEL_FILTER_2(src, stride) \ #define QPEL_FILTER_2(src, stride) \
(-src[x - 3 * stride] + 4 * src[x - 2 * stride] - 11 * src[x - stride] + 40 * src[x] + \ (-src[x - 3 * stride] + 4 * src[x - 2 * stride] - 11 * src[x - stride] + 40 * src[x] + \
40 * src[x + stride] - 11 * src[x + 2 * stride] + 4 * src[x + 3 * stride] - src[x + 4 * stride]) 40 * src[x + stride] - 11 * src[x + 2 * stride] + 4 * src[x + 3 * stride] - src[x + 4 * stride])
#define QPEL_FILTER_3(src, stride) \ #define QPEL_FILTER_3(src, stride) \
(src[x - 2 * stride] - 5 * src[x - stride] + 17 * src[x] + 58 * src[x + stride] \ (src[x - 2 * stride] - 5 * src[x - stride] + 17 * src[x] + 58 * src[x + stride] \
- 10 * src[x + 2 * stride] + 4 * src[x + 3 * stride] - src[x + 4 * stride]) - 10 * src[x + 2 * stride] + 4 * src[x + 3 * stride] - src[x + 4 * stride])
@ -1110,10 +1115,12 @@ static void FUNC(weighted_pred)(uint8_t denom, int16_t wlxFlag, int16_t olxFlag,
} }
} }
static void FUNC(weighted_pred_avg)(uint8_t denom, int16_t wl0Flag, int16_t wl1Flag, static void FUNC(weighted_pred_avg)(uint8_t denom,
int16_t wl0Flag, int16_t wl1Flag,
int16_t ol0Flag, int16_t ol1Flag, int16_t ol0Flag, int16_t ol1Flag,
uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_dst, ptrdiff_t _dststride,
int16_t *src1, int16_t *src2, ptrdiff_t srcstride, int16_t *src1, int16_t *src2,
ptrdiff_t srcstride,
int width, int height) int width, int height)
{ {
int shift; int shift;
@ -1164,8 +1171,9 @@ static void FUNC(weighted_pred_avg)(uint8_t denom, int16_t wl0Flag, int16_t wl1F
#define TQ2 pix[2 * xstride + 3 * ystride] #define TQ2 pix[2 * xstride + 3 * ystride]
#define TQ3 pix[3 * xstride + 3 * ystride] #define TQ3 pix[3 * xstride + 3 * ystride]
static void FUNC(hevc_loop_filter_luma)(uint8_t *_pix, ptrdiff_t _xstride, static void FUNC(hevc_loop_filter_luma)(uint8_t *_pix,
ptrdiff_t _ystride, int *_beta, int *_tc, ptrdiff_t _xstride, ptrdiff_t _ystride,
int *_beta, int *_tc,
uint8_t *_no_p, uint8_t *_no_q) uint8_t *_no_p, uint8_t *_no_q)
{ {
int d, j; int d, j;
@ -1294,13 +1302,15 @@ static void FUNC(hevc_loop_filter_chroma)(uint8_t *_pix, ptrdiff_t _xstride,
} }
static void FUNC(hevc_h_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride, static void FUNC(hevc_h_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride,
int *tc, uint8_t *no_p, uint8_t *no_q) int *tc, uint8_t *no_p,
uint8_t *no_q)
{ {
FUNC(hevc_loop_filter_chroma)(pix, stride, sizeof(pixel), tc, no_p, no_q); FUNC(hevc_loop_filter_chroma)(pix, stride, sizeof(pixel), tc, no_p, no_q);
} }
static void FUNC(hevc_v_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride, static void FUNC(hevc_v_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride,
int *tc, uint8_t *no_p, uint8_t *no_q) int *tc, uint8_t *no_p,
uint8_t *no_q)
{ {
FUNC(hevc_loop_filter_chroma)(pix, sizeof(pixel), stride, tc, no_p, no_q); FUNC(hevc_loop_filter_chroma)(pix, sizeof(pixel), stride, tc, no_p, no_q);
} }
@ -1309,14 +1319,16 @@ static void FUNC(hevc_h_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
int *beta, int *tc, uint8_t *no_p, int *beta, int *tc, uint8_t *no_p,
uint8_t *no_q) uint8_t *no_q)
{ {
FUNC(hevc_loop_filter_luma)(pix, stride, sizeof(pixel), beta, tc, no_p, no_q); FUNC(hevc_loop_filter_luma)(pix, stride, sizeof(pixel),
beta, tc, no_p, no_q);
} }
static void FUNC(hevc_v_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride, static void FUNC(hevc_v_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
int *beta, int *tc, uint8_t *no_p, int *beta, int *tc, uint8_t *no_p,
uint8_t *no_q) uint8_t *no_q)
{ {
FUNC(hevc_loop_filter_luma)(pix, sizeof(pixel), stride, beta, tc, no_p, no_q); FUNC(hevc_loop_filter_luma)(pix, sizeof(pixel), stride,
beta, tc, no_p, no_q);
} }
#undef P3 #undef P3

View File

@ -157,7 +157,8 @@ static void FUNC(intra_pred)(HEVCContext *s, int x0, int y0, int log2_size, int
} }
if (cand_bottom_left) { if (cand_bottom_left) {
for (i = size + bottom_left_size; i < (size << 1); i++) for (i = size + bottom_left_size; i < (size << 1); i++)
if (IS_INTRA(-1, size + bottom_left_size - 1) || !s->pps->constrained_intra_pred_flag) if (IS_INTRA(-1, size + bottom_left_size - 1) ||
!s->pps->constrained_intra_pred_flag)
left[i] = POS(-1, size + bottom_left_size - 1); left[i] = POS(-1, size + bottom_left_size - 1);
for (i = size + bottom_left_size - 1; i >= size; i--) for (i = size + bottom_left_size - 1; i >= size; i--)
if (IS_INTRA(-1, i) || !s->pps->constrained_intra_pred_flag) if (IS_INTRA(-1, i) || !s->pps->constrained_intra_pred_flag)
@ -178,7 +179,8 @@ static void FUNC(intra_pred)(HEVCContext *s, int x0, int y0, int log2_size, int
top[i] = POS(i, -1); top[i] = POS(i, -1);
if (cand_up_right) { if (cand_up_right) {
for (i = size + top_right_size; i < (size << 1); i++) for (i = size + top_right_size; i < (size << 1); i++)
if (IS_INTRA(size + top_right_size - 1, -1) || !s->pps->constrained_intra_pred_flag) if (IS_INTRA(size + top_right_size - 1, -1) ||
!s->pps->constrained_intra_pred_flag)
top[i] = POS(size + top_right_size - 1, -1); top[i] = POS(size + top_right_size - 1, -1);
for (i = size + top_right_size - 1; i >= size; i--) for (i = size + top_right_size - 1; i >= size; i--)
if (IS_INTRA(i, -1) || !s->pps->constrained_intra_pred_flag) if (IS_INTRA(i, -1) || !s->pps->constrained_intra_pred_flag)
@ -201,17 +203,20 @@ static void FUNC(intra_pred)(HEVCContext *s, int x0, int y0, int log2_size, int
size : (s->sps->height - y0) >> vshift; size : (s->sps->height - y0) >> vshift;
} }
if (cand_bottom_left || cand_left || cand_up_left) { if (cand_bottom_left || cand_left || cand_up_left) {
while (j>-1 && !IS_INTRA(-1, j)) j--; while (j > -1 && !IS_INTRA(-1, j))
j--;
if (!IS_INTRA(-1, j)) { if (!IS_INTRA(-1, j)) {
j = 0; j = 0;
while(j < size_max_x && !IS_INTRA(j, -1)) j++; while (j < size_max_x && !IS_INTRA(j, -1))
j++;
EXTEND_LEFT_CIP(top, j, j + 1); EXTEND_LEFT_CIP(top, j, j + 1);
left[-1] = top[-1]; left[-1] = top[-1];
j = 0; j = 0;
} }
} else { } else {
j = 0; j = 0;
while (j < size_max_x && !IS_INTRA(j, -1)) j++; while (j < size_max_x && !IS_INTRA(j, -1))
j++;
if (j > 0) if (j > 0)
if (x0 > 0) { if (x0 > 0) {
EXTEND_LEFT_CIP(top, j, j + 1); EXTEND_LEFT_CIP(top, j, j + 1);
@ -329,8 +334,7 @@ static void FUNC(intra_pred)(HEVCContext *s, int x0, int y0, int log2_size, int
filtered_left[i] = (left[i + 1] + 2 * left[i] + filtered_left[i] = (left[i + 1] + 2 * left[i] +
left[i - 1] + 2) >> 2; left[i - 1] + 2) >> 2;
filtered_top[-1] = filtered_top[-1] =
filtered_left[-1] = (left[0] + 2 * left[-1] + filtered_left[-1] = (left[0] + 2 * left[-1] + top[0] + 2) >> 2;
top[0] + 2) >> 2;
for (i = 2 * size - 2; i >= 0; i--) for (i = 2 * size - 2; i >= 0; i--)
filtered_top[i] = (top[i + 1] + 2 * top[i] + filtered_top[i] = (top[i + 1] + 2 * top[i] +
top[i - 1] + 2) >> 2; top[i - 1] + 2) >> 2;
@ -351,7 +355,8 @@ static void FUNC(intra_pred)(HEVCContext *s, int x0, int y0, int log2_size, int
break; break;
default: default:
s->hpc.pred_angular[log2_size - 2]((uint8_t *)src, (uint8_t *)top, s->hpc.pred_angular[log2_size - 2]((uint8_t *)src, (uint8_t *)top,
(uint8_t*)left, stride, c_idx, mode); (uint8_t *)left, stride, c_idx,
mode);
break; break;
} }
} }