X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fcbs_jpeg.c;h=7d3e10fcc8e30ae9d0ab6c8535a8dba10585961c;hb=bd96c54fe4819b3ca9a975e2083d67f4443c559b;hp=89512a26bbf190591f7cc51d0b18d202d1b25017;hpb=1812352d767ccf5431aa440123e2e260a4db2726;p=ffmpeg diff --git a/libavcodec/cbs_jpeg.c b/libavcodec/cbs_jpeg.c index 89512a26bbf..7d3e10fcc8e 100644 --- a/libavcodec/cbs_jpeg.c +++ b/libavcodec/cbs_jpeg.c @@ -34,7 +34,7 @@ #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL) #define u(width, name, range_min, range_max) \ - xu(width, name, range_min, range_max, 0) + xu(width, name, range_min, range_max, 0, ) #define us(width, name, sub, range_min, range_max) \ xu(width, name, range_min, range_max, 1, sub) @@ -148,15 +148,15 @@ static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx, if (marker == JPEG_MARKER_EOI) { break; } else if (marker == JPEG_MARKER_SOS) { + next_marker = -1; + end = start; for (i = start; i + 1 < frag->data_size; i++) { if (frag->data[i] != 0xff) continue; end = i; for (++i; i + 1 < frag->data_size && frag->data[i] == 0xff; i++); - if (i + 1 >= frag->data_size) { - next_marker = -1; - } else { + if (i + 1 < frag->data_size) { if (frag->data[i] == 0x00) continue; next_marker = frag->data[i]; @@ -226,7 +226,7 @@ static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx, data_ref = frag->data_ref; } - err = ff_cbs_insert_unit_data(ctx, frag, unit, marker, + err = ff_cbs_insert_unit_data(frag, unit, marker, data, data_size, data_ref); if (err < 0) return err; @@ -252,7 +252,7 @@ static int cbs_jpeg_read_unit(CodedBitstreamContext *ctx, if (unit->type >= JPEG_MARKER_SOF0 && unit->type <= JPEG_MARKER_SOF3) { - err = ff_cbs_alloc_unit_content(ctx, unit, + err = ff_cbs_alloc_unit_content(unit, sizeof(JPEGRawFrameHeader), NULL); if (err < 0) @@ -264,7 +264,7 @@ static int cbs_jpeg_read_unit(CodedBitstreamContext *ctx, } else if (unit->type >= JPEG_MARKER_APPN && unit->type <= JPEG_MARKER_APPN + 15) { - err = ff_cbs_alloc_unit_content(ctx, unit, + err = ff_cbs_alloc_unit_content(unit, sizeof(JPEGRawApplicationData), &cbs_jpeg_free_application_data); if (err < 0) @@ -278,7 +278,7 @@ static int cbs_jpeg_read_unit(CodedBitstreamContext *ctx, JPEGRawScan *scan; int pos; - err = ff_cbs_alloc_unit_content(ctx, unit, + err = ff_cbs_alloc_unit_content(unit, sizeof(JPEGRawScan), &cbs_jpeg_free_scan); if (err < 0) @@ -304,7 +304,7 @@ static int cbs_jpeg_read_unit(CodedBitstreamContext *ctx, #define SEGMENT(marker, type, func, free) \ case JPEG_MARKER_ ## marker: \ { \ - err = ff_cbs_alloc_unit_content(ctx, unit, \ + err = ff_cbs_alloc_unit_content(unit, \ sizeof(type), free); \ if (err < 0) \ return err; \