Commit 5a41999d authored by Mickaël Raulet's avatar Mickaël Raulet Committed by Michael Niedermayer

hevc/rext: basic infrastructure for supporting range extension

- support for 4:2:2 and 4:4:4 up to 12 bits
- add a new profile for range extension
(cherry picked from commit d3c067fa65bbc871758d28aa07f54123430ca346)
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 250430bf
......@@ -2866,6 +2866,7 @@ typedef struct AVCodecContext {
#define FF_PROFILE_HEVC_MAIN 1
#define FF_PROFILE_HEVC_MAIN_10 2
#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3
#define FF_PROFILE_HEVC_REXT 4
/**
* level
......
This diff is collapsed.
......@@ -83,6 +83,7 @@
#define SAMPLE(tab, x, y) ((tab)[(y) * s->sps->width + (x)])
#define SAMPLE_CTB(tab, x, y) ((tab)[(y) * min_cb_width + (x)])
#define SAMPLE_CBF(tab, x, y) ((tab)[((y) & ((1<<log2_trafo_size)-1)) * MAX_CU_SIZE + ((x) & ((1<<log2_trafo_size)-1))])
#define SAMPLE_CBF2(tab, x, y) ((tab)[(y) * MAX_CU_SIZE + (x)])
#define IS_IDR(s) ((s)->nal_unit_type == NAL_IDR_W_RADL || (s)->nal_unit_type == NAL_IDR_N_LP)
#define IS_BLA(s) ((s)->nal_unit_type == NAL_BLA_W_RADL || (s)->nal_unit_type == NAL_BLA_W_LP || \
......@@ -457,6 +458,13 @@ typedef struct HEVCSPS {
int max_transform_hierarchy_depth_inter;
int max_transform_hierarchy_depth_intra;
int transform_skip_rotation_enabled_flag;
int transform_skip_context_enabled_flag;
int implicit_rdpcm_enabled_flag;
int explicit_rdpcm_enabled_flag;
int intra_smoothing_disabled_flag;
int persistent_rice_adaptation_enabled_flag;
///< coded frame dimension in various units
int width;
int height;
......@@ -526,6 +534,15 @@ typedef struct HEVCPPS {
int log2_parallel_merge_level; ///< log2_parallel_merge_level_minus2 + 2
int num_extra_slice_header_bits;
uint8_t slice_header_extension_present_flag;
uint8_t log2_max_transform_skip_block_size;
uint8_t cross_component_prediction_enabled_flag;
uint8_t chroma_qp_offset_list_enabled_flag;
uint8_t diff_cu_chroma_qp_offset_depth;
uint8_t chroma_qp_offset_list_len_minus1;
int8_t cb_qp_offset_list[5];
int8_t cr_qp_offset_list[5];
uint8_t log2_sao_offset_scale_luma;
uint8_t log2_sao_offset_scale_chroma;
// Inferred parameters
unsigned int *column_width; ///< ColumnWidth
......@@ -661,7 +678,8 @@ typedef struct PredictionUnit {
uint8_t intra_pred_mode[4];
Mv mvd;
uint8_t merge_flag;
uint8_t intra_pred_mode_c;
uint8_t intra_pred_mode_c[4];
uint8_t chroma_mode_c[4];
} PredictionUnit;
typedef struct TransformTree {
......@@ -677,7 +695,9 @@ typedef struct TransformUnit {
int cu_qp_delta;
// Inferred parameters;
int cur_intra_pred_mode;
int intra_pred_mode;
int intra_pred_mode_c;
int chroma_mode_c;
uint8_t is_cu_qp_delta_coded;
} TransformUnit;
......@@ -968,7 +988,6 @@ int ff_hevc_no_residual_syntax_flag_decode(HEVCContext *s);
int ff_hevc_split_transform_flag_decode(HEVCContext *s, int log2_trafo_size);
int ff_hevc_cbf_cb_cr_decode(HEVCContext *s, int trafo_depth);
int ff_hevc_cbf_luma_decode(HEVCContext *s, int trafo_depth);
int ff_hevc_transform_skip_flag_decode(HEVCContext *s, int c_idx);
/**
* Get the number of candidate references for the current frame.
......
......@@ -894,7 +894,7 @@ int ff_hevc_cbf_luma_decode(HEVCContext *s, int trafo_depth)
return GET_CABAC(elem_offset[CBF_LUMA] + !trafo_depth);
}
int ff_hevc_transform_skip_flag_decode(HEVCContext *s, int c_idx)
static int ff_hevc_transform_skip_flag_decode(HEVCContext *s, int c_idx)
{
return GET_CABAC(elem_offset[TRANSFORM_SKIP_FLAG] + !!c_idx);
}
......@@ -1093,16 +1093,18 @@ void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
// Derive QP for dequant
if (!lc->cu.cu_transquant_bypass_flag) {
static const int qp_c[] = { 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37 };
static const uint8_t rem6[51 + 2 * 6 + 1] = {
static const uint8_t rem6[51 + 4 * 6 + 1] = {
0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2,
3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,
0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3,
4, 5, 0, 1, 2, 3, 4, 5, 0, 1
};
static const uint8_t div6[51 + 2 * 6 + 1] = {
static const uint8_t div6[51 + 4 * 6 + 1] = {
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3,
3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,
7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10,
10, 10, 11, 11, 11, 11, 11, 11, 12, 12
};
int qp_y = lc->qp_y;
......
......@@ -61,12 +61,16 @@ static int chroma_tc(HEVCContext *s, int qp_y, int c_idx, int tc_offset)
offset = s->pps->cr_qp_offset;
qp_i = av_clip(qp_y + offset, 0, 57);
if (qp_i < 30)
qp = qp_i;
else if (qp_i > 43)
qp = qp_i - 6;
else
qp = qp_c[qp_i - 30];
if (s->sps->chroma_format_idc == 1) {
if (qp_i < 30)
qp = qp_i;
else if (qp_i > 43)
qp = qp_i - 6;
else
qp = qp_c[qp_i - 30];
} else {
qp = av_clip(qp_i, 0, 51);
}
idxt = av_clip(qp + DEFAULT_INTRA_TC_OFFSET + tc_offset, 0, 53);
return tctable[idxt];
......@@ -327,6 +331,9 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
if (x0) {
left_tc_offset = s->deblock[ctb - 1].tc_offset;
left_beta_offset = s->deblock[ctb - 1].beta_offset;
} else {
left_tc_offset = 0;
left_beta_offset = 0;
}
x_end = x0 + ctb_size;
......@@ -371,22 +378,25 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
// vertical filtering chroma
for (chroma = 1; chroma <= 2; chroma++) {
for (y = y0; y < y_end; y += 16) {
for (x = x0 ? x0 : 16; x < x_end; x += 16) {
const int bs0 = s->vertical_bs[(x >> 3) + (y >> 2) * s->bs_width];
const int bs1 = s->vertical_bs[(x >> 3) + ((y + 8) >> 2) * s->bs_width];
int h = 1 << s->sps->hshift[chroma];
int v = 1 << s->sps->vshift[chroma];
for (y = y0; y < y_end; y += (8 * v)) {
for (x = x0 ? x0 : 8 * h; x < x_end; x += (8 * h)) {
const int bs0 = s->vertical_bs[(x >> 3) + (y >> 2) * s->bs_width];
const int bs1 = s->vertical_bs[(x >> 3) + ((y + (4 * v)) >> 2) * s->bs_width];
if ((bs0 == 2) || (bs1 == 2)) {
const int qp0 = (get_qPy(s, x - 1, y) + get_qPy(s, x, y) + 1) >> 1;
const int qp1 = (get_qPy(s, x - 1, y + 8) + get_qPy(s, x, y + 8) + 1) >> 1;
const int qp0 = (get_qPy(s, x - 1, y) + get_qPy(s, x, y) + 1) >> 1;
const int qp1 = (get_qPy(s, x - 1, y + (4 * v)) + get_qPy(s, x, y + (4 * v)) + 1) >> 1;
c_tc[0] = (bs0 == 2) ? chroma_tc(s, qp0, chroma, tc_offset) : 0;
c_tc[1] = (bs1 == 2) ? chroma_tc(s, qp1, chroma, tc_offset) : 0;
src = &s->frame->data[chroma][y / 2 * s->frame->linesize[chroma] + ((x / 2) << s->sps->pixel_shift)];
src = &s->frame->data[chroma][(y >> s->sps->vshift[chroma]) * s->frame->linesize[chroma] + ((x >> s->sps->hshift[chroma]) << s->sps->pixel_shift)];
if (pcmf) {
no_p[0] = get_pcm(s, x - 1, y);
no_p[1] = get_pcm(s, x - 1, y + 8);
no_p[1] = get_pcm(s, x - 1, y + (4 * v));
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 + (4 * v));
s->hevcdsp.hevc_v_loop_filter_chroma_c(src,
s->frame->linesize[chroma],
c_tc, no_p, no_q);
......@@ -436,35 +446,37 @@ static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
// horizontal filtering chroma
for (chroma = 1; chroma <= 2; chroma++) {
for (y = y0 ? y0 : 16; y < y_end; y += 16) {
for (x = x0 - 8; x < x_end; x += 16) {
int h = 1 << s->sps->hshift[chroma];
int v = 1 << s->sps->vshift[chroma];
for (y = y0 ? y0 : 8 * v; y < y_end; y += (8 * v)) {
for (x = x0 - 8; x < x_end; x += (8 * h)) {
int bs0, bs1;
// to make sure no memory access over boundary when x = -8
// TODO: simplify with row based deblocking
if (x < 0) {
bs0 = 0;
bs1 = s->horizontal_bs[(x + 8 + y * s->bs_width) >> 2];
} else if (x >= x_end - 8) {
bs0 = s->horizontal_bs[(x + y * s->bs_width) >> 2];
bs1 = s->horizontal_bs[(x + (4 * h) + y * s->bs_width) >> 2];
} else if (x >= x_end - 4 * h) {
bs0 = s->horizontal_bs[(x + y * s->bs_width) >> 2];
bs1 = 0;
} else {
bs0 = s->horizontal_bs[(x + y * s->bs_width) >> 2];
bs1 = s->horizontal_bs[(x + 8 + y * s->bs_width) >> 2];
bs0 = s->horizontal_bs[(x + y * s->bs_width) >> 2];
bs1 = s->horizontal_bs[(x + (4 * h) + y * s->bs_width) >> 2];
}
if ((bs0 == 2) || (bs1 == 2)) {
const int qp0 = bs0 == 2 ? (get_qPy(s, x, y - 1) + get_qPy(s, x, y) + 1) >> 1 : 0;
const int qp1 = bs1 == 2 ? (get_qPy(s, x + 8, y - 1) + get_qPy(s, x + 8, y) + 1) >> 1 : 0;
const int qp0 = bs0 == 2 ? (get_qPy(s, x, y - 1) + get_qPy(s, x, y) + 1) >> 1 : 0;
const int qp1 = bs1 == 2 ? (get_qPy(s, x + (4 * h), y - 1) + get_qPy(s, x + (4 * h), y) + 1) >> 1 : 0;
tc_offset = x >= x0 ? cur_tc_offset : left_tc_offset;
c_tc[0] = bs0 == 2 ? chroma_tc(s, qp0, chroma, tc_offset) : 0;
c_tc[1] = bs1 == 2 ? chroma_tc(s, qp1, chroma, cur_tc_offset) : 0;
src = &s->frame->data[chroma][y / 2 * s->frame->linesize[chroma] + ((x / 2) << s->sps->pixel_shift)];
src = &s->frame->data[chroma][(y >> s->sps->vshift[1]) * s->frame->linesize[chroma] + ((x >> s->sps->hshift[1]) << s->sps->pixel_shift)];
if (pcmf) {
no_p[0] = get_pcm(s, x, y - 1);
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);
no_p[0] = get_pcm(s, x, y - 1);
no_p[1] = get_pcm(s, x + (4 * h), y - 1);
no_q[0] = get_pcm(s, x, y);
no_q[1] = get_pcm(s, x + (4 * h), y);
s->hevcdsp.hevc_h_loop_filter_chroma_c(src,
s->frame->linesize[chroma],
c_tc, no_p, no_q);
......
......@@ -207,6 +207,8 @@ static void decode_profile_tier_level(HEVCContext *s, PTLCommon *ptl)
av_log(s->avctx, AV_LOG_DEBUG, "Main 10 profile bitstream\n");
else if (ptl->profile_idc == FF_PROFILE_HEVC_MAIN_STILL_PICTURE)
av_log(s->avctx, AV_LOG_DEBUG, "Main Still Picture profile bitstream\n");
else if (ptl->profile_idc == FF_PROFILE_HEVC_REXT)
av_log(s->avctx, AV_LOG_DEBUG, "Range Extension profile bitstream\n");
else
av_log(s->avctx, AV_LOG_WARNING, "Unknown HEVC profile: %d\n", ptl->profile_idc);
......@@ -668,8 +670,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
}
sps->chroma_format_idc = get_ue_golomb_long(gb);
if (sps->chroma_format_idc != 1) {
avpriv_report_missing_feature(s->avctx, "chroma_format_idc != 1\n");
if (!(sps->chroma_format_idc == 1 || sps->chroma_format_idc == 2 || sps->chroma_format_idc == 3)) {
avpriv_report_missing_feature(s->avctx, "chroma_format_idc != {1, 2, 3}\n");
ret = AVERROR_PATCHWELCOME;
goto err;
}
......@@ -677,6 +679,9 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
if (sps->chroma_format_idc == 3)
sps->separate_colour_plane_flag = get_bits1(gb);
if (sps->separate_colour_plane_flag)
sps->chroma_format_idc = 0;
sps->width = get_ue_golomb_long(gb);
sps->height = get_ue_golomb_long(gb);
if ((ret = av_image_check_size(sps->width,
......@@ -718,20 +723,30 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
goto err;
}
if (sps->chroma_format_idc == 1) {
switch (sps->bit_depth) {
case 8: sps->pix_fmt = AV_PIX_FMT_YUV420P; break;
case 9: sps->pix_fmt = AV_PIX_FMT_YUV420P9; break;
case 10: sps->pix_fmt = AV_PIX_FMT_YUV420P10; break;
default:
av_log(s->avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\n",
sps->bit_depth);
ret = AVERROR_PATCHWELCOME;
goto err;
}
} else {
switch (sps->bit_depth) {
case 8:
if (sps->chroma_format_idc == 1) sps->pix_fmt = AV_PIX_FMT_YUV420P;
if (sps->chroma_format_idc == 2) sps->pix_fmt = AV_PIX_FMT_YUV422P;
if (sps->chroma_format_idc == 3) sps->pix_fmt = AV_PIX_FMT_YUV444P;
break;
case 9:
if (sps->chroma_format_idc == 1) sps->pix_fmt = AV_PIX_FMT_YUV420P9;
if (sps->chroma_format_idc == 2) sps->pix_fmt = AV_PIX_FMT_YUV422P9;
if (sps->chroma_format_idc == 3) sps->pix_fmt = AV_PIX_FMT_YUV444P9;
break;
case 10:
if (sps->chroma_format_idc == 1) sps->pix_fmt = AV_PIX_FMT_YUV420P10;
if (sps->chroma_format_idc == 2) sps->pix_fmt = AV_PIX_FMT_YUV422P10;
if (sps->chroma_format_idc == 3) sps->pix_fmt = AV_PIX_FMT_YUV444P10;
break;
case 12:
if (sps->chroma_format_idc == 1) sps->pix_fmt = AV_PIX_FMT_YUV420P12;
if (sps->chroma_format_idc == 2) sps->pix_fmt = AV_PIX_FMT_YUV422P12;
if (sps->chroma_format_idc == 3) sps->pix_fmt = AV_PIX_FMT_YUV444P12;
break;
default:
av_log(s->avctx, AV_LOG_ERROR,
"non-4:2:0 support is currently unspecified.\n");
"4:2:0, 4:2:2, 4:4:4 supports are currently specified for 8, 10 and 12 bits.\n");
return AVERROR_PATCHWELCOME;
}
......@@ -862,8 +877,42 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
vui_present = get_bits1(gb);
if (vui_present)
decode_vui(s, sps);
skip_bits1(gb); // sps_extension_flag
if (get_bits1(gb)) { // sps_extension_flag
int sps_extension_flag[1];
for (i = 0; i < 1; i++)
sps_extension_flag[i] = get_bits1(gb);
skip_bits(gb, 7); //sps_extension_7bits = get_bits(gb, 7);
if (sps_extension_flag[0]) {
int extended_precision_processing_flag;
int high_precision_offsets_enabled_flag;
int cabac_bypass_alignment_enabled_flag;
sps->transform_skip_rotation_enabled_flag = get_bits1(gb);
sps->transform_skip_context_enabled_flag = get_bits1(gb);
sps->implicit_rdpcm_enabled_flag = get_bits1(gb);
sps->explicit_rdpcm_enabled_flag = get_bits1(gb);
extended_precision_processing_flag = get_bits1(gb);
if (extended_precision_processing_flag)
av_log(s->avctx, AV_LOG_WARNING,
"extended_precision_processing_flag not yet implemented\n");
sps->intra_smoothing_disabled_flag = get_bits1(gb);
high_precision_offsets_enabled_flag = get_bits1(gb);
if (high_precision_offsets_enabled_flag)
av_log(s->avctx, AV_LOG_WARNING,
"high_precision_offsets_enabled_flag not yet implemented\n");
sps->persistent_rice_adaptation_enabled_flag = get_bits1(gb);
cabac_bypass_alignment_enabled_flag = get_bits1(gb);
if (cabac_bypass_alignment_enabled_flag)
av_log(s->avctx, AV_LOG_WARNING,
"cabac_bypass_alignment_enabled_flag not yet implemented\n");
}
}
if (s->apply_defdispwin) {
sps->output_window.left_offset += sps->vui.def_disp_win.left_offset;
sps->output_window.right_offset += sps->vui.def_disp_win.right_offset;
......@@ -997,6 +1046,46 @@ static void hevc_pps_free(void *opaque, uint8_t *data)
av_freep(&pps);
}
static int pps_range_extensions(HEVCContext *s, HEVCPPS *pps, HEVCSPS *sps) {
GetBitContext *gb = &s->HEVClc->gb;
int i;
if (pps->transform_skip_enabled_flag) {
pps->log2_max_transform_skip_block_size = get_ue_golomb_long(gb) + 2;
}
pps->cross_component_prediction_enabled_flag = get_bits1(gb);
if (pps->cross_component_prediction_enabled_flag) {
av_log(s->avctx, AV_LOG_WARNING,
"cross_component_prediction_enabled_flag is not yet implemented.\n");
}
pps->chroma_qp_offset_list_enabled_flag = get_bits1(gb);
if (pps->chroma_qp_offset_list_enabled_flag) {
pps->diff_cu_chroma_qp_offset_depth = get_ue_golomb_long(gb);
pps->chroma_qp_offset_list_len_minus1 = get_ue_golomb_long(gb);
if (pps->chroma_qp_offset_list_len_minus1 && pps->chroma_qp_offset_list_len_minus1 >= 5) {
av_log(s->avctx, AV_LOG_ERROR,
"chroma_qp_offset_list_len_minus1 shall be in the range [0, 5].\n");
return AVERROR_INVALIDDATA;
}
for (i = 0; i <= pps->chroma_qp_offset_list_len_minus1; i++) {
pps->cb_qp_offset_list[i] = get_se_golomb_long(gb);
if (pps->cb_qp_offset_list[i]) {
av_log(s->avctx, AV_LOG_WARNING,
"cb_qp_offset_list not tested yet.\n");
}
pps->cr_qp_offset_list[i] = get_se_golomb_long(gb);
if (pps->cr_qp_offset_list[i]) {
av_log(s->avctx, AV_LOG_WARNING,
"cb_qp_offset_list not tested yet.\n");
}
}
}
pps->log2_sao_offset_scale_luma = get_ue_golomb_long(gb);
pps->log2_sao_offset_scale_chroma = get_ue_golomb_long(gb);
return(0);
}
int ff_hevc_decode_nal_pps(HEVCContext *s)
{
GetBitContext *gb = &s->HEVClc->gb;
......@@ -1030,6 +1119,7 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
pps->disable_dbf = 0;
pps->beta_offset = 0;
pps->tc_offset = 0;
pps->log2_max_transform_skip_block_size = 2;
// Coded parameters
pps_id = get_ue_golomb_long(gb);
......@@ -1190,7 +1280,16 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
}
pps->slice_header_extension_present_flag = get_bits1(gb);
skip_bits1(gb); // pps_extension_flag
if (get_bits1(gb)) { // pps_extension_present_flag
int pps_range_extensions_flag = get_bits1(gb);
/* int pps_extension_7bits = */ get_bits(gb, 7);
if (sps->ptl.general_ptl.profile_idc == FF_PROFILE_HEVC_REXT && pps_range_extensions_flag) {
av_log(s->avctx, AV_LOG_ERROR,
"PPS extension flag is partially implemented.\n");
pps_range_extensions(s, pps, sps);
}
}
// Inferred parameters
pps->col_bd = av_malloc_array(pps->num_tile_columns + 1, sizeof(*pps->col_bd));
......
......@@ -119,6 +119,10 @@ DECLARE_ALIGNED(16, const int8_t, ff_hevc_qpel_filters[3][16]) = {
#include "hevcdsp_template.c"
#undef BIT_DEPTH
#define BIT_DEPTH 12
#include "hevcdsp_template.c"
#undef BIT_DEPTH
void ff_hevc_dsp_init(HEVCDSPContext *hevcdsp, int bit_depth)
{
#undef FUNC
......@@ -235,6 +239,9 @@ int i = 0;
case 10:
HEVC_DSP(10);
break;
case 12:
HEVC_DSP(12);
break;
default:
HEVC_DSP(8);
break;
......
......@@ -41,8 +41,8 @@ typedef struct SAOParams {
} SAOParams;
typedef struct HEVCDSPContext {
void (*put_pcm)(uint8_t *dst, ptrdiff_t stride, int size,
GetBitContext *gb, int pcm_bit_depth);
void (*put_pcm)(uint8_t *_dst, ptrdiff_t _stride, int width, int height,
struct GetBitContext *gb, int pcm_bit_depth);
void (*transform_add[4])(uint8_t *_dst, int16_t *coeffs, ptrdiff_t _stride);
......
......@@ -27,7 +27,7 @@
#include "hevcdsp.h"
static void FUNC(put_pcm)(uint8_t *_dst, ptrdiff_t stride, int size,
static void FUNC(put_pcm)(uint8_t *_dst, ptrdiff_t stride, int width, int height,
GetBitContext *gb, int pcm_bit_depth)
{
int x, y;
......@@ -35,8 +35,8 @@ static void FUNC(put_pcm)(uint8_t *_dst, ptrdiff_t stride, int size,
stride /= sizeof(pixel);
for (y = 0; y < size; y++) {
for (x = 0; x < size; x++)
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++)
dst[x] = get_bits(gb, pcm_bit_depth) << (BIT_DEPTH - pcm_bit_depth);
dst += stride;
}
......
......@@ -36,6 +36,10 @@
#include "hevcpred_template.c"
#undef BIT_DEPTH
#define BIT_DEPTH 12
#include "hevcpred_template.c"
#undef BIT_DEPTH
void ff_hevc_pred_init(HEVCPredContext *hpc, int bit_depth)
{
#undef FUNC
......@@ -63,6 +67,9 @@ void ff_hevc_pred_init(HEVCPredContext *hpc, int bit_depth)
case 10:
HEVC_PRED(10);
break;
case 12:
HEVC_PRED(12);
break;
default:
HEVC_PRED(8);
break;
......
......@@ -91,8 +91,8 @@ do { \
int min_pu_width = s->sps->min_pu_width;
enum IntraPredMode mode = c_idx ? lc->pu.intra_pred_mode_c :
lc->tu.cur_intra_pred_mode;
enum IntraPredMode mode = c_idx ? lc->tu.intra_pred_mode_c :
lc->tu.intra_pred_mode;
pixel4 a;
pixel left_array[2 * MAX_TB_SIZE + 1];
pixel filtered_left_array[2 * MAX_TB_SIZE + 1];
......@@ -207,7 +207,6 @@ do { \
j++;
EXTEND_LEFT_CIP(top, j, j + 1);
left[-1] = top[-1];
j = 0;
}
} else {
j = 0;
......@@ -221,7 +220,6 @@ do { \
top[-1] = top[0];
}
left[-1] = top[-1];
j = 0;
}
left[-1] = top[-1];
if (cand_bottom_left || cand_left) {
......@@ -238,7 +236,6 @@ do { \
if (!IS_INTRA(-1, - 1))
left[-1] = left[0];
} else if (x0 == 0) {
a = PIXEL_SPLAT_X4(left[size_max_y - 1]);
EXTEND(left, 0, size_max_y);
} else {
a = PIXEL_SPLAT_X4(left[size_max_y - 1]);
......@@ -290,7 +287,7 @@ do { \
top[-1] = left[-1];
// Filtering process
if (c_idx == 0) {
if (!s->sps->intra_smoothing_disabled_flag && (c_idx == 0 || s->sps->chroma_format_idc == 3)) {
if (mode != INTRA_DC && size != 4){
int intra_hor_ver_dist_thresh[] = { 7, 1, 0 };
int min_dist_vert_hor = FFMIN(FFABS((int)(mode - 26U)),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment