Commit b3e5d595 authored by Hendrik Leppkes's avatar Hendrik Leppkes

Merge commit '979cb551'

* commit '979cb551':
  hevc: Split the sei parsing in 3 functions

Conflicts:
	libavcodec/hevc_sei.c
Merged-by: 's avatarHendrik Leppkes <h.leppkes@gmail.com>
parents 90ec89a6 979cb551
......@@ -176,26 +176,11 @@ static int active_parameter_sets(HEVCContext *s)
return 0;
}
static int decode_nal_sei_message(HEVCContext *s)
static int decode_nal_sei_prefix(HEVCContext *s, int type, int size)
{
GetBitContext *gb = &s->HEVClc->gb;
int payload_type = 0;
int payload_size = 0;
int byte = 0xFF;
av_log(s->avctx, AV_LOG_DEBUG, "Decoding SEI\n");
while (byte == 0xFF) {
byte = get_bits(gb, 8);
payload_type += byte;
}
byte = 0xFF;
while (byte == 0xFF) {
byte = get_bits(gb, 8);
payload_size += byte;
}
if (s->nal_unit_type == NAL_SEI_PREFIX) {
switch (payload_type) {
switch (type) {
case 256: // Mismatched value from HM 8.1
return decode_nal_sei_decoded_picture_hash(s);
case SEI_TYPE_FRAME_PACKING:
......@@ -205,28 +190,57 @@ static int decode_nal_sei_message(HEVCContext *s)
case SEI_TYPE_PICTURE_TIMING:
{
int ret = decode_pic_timing(s);
av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", payload_type);
skip_bits(gb, 8 * payload_size);
av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);
skip_bits(gb, 8 * size);
return ret;
}
case SEI_TYPE_ACTIVE_PARAMETER_SETS:
active_parameter_sets(s);
av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", payload_type);
av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);
return 0;
default:
av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", payload_type);
skip_bits(gb, 8 * payload_size);
av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);
skip_bits_long(gb, 8 * size);
return 0;
}
} else { /* nal_unit_type == NAL_SEI_SUFFIX */
switch (payload_type) {
}
static int decode_nal_sei_suffix(HEVCContext *s, int type, int size)
{
GetBitContext *gb = &s->HEVClc->gb;
switch (type) {
case SEI_TYPE_DECODED_PICTURE_HASH:
return decode_nal_sei_decoded_picture_hash(s);
default:
av_log(s->avctx, AV_LOG_DEBUG, "Skipped SUFFIX SEI %d\n", payload_type);
skip_bits(gb, 8 * payload_size);
av_log(s->avctx, AV_LOG_DEBUG, "Skipped SUFFIX SEI %d\n", type);
skip_bits_long(gb, 8 * size);
return 0;
}
}
static int decode_nal_sei_message(HEVCContext *s)
{
GetBitContext *gb = &s->HEVClc->gb;
int payload_type = 0;
int payload_size = 0;
int byte = 0xFF;
av_log(s->avctx, AV_LOG_DEBUG, "Decoding SEI\n");
while (byte == 0xFF) {
byte = get_bits(gb, 8);
payload_type += byte;
}
byte = 0xFF;
while (byte == 0xFF) {
byte = get_bits(gb, 8);
payload_size += byte;
}
if (s->nal_unit_type == NAL_SEI_PREFIX) {
return decode_nal_sei_prefix(s, payload_type, payload_size);
} else { /* nal_unit_type == NAL_SEI_SUFFIX */
return decode_nal_sei_suffix(s, payload_type, payload_size);
}
return 1;
}
......
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