#include <inttypes.h>
+#include "golomb_legacy.h"
#include "internal.h"
#include "avcodec.h"
+#include "h264.h"
#include "h264dec.h"
-#include "golomb.h"
#include "mpegutils.h"
#include <assert.h>
return 0;
}
-int ff_h264_decode_ref_pic_list_reordering(const H264Context *h, H264SliceContext *sl)
+int ff_h264_decode_ref_pic_list_reordering(H264SliceContext *sl, void *logctx)
{
int list, index;
break;
if (index >= sl->ref_count[list]) {
- av_log(h->avctx, AV_LOG_ERROR, "reference count overflow\n");
+ av_log(logctx, AV_LOG_ERROR, "reference count overflow\n");
return AVERROR_INVALIDDATA;
} else if (op > 2) {
- av_log(h->avctx, AV_LOG_ERROR,
+ av_log(logctx, AV_LOG_ERROR,
"illegal modification_of_pic_nums_idc %u\n",
op);
return AVERROR_INVALIDDATA;
int current_ref_assigned = 0, err = 0;
H264Picture *av_uninit(pic);
+ if (!h->ps.sps) {
+ av_log(h->avctx, AV_LOG_ERROR, "SPS is unset\n");
+ err = AVERROR_INVALIDDATA;
+ goto out;
+ }
+
if (!h->explicit_ref_marking)
generate_sliding_window_mmcos(h);
mmco_count = h->nb_mmco;
print_short_term(h);
print_long_term(h);
+out:
return (h->avctx->err_recognition & AV_EF_EXPLODE) ? err : 0;
}
-int ff_h264_decode_ref_pic_marking(const H264Context *h, H264SliceContext *sl,
- GetBitContext *gb)
+int ff_h264_decode_ref_pic_marking(H264SliceContext *sl, GetBitContext *gb,
+ const H2645NAL *nal, void *logctx)
{
int i;
MMCO *mmco = sl->mmco;
int nb_mmco = 0;
- if (h->nal_unit_type == NAL_IDR_SLICE) { // FIXME fields
+ if (nal->type == H264_NAL_IDR_SLICE) { // FIXME fields
skip_bits1(gb); // broken_link
if (get_bits1(gb)) {
mmco[0].opcode = MMCO_LONG;
mmco[i].short_pic_num =
(sl->curr_pic_num - get_ue_golomb(gb) - 1) &
(sl->max_pic_num - 1);
-#if 0
- if (mmco[i].short_pic_num >= h->short_ref_count ||
- !h->short_ref[mmco[i].short_pic_num]) {
- av_log(s->avctx, AV_LOG_ERROR,
- "illegal short ref in memory management control "
- "operation %d\n", mmco);
- return -1;
- }
-#endif
}
if (opcode == MMCO_SHORT2LONG || opcode == MMCO_LONG2UNUSED ||
opcode == MMCO_LONG || opcode == MMCO_SET_MAX_LONG) {
if (long_arg >= 32 ||
(long_arg >= 16 && !(opcode == MMCO_SET_MAX_LONG &&
long_arg == 16) &&
- !(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE(h)))) {
- av_log(h->avctx, AV_LOG_ERROR,
+ !(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE(sl)))) {
+ av_log(logctx, AV_LOG_ERROR,
"illegal long ref in memory management control "
"operation %d\n", opcode);
return -1;
}
if (opcode > (unsigned) MMCO_LONG) {
- av_log(h->avctx, AV_LOG_ERROR,
+ av_log(logctx, AV_LOG_ERROR,
"illegal memory management control operation %d\n",
opcode);
return -1;