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;
s->filter_slice_edges = av_malloc(ctb_count);
s->tab_slice_address = av_malloc(pic_size_in_ctb * sizeof(*s->tab_slice_address));
s->qp_y_tab = av_malloc(pic_size_in_ctb * sizeof(*s->qp_y_tab));
s->tab_slice_address = av_malloc(pic_size_in_ctb *
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)
goto fail;
@ -130,6 +132,7 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps)
goto fail;
return 0;
fail:
pic_arrays_free(s);
return AVERROR(ENOMEM);
@ -308,6 +311,7 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps)
s->sps = sps;
s->vps = s->vps_list[s->sps->vps_id];
return 0;
fail:
pic_arrays_free(s);
s->sps = NULL;
@ -366,7 +370,8 @@ static int hls_slice_header(HEVCContext *s)
s->sps->ctb_height);
sh->slice_segment_addr = get_bits(gb, slice_address_length);
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);
return AVERROR_INVALIDDATA;
}
@ -388,7 +393,8 @@ static int hls_slice_header(HEVCContext *s)
skip_bits(gb, 1); // slice_reserved_undetermined_flag[]
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)) {
av_log(s->avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n",
sh->slice_type);
@ -537,7 +543,8 @@ static int hls_slice_header(HEVCContext *s)
sh->collocated_ref_idx = get_ue_golomb_long(gb);
if (sh->collocated_ref_idx >= sh->nb_refs[sh->collocated_list]) {
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;
}
}
@ -714,7 +721,8 @@ static void hls_sao_param(HEVCContext *s, int rx, int ry)
if (sao->type_idx[c_idx] == SAO_BAND) {
for (i = 0; i < 4; 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 {
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 CTB
static void hls_transform_unit(HEVCContext *s, int x0, int y0,
int xBase, int yBase, int cb_xBase, int cb_yBase,
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);
} else if (blk_idx == 3) {
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, 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->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 &&
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);
}
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) =
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,
lc->slice_or_tiles_up_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);
}
}
@ -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);
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,
pic_width, pic_height);
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_h height of block
*/
static void chroma_mc(HEVCContext *s, int16_t *dst1, int16_t *dst2, ptrdiff_t dststride, AVFrame *ref,
const Mv *mv, int x_off, int y_off, int block_w, int block_h)
static void chroma_mc(HEVCContext *s, int16_t *dst1, int16_t *dst2,
ptrdiff_t dststride, AVFrame *ref, const Mv *mv,
int x_off, int y_off, int block_w, int block_h)
{
HEVCLocalContext *lc = s->HEVClc;
uint8_t *src1 = ref->data[1];
@ -1124,8 +1137,11 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0,
else
merge_idx = 0;
ff_hevc_luma_mv_merge_mode(s, x0, y0, 1 << log2_cb_size, 1 << log2_cb_size,
log2_cb_size, partIdx, merge_idx, &current_mv);
ff_hevc_luma_mv_merge_mode(s, x0, y0,
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;
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);
mvp_flag[0] = ff_hevc_mvp_lx_flag_decode(s);
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].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;
mvp_flag[1] = ff_hevc_mvp_lx_flag_decode(s);
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].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.y = y0;
lc->cu.rqt_root_cbf = 1;
lc->cu.pred_mode = MODE_INTRA;
lc->cu.part_mode = PART_2Nx2N;
lc->cu.intra_split_flag = 0;
lc->cu.pcm_flag = 0;
SAMPLE_CTB(s->skip_flag, x_cb, y_cb) = 0;
for (x = 0; x < 4; x++)
lc->pu.intra_pred_mode[x] = 1;
@ -1725,7 +1743,8 @@ static int hls_coding_quadtree(HEVCContext *s, int x0, int y0,
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;
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);
return 0;
fail:
if (s->ref && s->threads_type == FF_THREAD_FRAME)
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)
dst[di++] = src[si++];
nsc:
nsc:
memset(dst + di, 0, FF_INPUT_BUFFER_PADDING_SIZE);
nal->data = dst;
@ -2378,7 +2398,8 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
goto fail;
}
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_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));
@ -2691,6 +2712,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx)
s->context_initialized = 1;
return 0;
fail:
hevc_decode_free(avctx);
return AVERROR(ENOMEM);
@ -2803,7 +2825,8 @@ static int hevc_decode_extradata(HEVCContext *s)
ret = decode_nal_units(s, gb.buffer, nalsize);
if (ret < 0) {
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;
}
bytestream2_skip(&gb, nalsize);
@ -2907,5 +2930,6 @@ AVCodec ff_hevc_decoder = {
.flush = hevc_decode_flush,
.update_thread_context = hevc_update_thread_context,
.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
*/
static const uint8_t init_values[3][HEVC_CONTEXTS] = {
{
// sao_merge_flag
{ // sao_merge_flag
153,
// sao_type_idx
200,
@ -195,10 +194,8 @@ static const uint8_t init_values[3][HEVC_CONTEXTS] = {
140, 92, 137, 138, 140, 152, 138, 139, 153, 74, 149, 92, 139, 107,
122, 152, 140, 179, 166, 182, 140, 227, 122, 197,
// coeff_abs_level_greater2_flag
138, 153, 136, 167, 152, 152,
},
{
// sao_merge_flag
138, 153, 136, 167, 152, 152, },
{ // sao_merge_flag
153,
// sao_type_idx
185,
@ -260,10 +257,8 @@ static const uint8_t init_values[3][HEVC_CONTEXTS] = {
154, 196, 196, 167, 154, 152, 167, 182, 182, 134, 149, 136, 153, 121,
136, 137, 169, 194, 166, 167, 154, 167, 137, 182,
// coeff_abs_level_greater2_flag
107, 167, 91, 122, 107, 167,
},
{
// sao_merge_flag
107, 167, 91, 122, 107, 167, },
{ // sao_merge_flag
153,
// sao_type_idx
160,
@ -561,7 +556,8 @@ void ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts)
(s->pps->tile_id[ctb_addr_ts] != s->pps->tile_id[ctb_addr_ts - 1])))
cabac_init_state(s);
if (!s->sh.first_slice_in_pic_flag && s->pps->entropy_coding_sync_enabled_flag) {
if (!s->sh.first_slice_in_pic_flag &&
s->pps->entropy_coding_sync_enabled_flag) {
if ((ctb_addr_ts % s->sps->ctb_width) == 0) {
if (s->sps->ctb_width == 1)
cabac_init_state(s);
@ -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_top > ct_depth);
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 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;
int idxt;
@ -71,19 +73,23 @@ static int chroma_tc(HEVCContext *s, int qp_y, int c_idx, int tc_offset)
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;
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 yQgBase = yBase - (yBase & MinCuQpDeltaSizeMask);
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 availableA = (xBase & ctb_size_mask) &&
(xQgBase & ctb_size_mask);
int availableB = (yBase & ctb_size_mask) &&
(yQgBase & ctb_size_mask);
int qPy_pred;
int qPy_a;
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;
} else {
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] = {
{ -1, 1, 3, 1, 7, 1, 3, 1 },
{ 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;
}
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);
if (s->HEVClc->tu.cu_qp_delta != 0) {
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
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];
}
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;
@ -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 diag_edge[] = { 0, 0, 0, 0 };
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 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];
// 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[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[2] = diag_edge[1];
} else {
@ -286,10 +299,21 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
switch (sao[class_index]->type_idx[c_idx]) {
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;
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;
}
}
@ -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 x_end, y_end;
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_beta_offset = s->deblock[ctb].beta_offset;
int left_tc_offset, left_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;
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_q[0] = get_pcm(s, x, y);
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
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_q[0] = get_pcm(s, x, y);
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
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_q[0] = get_pcm(s, x, 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
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_q[0] = get_pcm(s, x, 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
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,
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 mvs = curr->pred_flag[0] + curr->pred_flag[1];
@ -548,16 +591,18 @@ static int boundary_strength(HEVCContext *s, MvField *curr,
return 1;
}
void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int log2_trafo_size,
int slice_or_tiles_up_boundary, int slice_or_tiles_left_boundary)
void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
int log2_trafo_size,
int slice_or_tiles_up_boundary,
int slice_or_tiles_left_boundary)
{
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_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 is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width +
(x0 >> log2_min_pu_size)].is_intra;
int i, j;
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];
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);
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);
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 = boundary_strength(s, curr, curr_cbf_luma,
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;
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;
if (y0 == 0 || s->sh.disable_deblocking_filter_flag == 1)
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 yq_tu = (y0 + j) >> log2_min_tu_size;
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;
@ -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];
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);
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)
bs = 0;
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 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);
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 = boundary_strength(s, curr, curr_cbf_luma,
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;
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;
if (x0 == 0 || s->sh.disable_deblocking_filter_flag == 1)
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];
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);
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)
bs = 0;
if (bs)
@ -668,6 +730,7 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, int l
}
}
}
#undef LUMA
#undef CB
#undef CR

