annotate h264_sei.c @ 12409:91db982aaaad libavcodec

fixed some return values and deprecated CODEC_TYPE_VIDEO. dithering (faster) along a linear gradient now.
author bindhammer
date Tue, 24 Aug 2010 14:02:31 +0000
parents 7dd2a45249a9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
1 /*
10858
31645cf81fcb Split SEI code off h264.c.
michael
parents: 10857
diff changeset
2 * H.26L/H.264/AVC/JVT/14496-10/... sei decoding
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
4 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3927
diff changeset
5 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3927
diff changeset
6 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3927
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3927
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
11 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3927
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
15 * Lesser General Public License for more details.
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
16 *
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3927
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 3029
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
20 */
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
21
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
22 /**
11644
7dd2a45249a9 Remove explicit filename from Doxygen @file commands.
diego
parents: 11526
diff changeset
23 * @file
10858
31645cf81fcb Split SEI code off h264.c.
michael
parents: 10857
diff changeset
24 * H.264 / AVC / MPEG4 part10 sei decoding.
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
25 * @author Michael Niedermayer <michaelni@gmx.at>
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
26 */
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
27
9012
15a3df8c01fd More approved hunks for VAAPI & our new and cleaner hwaccel API.
michael
parents: 9004
diff changeset
28 #include "internal.h"
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
29 #include "avcodec.h"
4975
9a6a0818e93f split h264.c to move parser in its own file
aurel
parents: 4931
diff changeset
30 #include "h264.h"
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
31 #include "golomb.h"
1908
e20fd60b215c h264 - progressive I frame CABAC support patch by (Laurent Aimar <fenrir at via dot ecp dot fr>)
michael
parents: 1899
diff changeset
32
3284
a224d9752912 don't force asserts in release builds. 2% faster h264.
lorenm
parents: 3219
diff changeset
33 //#undef NDEBUG
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
34 #include <assert.h>
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
35
10858
31645cf81fcb Split SEI code off h264.c.
michael
parents: 10857
diff changeset
36 static const uint8_t sei_num_clock_ts_table[9]={
31645cf81fcb Split SEI code off h264.c.
michael
parents: 10857
diff changeset
37 1, 1, 1, 2, 2, 3, 3, 2, 3
7423
2eb0e5a2efad left_block intialisation optimisation.
michael
parents: 7421
diff changeset
38 };
4277
113f3b395bac Making rem6 and div6 globally visible and thus adding prefixes.
takis
parents: 4276
diff changeset
39
10858
31645cf81fcb Split SEI code off h264.c.
michael
parents: 10857
diff changeset
40 void ff_h264_reset_sei(H264Context *h) {
9069
8a74ab19d224 Correctly reset SEI variables.
cehoyos
parents: 9066
diff changeset
41 h->sei_recovery_frame_cnt = -1;
8a74ab19d224 Correctly reset SEI variables.
cehoyos
parents: 9066
diff changeset
42 h->sei_dpb_output_delay = 0;
8a74ab19d224 Correctly reset SEI variables.
cehoyos
parents: 9066
diff changeset
43 h->sei_cpb_removal_delay = -1;
8a74ab19d224 Correctly reset SEI variables.
cehoyos
parents: 9066
diff changeset
44 h->sei_buffering_period_present = 0;
8a74ab19d224 Correctly reset SEI variables.
cehoyos
parents: 9066
diff changeset
45 }
8a74ab19d224 Correctly reset SEI variables.
cehoyos
parents: 9066
diff changeset
46
8107
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
47 static int decode_picture_timing(H264Context *h){
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
48 MpegEncContext * const s = &h->s;
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
49 if(h->sps.nal_hrd_parameters_present_flag || h->sps.vcl_hrd_parameters_present_flag){
8967
f0abc5f9e726 Parse cbp_removal_delay in SEI picture structure.
cehoyos
parents: 8966
diff changeset
50 h->sei_cpb_removal_delay = get_bits(&s->gb, h->sps.cpb_removal_delay_length);
8966
328b7d545d0b Parse dpb_output_delay in SEI picture structure.
cehoyos
parents: 8965
diff changeset
51 h->sei_dpb_output_delay = get_bits(&s->gb, h->sps.dpb_output_delay_length);
8107
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
52 }
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
53 if(h->sps.pic_struct_present_flag){
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
54 unsigned int i, num_clock_ts;
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
55 h->sei_pic_struct = get_bits(&s->gb, 4);
9128
793cf8c68c4f Add support for ct_type to correctly detect interlaced flag
schreter
parents: 9125
diff changeset
56 h->sei_ct_type = 0;
8107
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
57
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
58 if (h->sei_pic_struct > SEI_PIC_STRUCT_FRAME_TRIPLING)
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
59 return -1;
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
60
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
61 num_clock_ts = sei_num_clock_ts_table[h->sei_pic_struct];
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
62
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
63 for (i = 0 ; i < num_clock_ts ; i++){
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
64 if(get_bits(&s->gb, 1)){ /* clock_timestamp_flag */
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
65 unsigned int full_timestamp_flag;
9128
793cf8c68c4f Add support for ct_type to correctly detect interlaced flag
schreter
parents: 9125
diff changeset
66 h->sei_ct_type |= 1<<get_bits(&s->gb, 2);
8107
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
67 skip_bits(&s->gb, 1); /* nuit_field_based_flag */
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
68 skip_bits(&s->gb, 5); /* counting_type */
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
69 full_timestamp_flag = get_bits(&s->gb, 1);
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
70 skip_bits(&s->gb, 1); /* discontinuity_flag */
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
71 skip_bits(&s->gb, 1); /* cnt_dropped_flag */
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
72 skip_bits(&s->gb, 8); /* n_frames */
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
73 if(full_timestamp_flag){
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
74 skip_bits(&s->gb, 6); /* seconds_value 0..59 */
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
75 skip_bits(&s->gb, 6); /* minutes_value 0..59 */
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
76 skip_bits(&s->gb, 5); /* hours_value 0..23 */
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
77 }else{
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
78 if(get_bits(&s->gb, 1)){ /* seconds_flag */
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
79 skip_bits(&s->gb, 6); /* seconds_value range 0..59 */
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
80 if(get_bits(&s->gb, 1)){ /* minutes_flag */
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
81 skip_bits(&s->gb, 6); /* minutes_value 0..59 */
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
82 if(get_bits(&s->gb, 1)) /* hours_flag */
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
83 skip_bits(&s->gb, 5); /* hours_value 0..23 */
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
84 }
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
85 }
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
86 }
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
87 if(h->sps.time_offset_length > 0)
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
88 skip_bits(&s->gb, h->sps.time_offset_length); /* time_offset */
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
89 }
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
90 }
9789
391014285c25 Print ct_type and pic_struct.
michael
parents: 9733
diff changeset
91
391014285c25 Print ct_type and pic_struct.
michael
parents: 9733
diff changeset
92 if(s->avctx->debug & FF_DEBUG_PICT_INFO)
391014285c25 Print ct_type and pic_struct.
michael
parents: 9733
diff changeset
93 av_log(s->avctx, AV_LOG_DEBUG, "ct_type:%X pic_struct:%d\n", h->sei_ct_type, h->sei_pic_struct);
8107
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
94 }
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
95 return 0;
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
96 }
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
97
2815
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
98 static int decode_unregistered_user_data(H264Context *h, int size){
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
99 MpegEncContext * const s = &h->s;
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
100 uint8_t user_data[16+256];
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
101 int e, build, i;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
102
2815
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
103 if(size<16)
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
104 return -1;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
105
2815
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
106 for(i=0; i<sizeof(user_data)-1 && i<size; i++){
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
107 user_data[i]= get_bits(&s->gb, 8);
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
108 }
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
109
2815
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
110 user_data[i]= 0;
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
111 e= sscanf(user_data+16, "x264 - core %d"/*%s - H.264/MPEG-4 AVC codec - Copyleft 2005 - http://www.videolan.org/x264.html*/, &build);
11526
75a2c166f11a Ignore x264 build=0 as there is no such version, this restores previous
michael
parents: 10858
diff changeset
112 if(e==1 && build>0)
2815
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
113 h->x264_build= build;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
114
2815
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
115 if(s->avctx->debug & FF_DEBUG_BUGS)
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
116 av_log(s->avctx, AV_LOG_DEBUG, "user data:\"%s\"\n", user_data+16);
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
117
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
118 for(; i<size; i++)
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
119 skip_bits(&s->gb, 8);
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
120
2815
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
121 return 0;
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
122 }
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
123
8783
e91ea98d868a Add SEI recovery point frame counter to H264Context and use it when
cehoyos
parents: 8762
diff changeset
124 static int decode_recovery_point(H264Context *h){
e91ea98d868a Add SEI recovery point frame counter to H264Context and use it when
cehoyos
parents: 8762
diff changeset
125 MpegEncContext * const s = &h->s;
e91ea98d868a Add SEI recovery point frame counter to H264Context and use it when
cehoyos
parents: 8762
diff changeset
126
e91ea98d868a Add SEI recovery point frame counter to H264Context and use it when
cehoyos
parents: 8762
diff changeset
127 h->sei_recovery_frame_cnt = get_ue_golomb(&s->gb);
e91ea98d868a Add SEI recovery point frame counter to H264Context and use it when
cehoyos
parents: 8762
diff changeset
128 skip_bits(&s->gb, 4); /* 1b exact_match_flag, 1b broken_link_flag, 2b changing_slice_group_idc */
e91ea98d868a Add SEI recovery point frame counter to H264Context and use it when
cehoyos
parents: 8762
diff changeset
129
e91ea98d868a Add SEI recovery point frame counter to H264Context and use it when
cehoyos
parents: 8762
diff changeset
130 return 0;
e91ea98d868a Add SEI recovery point frame counter to H264Context and use it when
cehoyos
parents: 8762
diff changeset
131 }
e91ea98d868a Add SEI recovery point frame counter to H264Context and use it when
cehoyos
parents: 8762
diff changeset
132
8972
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
133 static int decode_buffering_period(H264Context *h){
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
134 MpegEncContext * const s = &h->s;
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
135 unsigned int sps_id;
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
136 int sched_sel_idx;
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
137 SPS *sps;
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
138
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
139 sps_id = get_ue_golomb_31(&s->gb);
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
140 if(sps_id > 31 || !h->sps_buffers[sps_id]) {
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
141 av_log(h->s.avctx, AV_LOG_ERROR, "non-existing SPS %d referenced in buffering period\n", sps_id);
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
142 return -1;
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
143 }
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
144 sps = h->sps_buffers[sps_id];
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
145
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
146 // NOTE: This is really so duplicated in the standard... See H.264, D.1.1
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
147 if (sps->nal_hrd_parameters_present_flag) {
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
148 for (sched_sel_idx = 0; sched_sel_idx < sps->cpb_cnt; sched_sel_idx++) {
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
149 h->initial_cpb_removal_delay[sched_sel_idx] = get_bits(&s->gb, sps->initial_cpb_removal_delay_length);
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
150 skip_bits(&s->gb, sps->initial_cpb_removal_delay_length); // initial_cpb_removal_delay_offset
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
151 }
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
152 }
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
153 if (sps->vcl_hrd_parameters_present_flag) {
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
154 for (sched_sel_idx = 0; sched_sel_idx < sps->cpb_cnt; sched_sel_idx++) {
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
155 h->initial_cpb_removal_delay[sched_sel_idx] = get_bits(&s->gb, sps->initial_cpb_removal_delay_length);
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
156 skip_bits(&s->gb, sps->initial_cpb_removal_delay_length); // initial_cpb_removal_delay_offset
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
157 }
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
158 }
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
159
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
160 h->sei_buffering_period_present = 1;
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
161 return 0;
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
162 }
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
163
8996
e65778184ded Make the following H264 functions available to the parser:
cehoyos
parents: 8991
diff changeset
164 int ff_h264_decode_sei(H264Context *h){
2815
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
165 MpegEncContext * const s = &h->s;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
166
2815
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
167 while(get_bits_count(&s->gb) + 16 < s->gb.size_in_bits){
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
168 int size, type;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
169
2815
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
170 type=0;
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
171 do{
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
172 type+= show_bits(&s->gb, 8);
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
173 }while(get_bits(&s->gb, 8) == 255);
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
174
2815
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
175 size=0;
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
176 do{
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
177 size+= show_bits(&s->gb, 8);
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
178 }while(get_bits(&s->gb, 8) == 255);
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
179
2815
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
180 switch(type){
8762
4f1567ce75c4 Replace hard-coded SEI type constants with symbolic names
superdump
parents: 8742
diff changeset
181 case SEI_TYPE_PIC_TIMING: // Picture timing SEI
8107
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
182 if(decode_picture_timing(h) < 0)
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
183 return -1;
e61f76efc9f3 h264: Implement decoding of picture timing SEI message.
andoma
parents: 8079
diff changeset
184 break;
8762
4f1567ce75c4 Replace hard-coded SEI type constants with symbolic names
superdump
parents: 8742
diff changeset
185 case SEI_TYPE_USER_DATA_UNREGISTERED:
3318
8dc886b9568a typo me thinks ...
michael
parents: 3316
diff changeset
186 if(decode_unregistered_user_data(h, size) < 0)
2815
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
187 return -1;
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
188 break;
8783
e91ea98d868a Add SEI recovery point frame counter to H264Context and use it when
cehoyos
parents: 8762
diff changeset
189 case SEI_TYPE_RECOVERY_POINT:
e91ea98d868a Add SEI recovery point frame counter to H264Context and use it when
cehoyos
parents: 8762
diff changeset
190 if(decode_recovery_point(h) < 0)
e91ea98d868a Add SEI recovery point frame counter to H264Context and use it when
cehoyos
parents: 8762
diff changeset
191 return -1;
e91ea98d868a Add SEI recovery point frame counter to H264Context and use it when
cehoyos
parents: 8762
diff changeset
192 break;
8972
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
193 case SEI_BUFFERING_PERIOD:
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
194 if(decode_buffering_period(h) < 0)
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
195 return -1;
eaf39f9b25df Parse buffering period (H.264, D.1.1).
cehoyos
parents: 8970
diff changeset
196 break;
2815
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
197 default:
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
198 skip_bits(&s->gb, 8*size);
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
199 }
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2962
diff changeset
200
2815
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
201 //FIXME check bits here
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
202 align_get_bits(&s->gb);
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
203 }
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
204
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
205 return 0;
636133fccbdc workaround 'colocated mv if colocated block is L1 predicted' bug in x264
michael
parents: 2809
diff changeset
206 }