]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/cbs_jpeg.c
avcodec/flacenc: Remove always-true check
[ffmpeg] / libavcodec / cbs_jpeg.c
index 4ff04ae52db713f1a1009cd7d512657ca08c1cb0..7d3e10fcc8e30ae9d0ab6c8535a8dba10585961c 100644 (file)
@@ -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; \