mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-19 05:49:09 +02:00
Merge commit 'ae05b4865514fd71b5e9431e93aa0d03d7ba7751'
* commit 'ae05b4865514fd71b5e9431e93aa0d03d7ba7751': hevc: eliminate the second call to hls_nal_unit() Conflicts: libavcodec/hevc.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
commit
4c42c66935
@ -2509,24 +2509,24 @@ static int hls_slice_data_wpp(HEVCContext *s, const uint8_t *nal, int length)
|
|||||||
* @return AVERROR_INVALIDDATA if the packet is not a valid NAL unit,
|
* @return AVERROR_INVALIDDATA if the packet is not a valid NAL unit,
|
||||||
* 0 if the unit should be skipped, 1 otherwise
|
* 0 if the unit should be skipped, 1 otherwise
|
||||||
*/
|
*/
|
||||||
static int hls_nal_unit(HEVCContext *s)
|
static int hls_nal_unit(HEVCNAL *nal, AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
GetBitContext *gb = &s->HEVClc->gb;
|
GetBitContext *gb = &nal->gb;
|
||||||
int nuh_layer_id;
|
int nuh_layer_id;
|
||||||
|
|
||||||
if (get_bits1(gb) != 0)
|
if (get_bits1(gb) != 0)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
s->nal_unit_type = get_bits(gb, 6);
|
nal->type = get_bits(gb, 6);
|
||||||
|
|
||||||
nuh_layer_id = get_bits(gb, 6);
|
nuh_layer_id = get_bits(gb, 6);
|
||||||
s->temporal_id = get_bits(gb, 3) - 1;
|
nal->temporal_id = get_bits(gb, 3) - 1;
|
||||||
if (s->temporal_id < 0)
|
if (nal->temporal_id < 0)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
av_log(s->avctx, AV_LOG_DEBUG,
|
av_log(avctx, AV_LOG_DEBUG,
|
||||||
"nal_unit_type: %d, nuh_layer_id: %d, temporal_id: %d\n",
|
"nal_unit_type: %d, nuh_layer_id: %d, temporal_id: %d\n",
|
||||||
s->nal_unit_type, nuh_layer_id, s->temporal_id);
|
nal->type, nuh_layer_id, nal->temporal_id);
|
||||||
|
|
||||||
return nuh_layer_id == 0;
|
return nuh_layer_id == 0;
|
||||||
}
|
}
|
||||||
@ -2643,11 +2643,9 @@ static int decode_nal_unit(HEVCContext *s, const HEVCNAL *nal)
|
|||||||
GetBitContext *gb = &lc->gb;
|
GetBitContext *gb = &lc->gb;
|
||||||
int ctb_addr_ts, ret;
|
int ctb_addr_ts, ret;
|
||||||
|
|
||||||
ret = init_get_bits8(gb, nal->data, nal->size);
|
*gb = nal->gb;
|
||||||
if (ret < 0)
|
s->nal_unit_type = nal->type;
|
||||||
return ret;
|
s->temporal_id = nal->temporal_id;
|
||||||
|
|
||||||
hls_nal_unit(s);
|
|
||||||
|
|
||||||
switch (s->nal_unit_type) {
|
switch (s->nal_unit_type) {
|
||||||
case NAL_VPS:
|
case NAL_VPS:
|
||||||
@ -2873,22 +2871,22 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
|
|||||||
s->skipped_bytes_pos_size_nal[s->nb_nals] = s->skipped_bytes_pos_size;
|
s->skipped_bytes_pos_size_nal[s->nb_nals] = s->skipped_bytes_pos_size;
|
||||||
s->skipped_bytes_pos_nal[s->nb_nals++] = s->skipped_bytes_pos;
|
s->skipped_bytes_pos_nal[s->nb_nals++] = s->skipped_bytes_pos;
|
||||||
|
|
||||||
ret = init_get_bits8(&s->HEVClc->gb, nal->data, nal->size);
|
ret = init_get_bits8(&nal->gb, nal->data, nal->size);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
ret = hls_nal_unit(s);
|
ret = hls_nal_unit(nal, s->avctx);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid NAL unit %d, skipping.\n",
|
av_log(s->avctx, AV_LOG_ERROR, "Invalid NAL unit %d, skipping.\n",
|
||||||
s->nal_unit_type);
|
nal->type);
|
||||||
}
|
}
|
||||||
s->nb_nals--;
|
s->nb_nals--;
|
||||||
goto skip_nal;
|
goto skip_nal;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->nal_unit_type == NAL_EOB_NUT ||
|
if (nal->type == NAL_EOB_NUT ||
|
||||||
s->nal_unit_type == NAL_EOS_NUT)
|
nal->type == NAL_EOS_NUT)
|
||||||
s->eos = 1;
|
s->eos = 1;
|
||||||
|
|
||||||
skip_nal:
|
skip_nal:
|
||||||
|
@ -754,6 +754,11 @@ typedef struct HEVCNAL {
|
|||||||
|
|
||||||
int raw_size;
|
int raw_size;
|
||||||
const uint8_t *raw_data;
|
const uint8_t *raw_data;
|
||||||
|
|
||||||
|
GetBitContext gb;
|
||||||
|
|
||||||
|
enum NALUnitType type;
|
||||||
|
int temporal_id;
|
||||||
} HEVCNAL;
|
} HEVCNAL;
|
||||||
|
|
||||||
typedef struct HEVCLocalContext {
|
typedef struct HEVCLocalContext {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user