|
|
@ -150,6 +150,59 @@ static int decode_nal_sei_timecode(HEVCSEITimeCode *s, GetBitContext *gb) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int decode_nal_sei_3d_reference_displays_info(HEVCSEITDRDI *s, GetBitContext *gb) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
s->prec_ref_display_width = get_ue_golomb(gb); |
|
|
|
|
|
|
|
if (s->prec_ref_display_width > 31) |
|
|
|
|
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
|
|
|
|
s->ref_viewing_distance_flag = get_bits1(gb); |
|
|
|
|
|
|
|
if (s->ref_viewing_distance_flag) { |
|
|
|
|
|
|
|
s->prec_ref_viewing_dist = get_ue_golomb(gb); |
|
|
|
|
|
|
|
if (s->prec_ref_viewing_dist > 31) |
|
|
|
|
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
s->num_ref_displays = get_ue_golomb(gb); |
|
|
|
|
|
|
|
if (s->num_ref_displays > 31) |
|
|
|
|
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
|
|
|
|
s->num_ref_displays += 1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < s->num_ref_displays; i++) { |
|
|
|
|
|
|
|
int length; |
|
|
|
|
|
|
|
s->left_view_id[i] = get_ue_golomb(gb); |
|
|
|
|
|
|
|
s->right_view_id[i] = get_ue_golomb(gb); |
|
|
|
|
|
|
|
s->exponent_ref_display_width[i] = get_bits(gb, 6); |
|
|
|
|
|
|
|
if (s->exponent_ref_display_width[i] > 62) |
|
|
|
|
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
|
|
|
|
else if (!s->exponent_ref_display_width[i]) |
|
|
|
|
|
|
|
length = FFMAX(0, (int)s->prec_ref_display_width - 30); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
length = FFMAX(0, (int)s->exponent_ref_display_width[i] + |
|
|
|
|
|
|
|
(int)s->prec_ref_display_width - 31); |
|
|
|
|
|
|
|
s->mantissa_ref_display_width[i] = get_bits_long(gb, length); |
|
|
|
|
|
|
|
if (s->ref_viewing_distance_flag) { |
|
|
|
|
|
|
|
s->exponent_ref_viewing_distance[i] = get_bits(gb, 6); |
|
|
|
|
|
|
|
if (s->exponent_ref_viewing_distance[i] > 62) |
|
|
|
|
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
|
|
|
|
else if (!s->exponent_ref_viewing_distance[i]) |
|
|
|
|
|
|
|
length = FFMAX(0, (int)s->prec_ref_viewing_dist - 30); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
length = FFMAX(0, (int)s->exponent_ref_viewing_distance[i] + |
|
|
|
|
|
|
|
(int)s->prec_ref_viewing_dist - 31); |
|
|
|
|
|
|
|
s->mantissa_ref_viewing_distance[i] = get_bits_long(gb, length); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
s->additional_shift_present_flag[i] = get_bits1(gb); |
|
|
|
|
|
|
|
if (s->additional_shift_present_flag[i]) { |
|
|
|
|
|
|
|
s->num_sample_shift[i] = get_bits(gb, 10); |
|
|
|
|
|
|
|
if (s->num_sample_shift[i] > 1023) |
|
|
|
|
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
|
|
|
|
s->num_sample_shift[i] -= 512; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
s->three_dimensional_reference_displays_extension_flag = get_bits1(gb); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static int decode_nal_sei_prefix(GetBitContext *gb, GetByteContext *gbyte, |
|
|
|
static int decode_nal_sei_prefix(GetBitContext *gb, GetByteContext *gbyte, |
|
|
|
void *logctx, HEVCSEI *s, |
|
|
|
void *logctx, HEVCSEI *s, |
|
|
|
const HEVCParamSets *ps, int type) |
|
|
|
const HEVCParamSets *ps, int type) |
|
|
@ -163,6 +216,8 @@ static int decode_nal_sei_prefix(GetBitContext *gb, GetByteContext *gbyte, |
|
|
|
return decode_nal_sei_active_parameter_sets(s, gb, logctx); |
|
|
|
return decode_nal_sei_active_parameter_sets(s, gb, logctx); |
|
|
|
case SEI_TYPE_TIME_CODE: |
|
|
|
case SEI_TYPE_TIME_CODE: |
|
|
|
return decode_nal_sei_timecode(&s->timecode, gb); |
|
|
|
return decode_nal_sei_timecode(&s->timecode, gb); |
|
|
|
|
|
|
|
case SEI_TYPE_THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO: |
|
|
|
|
|
|
|
return decode_nal_sei_3d_reference_displays_info(&s->tdrdi, gb); |
|
|
|
default: { |
|
|
|
default: { |
|
|
|
int ret = ff_h2645_sei_message_decode(&s->common, type, AV_CODEC_ID_HEVC, |
|
|
|
int ret = ff_h2645_sei_message_decode(&s->common, type, AV_CODEC_ID_HEVC, |
|
|
|
gb, gbyte, logctx); |
|
|
|
gb, gbyte, logctx); |
|
|
|