summaryrefslogtreecommitdiff
path: root/apps/plugins/imageviewer/jpegp/jpeg81.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/imageviewer/jpegp/jpeg81.c')
-rw-r--r--apps/plugins/imageviewer/jpegp/jpeg81.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/apps/plugins/imageviewer/jpegp/jpeg81.c b/apps/plugins/imageviewer/jpegp/jpeg81.c
index 95e46dbd17..76b36ca950 100644
--- a/apps/plugins/imageviewer/jpegp/jpeg81.c
+++ b/apps/plugins/imageviewer/jpegp/jpeg81.c
@@ -40,12 +40,12 @@ jpeg81.c
40* SOFTWARE. 40* SOFTWARE.
41*/ 41*/
42 42
43#include "GETC.h" 43#include "GETC.h"
44#include "rb_glue.h"
44#include "jpeg81.h" 45#include "jpeg81.h"
45#include <malloc.h> // calloc() called once
46#include <stdio.h> // debug only
47
48 46
47#pragma GCC diagnostic push
48#pragma GCC diagnostic ignored "-Wunused-parameter"
49///////////////////////////////////////// LOSSLESS ///////////////////////////////////////// 49///////////////////////////////////////// LOSSLESS /////////////////////////////////////////
50 50
51static int P1(struct COMP *C, TSAMP *samp) // Px = Ra 51static int P1(struct COMP *C, TSAMP *samp) // Px = Ra
@@ -63,17 +63,17 @@ static int P3(struct COMP *C, TSAMP *samp) // Px = Rc
63 return samp[-C->du_width-1]; 63 return samp[-C->du_width-1];
64} 64}
65 65
66static int P4(struct COMP *C, TSAMP *samp) // Px = Ra + Rb Rc 66static int P4(struct COMP *C, TSAMP *samp) // Px = Ra + Rb - Rc
67{ 67{
68 return samp[-1] + samp[-C->du_width] - samp[-C->du_width-1]; 68 return samp[-1] + samp[-C->du_width] - samp[-C->du_width-1];
69} 69}
70 70
71static int P5(struct COMP *C, TSAMP *samp) // Px = Ra + ((Rb Rc)/2) 71static int P5(struct COMP *C, TSAMP *samp) // Px = Ra + ((Rb - Rc)/2)
72{ 72{
73 return samp[-1] + ( (samp[-C->du_width] - samp[-C->du_width-1]) >> 1 ); 73 return samp[-1] + ( (samp[-C->du_width] - samp[-C->du_width-1]) >> 1 );
74} 74}
75 75
76static int P6(struct COMP *C, TSAMP *samp) // Px = Rb + ((Ra Rc)/2) 76static int P6(struct COMP *C, TSAMP *samp) // Px = Rb + ((Ra - Rc)/2)
77{ 77{
78 return samp[-C->du_width] + ( (samp[-1] - samp[-C->du_width-1]) >> 1 ); 78 return samp[-C->du_width] + ( (samp[-1] - samp[-C->du_width-1]) >> 1 );
79} 79}
@@ -215,7 +215,7 @@ static void du_sequential_huff(struct JPEGD *j, struct COMP *sc, TCOEF *coef)
215{ 215{
216 int s, k; 216 int s, k;
217 dc_decode_huff(j, sc, coef); 217 dc_decode_huff(j, sc, coef);
218 for (k=1; s=sc->ACS[ReadHuffmanCode(j, sc->ACB)]; k++) { // EOB? 218 for (k=1; (s=sc->ACS[ReadHuffmanCode(j, sc->ACB)]); k++) { // EOB?
219 k+= s>>4; 219 k+= s>>4;
220 if (s==0xf0) continue; // ZRL 220 if (s==0xf0) continue; // ZRL
221 coef[k]= ReadDiff(j, s&15); 221 coef[k]= ReadDiff(j, s&15);
@@ -496,7 +496,7 @@ static void Ri(struct JPEGD *j, int n)
496 printf("RST%d\n", Marker&7); 496 printf("RST%d\n", Marker&7);
497 printf("%08X: ECS\n", TELL()); 497 printf("%08X: ECS\n", TELL());
498 } 498 }
499 else printf("STREAM ERROR: expected RSTn missing from ECS\n"); 499 else { printf("STREAM ERROR: expected RSTn missing from ECS\n"); }
500 j->Reset_decoder(j); 500 j->Reset_decoder(j);
501 } 501 }
502 } 502 }
@@ -832,7 +832,7 @@ extern enum JPEGENUM JPEGDecode(struct JPEGD *j)
832 } 832 }
833 } 833 }
834 834
835 printf(" Malloc for %d Data Units (%d bytes)\n\n", TotalDU, sizeof(DU)*TotalDU); 835 printf(" Malloc for %d Data Units (%lu bytes)\n\n", TotalDU, sizeof(DU)*TotalDU);
836 836
837 if (j->SOF > 0xC8) { // DCT Arithmetic 837 if (j->SOF > 0xC8) { // DCT Arithmetic
838 j->Reset_decoder= Reset_decoder_arith; 838 j->Reset_decoder= Reset_decoder_arith;
@@ -953,7 +953,7 @@ extern enum JPEGENUM JPEGDecode(struct JPEGD *j)
953 953
954 for (Lq-=2; Lq; Lq -= 65 + 64*Pq) 954 for (Lq-=2; Lq; Lq -= 65 + 64*Pq)
955 { 955 {
956 int (*get)(); 956 int (*get)(void);
957 int T= GETC(); 957 int T= GETC();
958 int Tq= T&3; 958 int Tq= T&3;
959 int *qt= j->QT[Tq]; 959 int *qt= j->QT[Tq];
@@ -993,3 +993,5 @@ extern enum JPEGENUM JPEGDecode(struct JPEGD *j)
993 } 993 }
994 } 994 }
995} 995}
996
997#pragma GCC diagnostic pop \ No newline at end of file