mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-19 09:02:26 +02:00
avcodec/cbs_jpeg: Remove redundant counter
Use -1 as the position in ff_cbs_insert_unit_data() which implicitly reuses frag->nb_units as the counter. Also switch to a do-while-loop, as it is more natural than a for-loop now that the counter is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
d64e27f521
commit
f183ae787a
@ -110,7 +110,7 @@ static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx,
|
|||||||
AVBufferRef *data_ref;
|
AVBufferRef *data_ref;
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
size_t data_size;
|
size_t data_size;
|
||||||
int unit, start, end, marker, next_start, next_marker;
|
int start, end, marker, next_start, next_marker;
|
||||||
int err, i, j, length;
|
int err, i, j, length;
|
||||||
|
|
||||||
if (frag->data_size < 4) {
|
if (frag->data_size < 4) {
|
||||||
@ -144,7 +144,7 @@ static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx,
|
|||||||
marker = frag->data[i];
|
marker = frag->data[i];
|
||||||
start = i + 1;
|
start = i + 1;
|
||||||
|
|
||||||
for (unit = 0;; unit++) {
|
do {
|
||||||
if (marker == JPEG_MARKER_EOI) {
|
if (marker == JPEG_MARKER_EOI) {
|
||||||
break;
|
break;
|
||||||
} else if (marker == JPEG_MARKER_SOS) {
|
} else if (marker == JPEG_MARKER_SOS) {
|
||||||
@ -226,16 +226,14 @@ static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx,
|
|||||||
data_ref = frag->data_ref;
|
data_ref = frag->data_ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ff_cbs_insert_unit_data(frag, unit, marker,
|
err = ff_cbs_insert_unit_data(frag, -1, marker,
|
||||||
data, data_size, data_ref);
|
data, data_size, data_ref);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (next_marker == -1)
|
|
||||||
break;
|
|
||||||
marker = next_marker;
|
marker = next_marker;
|
||||||
start = next_start;
|
start = next_start;
|
||||||
}
|
} while (next_marker != -1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user