| 193 | } |
| 194 | |
| 195 | static int decode_slice(H263DecContext *const h) |
| 196 | { |
| 197 | const int part_mask = h->partitioned_frame |
| 198 | ? (ER_AC_END | ER_AC_ERROR) : 0x7F; |
| 199 | const int mb_size = 16 >> h->c.avctx->lowres; |
| 200 | int ret; |
| 201 | |
| 202 | h->last_resync_gb = h->gb; |
| 203 | h->c.first_slice_line = 1; |
| 204 | h->c.resync_mb_x = h->c.mb_x; |
| 205 | h->c.resync_mb_y = h->c.mb_y; |
| 206 | |
| 207 | ff_set_qscale(&h->c, h->c.qscale); |
| 208 | |
| 209 | #if CONFIG_MPEG4_DECODER |
| 210 | if (h->c.studio_profile) { |
| 211 | if ((ret = ff_mpeg4_decode_studio_slice_header(h)) < 0) |
| 212 | return ret; |
| 213 | } |
| 214 | #endif |
| 215 | |
| 216 | if (h->c.avctx->hwaccel) { |
| 217 | const uint8_t *start = h->gb.buffer + get_bits_count(&h->gb) / 8; |
| 218 | ret = FF_HW_CALL(h->c.avctx, decode_slice, start, |
| 219 | get_bits_bytesize(&h->gb, 0) - get_bits_count(&h->gb) / 8); |
| 220 | // ensure we exit decode loop |
| 221 | h->c.mb_y = h->c.mb_height; |
| 222 | return ret; |
| 223 | } |
| 224 | |
| 225 | #if CONFIG_MPEG4_DECODER |
| 226 | if (h->partitioned_frame) { |
| 227 | const int qscale = h->c.qscale; |
| 228 | |
| 229 | av_assert1(h->c.codec_id == AV_CODEC_ID_MPEG4); |
| 230 | |
| 231 | ret = ff_mpeg4_decode_partitions(h); |
| 232 | if (ret < 0) |
| 233 | return ret; |
| 234 | |
| 235 | /* restore variables which were modified */ |
| 236 | h->c.first_slice_line = 1; |
| 237 | h->c.mb_x = h->c.resync_mb_x; |
| 238 | h->c.mb_y = h->c.resync_mb_y; |
| 239 | ff_set_qscale(&h->c, qscale); |
| 240 | } |
| 241 | #endif |
| 242 | |
| 243 | for (; h->c.mb_y < h->c.mb_height; h->c.mb_y++) { |
| 244 | /* per-row end of slice checks */ |
| 245 | if (h->c.msmpeg4_version != MSMP4_UNUSED) { |
| 246 | if (h->c.resync_mb_y + h->slice_height == h->c.mb_y) { |
| 247 | ff_er_add_slice(&h->c.er, h->c.resync_mb_x, h->c.resync_mb_y, |
| 248 | h->c.mb_x - 1, h->c.mb_y, ER_MB_END); |
| 249 | |
| 250 | return 0; |
| 251 | } |
| 252 | } |
no test coverage detected