Skip to content

Commit 58c71f3

Browse files
committed
(RJPEG) Cleanup unused functions
1 parent b32f4ca commit 58c71f3

1 file changed

Lines changed: 28 additions & 31 deletions

File tree

  • libretro-common/formats/jpeg

libretro-common/formats/jpeg/rjpeg.c

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,7 @@ static void rjpeg_grow_buffer_unsafe(rjpeg_jpeg *j)
485485
{
486486
/* Already hit a marker — pad with zeros */
487487
while (j->code_bits <= 24)
488-
{
489488
j->code_bits += 8;
490-
}
491489
return;
492490
}
493491

@@ -512,25 +510,42 @@ static void rjpeg_grow_buffer_unsafe(rjpeg_jpeg *j)
512510

513511
/* Check each byte for 0xFF. The compiler will branch-predict
514512
* these as not-taken since 0xFF is rare in entropy data. */
515-
if (b0 == 0xFF) goto handle_ff_at_0;
513+
if (b0 == 0xFF)
514+
goto handle_ff_at_0;
516515
j->code_buffer |= (uint32_t)b0 << (24 - j->code_bits);
517516
j->code_bits += 8;
518-
if (j->code_bits > 24) { s->img_buffer += 1; return; }
517+
if (j->code_bits > 24)
518+
{
519+
s->img_buffer += 1;
520+
return;
521+
}
519522

520-
if (b1 == 0xFF) goto handle_ff_at_1;
523+
if (b1 == 0xFF)
524+
goto handle_ff_at_1;
521525
j->code_buffer |= (uint32_t)b1 << (24 - j->code_bits);
522526
j->code_bits += 8;
523-
if (j->code_bits > 24) { s->img_buffer += 2; return; }
527+
if (j->code_bits > 24)
528+
{
529+
s->img_buffer += 2;
530+
return;
531+
}
524532

525-
if (b2 == 0xFF) goto handle_ff_at_2;
533+
if (b2 == 0xFF)
534+
goto handle_ff_at_2;
526535
j->code_buffer |= (uint32_t)b2 << (24 - j->code_bits);
527536
j->code_bits += 8;
528-
if (j->code_bits > 24) { s->img_buffer += 3; return; }
537+
if (j->code_bits > 24)
538+
{
539+
s->img_buffer += 3;
540+
return;
541+
}
529542

530-
if (b3 == 0xFF) goto handle_ff_at_3;
543+
if (b3 == 0xFF)
544+
goto handle_ff_at_3;
531545
j->code_buffer |= (uint32_t)b3 << (24 - j->code_bits);
532546
j->code_bits += 8;
533547
s->img_buffer += 4;
548+
534549
return;
535550

536551
/* 0xFF handling: consume the bytes before the 0xFF, then
@@ -652,13 +667,12 @@ static INLINE int rjpeg_jpeg_huff_decode(rjpeg_jpeg *j, rjpeg_huffman *h)
652667

653668
/* _nocheck variant: caller guarantees code_bits >= 16.
654669
* Used from decode_block where grow_buffer was just called. */
655-
static INLINE int rjpeg_jpeg_huff_decode_nocheck(rjpeg_jpeg *j, rjpeg_huffman *h)
670+
static INLINE int rjpeg_jpeg_huff_decode_nocheck(rjpeg_jpeg *j,
671+
rjpeg_huffman *h)
656672
{
657673
unsigned int temp;
658-
int c,k;
659-
660-
c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1);
661-
k = h->fast[c];
674+
int c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1);
675+
int k = h->fast[c];
662676

663677
if (k < 255)
664678
{
@@ -711,23 +725,6 @@ static INLINE int rjpeg_extend_receive(rjpeg_jpeg *j, int n)
711725
return k + (rjpeg_jbias[n] & ~sgn);
712726
}
713727

714-
/* _nocheck variant: caller guarantees code_bits >= n.
715-
* After grow_buffer fills to 24+ bits and DC huff_decode consumes
716-
* at most 16 bits, at least 8 bits remain — enough for any
717-
* DC category (max 11 bits). */
718-
static INLINE int rjpeg_extend_receive_nocheck(rjpeg_jpeg *j, int n)
719-
{
720-
unsigned int k;
721-
int sgn;
722-
723-
sgn = (int32_t)j->code_buffer >> 31;
724-
k = RJPEG_LROT(j->code_buffer, n);
725-
j->code_buffer = k & ~rjpeg_bmask[n];
726-
k &= rjpeg_bmask[n];
727-
j->code_bits -= n;
728-
return k + (rjpeg_jbias[n] & ~sgn);
729-
}
730-
731728
/* get some unsigned bits */
732729
static INLINE int rjpeg_jpeg_get_bits(rjpeg_jpeg *j, int n)
733730
{

0 commit comments

Comments
 (0)