MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / decode_slice

Function decode_slice

libavcodec/h263dec.c:152–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152static int decode_slice(MpegEncContext *s){
153 const int part_mask= s->partitioned_frame ? (AC_END|AC_ERROR) : 0x7F;
154 const int mb_size= 16>>s->avctx->lowres;
155 s->last_resync_gb= s->gb;
156 s->first_slice_line= 1;
157
158 s->resync_mb_x= s->mb_x;
159 s->resync_mb_y= s->mb_y;
160
161 ff_set_qscale(s, s->qscale);
162
163 if (s->avctx->hwaccel) {
164 const uint8_t *start= s->gb.buffer + get_bits_count(&s->gb)/8;
165 const uint8_t *end = ff_h263_find_resync_marker(start + 1, s->gb.buffer_end);
166 skip_bits_long(&s->gb, 8*(end - start));
167 return s->avctx->hwaccel->decode_slice(s->avctx, start, end - start);
168 }
169
170 if(s->partitioned_frame){
171 const int qscale= s->qscale;
172
173 if(CONFIG_MPEG4_DECODER && s->codec_id==CODEC_ID_MPEG4){
174 if(ff_mpeg4_decode_partitions(s) < 0)
175 return -1;
176 }
177
178 /* restore variables which were modified */
179 s->first_slice_line=1;
180 s->mb_x= s->resync_mb_x;
181 s->mb_y= s->resync_mb_y;
182 ff_set_qscale(s, qscale);
183 }
184
185 for(; s->mb_y < s->mb_height; s->mb_y++) {
186 /* per-row end of slice checks */
187 if(s->msmpeg4_version){
188 if(s->resync_mb_y + s->slice_height == s->mb_y){
189 ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
190
191 return 0;
192 }
193 }
194
195 if(s->msmpeg4_version==1){
196 s->last_dc[0]=
197 s->last_dc[1]=
198 s->last_dc[2]= 128;
199 }
200
201 ff_init_block_index(s);
202 for(; s->mb_x < s->mb_width; s->mb_x++) {
203 int ret;
204
205 ff_update_block_index(s);
206
207 if(s->resync_mb_x == s->mb_x && s->resync_mb_y+1 == s->mb_y){
208 s->first_slice_line=0;
209 }

Callers 1

ff_h263_decode_frameFunction · 0.70

Calls 15

ff_set_qscaleFunction · 0.85
get_bits_countFunction · 0.85
skip_bits_longFunction · 0.85
ff_er_add_sliceFunction · 0.85
ff_init_block_indexFunction · 0.85
ff_update_block_indexFunction · 0.85
MPV_decode_mbFunction · 0.85
ff_h263_loop_filterFunction · 0.85
ff_draw_horiz_bandFunction · 0.85

Tested by

no test coverage detected