View File

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

View File

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

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;
int nal_params_present = 0, vcl_params_present = 0;
@ -643,7 +644,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
}
skip_bits1(gb); // temporal_id_nesting_flag
if (decode_profile_tier_level(s, &sps->ptl, sps->max_sub_layers) < 0) {
if (decode_profile_tier_level(s, &sps->ptl,
sps->max_sub_layers) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "error decoding profile tier level\n");
ret = AVERROR_INVALIDDATA;
goto err;
@ -820,7 +822,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
sps->nb_st_rps = get_ue_golomb_long(gb);
if (sps->nb_st_rps > MAX_SHORT_TERM_RPS_COUNT) {
av_log(s->avctx, AV_LOG_ERROR, "Too many short term RPS: %d.\n",
av_log(s->avctx, AV_LOG_ERROR,
"Too many short term RPS: %d.\n",
sps->nb_st_rps);
ret = AVERROR_INVALIDDATA;
goto err;
@ -872,8 +875,7 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
ret = AVERROR_INVALIDDATA;
goto err;
}
av_log(s->avctx, AV_LOG_WARNING,
"Displaying the whole video surface.\n");
av_log(s->avctx, AV_LOG_WARNING, "Displaying the whole video surface.\n");
sps->pic_conf_win.left_offset =
sps->pic_conf_win.right_offset =
sps->pic_conf_win.top_offset =

View File

@ -56,7 +56,8 @@ RefPicList* ff_hevc_get_ref_list(HEVCContext *s, HEVCFrame *ref, int x0, int y0)
} else {
int x_cb = x0 >> s->sps->log2_ctb_size;
int y_cb = y0 >> s->sps->log2_ctb_size;
int pic_width_cb = (s->sps->width + (1<<s->sps->log2_ctb_size)-1 ) >> s->sps->log2_ctb_size;
int pic_width_cb = (s->sps->width + (1 << s->sps->log2_ctb_size) - 1) >>
s->sps->log2_ctb_size;
int ctb_addr_ts = s->pps->ctb_addr_rs_to_ts[y_cb * pic_width_cb + x_cb];
return (RefPicList *)ref->rpl_tab[ctb_addr_ts];
}
@ -67,7 +68,8 @@ void ff_hevc_clear_refs(HEVCContext *s)
int i;
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++)
ff_hevc_unref_frame(s, &s->DPB[i],
HEVC_FRAME_FLAG_SHORT_REF | HEVC_FRAME_FLAG_LONG_REF);
HEVC_FRAME_FLAG_SHORT_REF |
HEVC_FRAME_FLAG_LONG_REF);
}
void ff_hevc_flush_dpb(HEVCContext *s)
@ -85,7 +87,8 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
if (frame->frame->buf[0])
continue;
ret = ff_thread_get_buffer(s->avctx, &frame->tf, AV_GET_BUFFER_FLAG_REF);
ret = ff_thread_get_buffer(s->avctx, &frame->tf,
AV_GET_BUFFER_FLAG_REF);
if (ret < 0)
return NULL;
@ -140,8 +143,8 @@ int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc)
*frame = ref->frame;
s->ref = ref;
ref->poc = poc;
ref->poc = poc;
ref->flags = HEVC_FRAME_FLAG_OUTPUT | HEVC_FRAME_FLAG_SHORT_REF;
ref->sequence = s->seq_decode;
ref->window = s->sps->output_window;
@ -192,7 +195,8 @@ int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)
(frame->window.top_offset >> vshift) * dst->linesize[j];
dst->data[j] += off;
}
av_log(s->avctx, AV_LOG_DEBUG, "Output frame with POC %d.\n", frame->poc);
av_log(s->avctx, AV_LOG_DEBUG,
"Output frame with POC %d.\n", frame->poc);
return 1;
}
@ -247,8 +251,7 @@ int ff_hevc_slice_rpl(HEVCContext *s)
/* The order of the elements is
* ST_CURR_BEF - ST_CURR_AFT - LT_CURR for the L0 and
* ST_CURR_AFT - ST_CURR_BEF - LT_CURR for the L1
*/
* ST_CURR_AFT - ST_CURR_BEF - LT_CURR for the L1 */
int cand_lists[3] = { list_idx ? ST_CURR_AFT : ST_CURR_BEF,
list_idx ? ST_CURR_BEF : ST_CURR_AFT,
LT_CURR };
@ -331,7 +334,6 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
HEVCFrame *frame;
int i, x, y;
frame = alloc_frame(s);
if (!frame)
return NULL;

View File

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

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

View File

@ -23,6 +23,7 @@
#include "get_bits.h"
#include "bit_depth_template.c"
#include "hevcdsp.h"
#include "hevc.h"
#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]); \
} \
} while (0)
#define TR_16(dst, src, dstep, sstep, assign) \
do { \
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]); \
} \
} while (0)
#define TR_32(dst, src, dstep, sstep, assign) \
do { \
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 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,
@ -410,7 +414,8 @@ static void FUNC(sao_band_filter_1)(uint8_t *dst, uint8_t *src,
int *borders, int width, int height,
int c_idx)
{
FUNC(sao_band_filter)(dst, src, stride, sao, borders, width, height, c_idx, 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,
@ -482,7 +487,6 @@ static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src,
}
width--;
}
}
if (sao_eo_class != SAO_EO_HORIZ) {
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,
ptrdiff_t _stride, SAOParams *sao,
int *borders, int _width, int _height,
int c_idx,
uint8_t vert_edge, uint8_t horiz_edge, uint8_t diag_edge)
int c_idx, uint8_t vert_edge,
uint8_t horiz_edge, uint8_t diag_edge)
{
int x, y;
pixel *dst = (pixel *)_dst;
@ -592,7 +596,6 @@ static void FUNC(sao_edge_filter_1)(uint8_t *_dst, uint8_t *_src,
}
width--;
}
}
{
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,
ptrdiff_t _stride, SAOParams *sao,
int *borders, int _width, int _height,
int c_idx,
uint8_t vert_edge, uint8_t horiz_edge, uint8_t diag_edge)
int c_idx, uint8_t vert_edge,
uint8_t horiz_edge, uint8_t diag_edge)
{
int x, y;
pixel *dst = (pixel *)_dst;
@ -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,
ptrdiff_t _stride, SAOParams *sao,
int *borders, int _width, int _height,
int c_idx,
uint8_t vert_edge, uint8_t horiz_edge, uint8_t diag_edge)
int c_idx, uint8_t vert_edge,
uint8_t horiz_edge, uint8_t diag_edge)
{
int x, y;
pixel *dst = (pixel *)_dst;
@ -829,9 +832,11 @@ static void FUNC(put_hevc_qpel_pixels)(int16_t *dst, ptrdiff_t dststride,
#define QPEL_FILTER_1(src, stride) \
(-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])
#define QPEL_FILTER_2(src, stride) \
(-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])
#define QPEL_FILTER_3(src, 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])
@ -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,
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 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 TQ3 pix[3 * xstride + 3 * ystride]
static void FUNC(hevc_loop_filter_luma)(uint8_t *_pix, ptrdiff_t _xstride,
ptrdiff_t _ystride, int *_beta, int *_tc,
static void FUNC(hevc_loop_filter_luma)(uint8_t *_pix,
ptrdiff_t _xstride, ptrdiff_t _ystride,
int *_beta, int *_tc,
uint8_t *_no_p, uint8_t *_no_q)
{
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,
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);
}
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);
}
@ -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,
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,
int *beta, int *tc, uint8_t *no_p,
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

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) {
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);
for (i = size + bottom_left_size - 1; i >= size; i--)
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);
if (cand_up_right) {
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);
for (i = size + top_right_size - 1; i >= size; i--)
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;
}
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)) {
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);
left[-1] = top[-1];
j = 0;
}
} else {
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 (x0 > 0) {
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] +
left[i - 1] + 2) >> 2;
filtered_top[-1] =
filtered_left[-1] = (left[0] + 2 * left[-1] +
top[0] + 2) >> 2;
filtered_left[-1] = (left[0] + 2 * left[-1] + top[0] + 2) >> 2;
for (i = 2 * size - 2; i >= 0; i--)
filtered_top[i] = (top[i + 1] + 2 * top[i] +
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;
default:
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;
}
}