aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mjpeg.c
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2005-12-17 18:14:38 +0000
committerDiego Biurrun <diego@biurrun.de>2005-12-17 18:14:38 +0000
commit115329f16062074e11ccf3b89ead6176606c9696 (patch)
treee98aa993905a702688bf821737ab9a443969fc28 /libavcodec/mjpeg.c
parentd76319b1ab716320f6e6a4d690b85fe4504ebd5b (diff)
downloadffmpeg-115329f16062074e11ccf3b89ead6176606c9696.tar.gz
COSMETICS: Remove all trailing whitespace.
Originally committed as revision 4749 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mjpeg.c')
-rw-r--r--libavcodec/mjpeg.c212
1 files changed, 106 insertions, 106 deletions
diff --git a/libavcodec/mjpeg.c b/libavcodec/mjpeg.c
index e8bba06190..905b5fbea7 100644
--- a/libavcodec/mjpeg.c
+++ b/libavcodec/mjpeg.c
@@ -27,7 +27,7 @@
* @file mjpeg.c
* MJPEG encoder and decoder.
*/
-
+
//#define DEBUG
#include <assert.h>
@@ -40,7 +40,7 @@
#undef TWOMATRIXES
typedef struct MJpegContext {
- uint8_t huff_size_dc_luminance[12]; //FIXME use array [3] instead of lumi / chrom, for easier addressing
+ uint8_t huff_size_dc_luminance[12]; //FIXME use array [3] instead of lumi / chrom, for easier addressing
uint16_t huff_code_dc_luminance[12];
uint8_t huff_size_dc_chrominance[12];
uint16_t huff_code_dc_chrominance[12];
@@ -195,7 +195,7 @@ static const uint8_t val_ac_luminance[] =
0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
- 0xf9, 0xfa
+ 0xf9, 0xfa
};
static const uint8_t bits_ac_chrominance[17] =
@@ -222,7 +222,7 @@ static const uint8_t val_ac_chrominance[] =
0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
- 0xf9, 0xfa
+ 0xf9, 0xfa
};
/* isn't this function nicer than the one in the libjpeg ? */
@@ -249,11 +249,11 @@ static void build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
int mjpeg_init(MpegEncContext *s)
{
MJpegContext *m;
-
+
m = av_malloc(sizeof(MJpegContext));
if (!m)
return -1;
-
+
s->min_qcoeff=-1023;
s->max_qcoeff= 1023;
@@ -274,7 +274,7 @@ int mjpeg_init(MpegEncContext *s)
m->huff_code_ac_chrominance,
bits_ac_chrominance,
val_ac_chrominance);
-
+
s->mjpeg_ctx = m;
return 0;
}
@@ -362,7 +362,7 @@ static void jpeg_table_header(MpegEncContext *s)
size = 2;
size += put_huffman_table(s, 0, 0, bits_dc_luminance, val_dc_luminance);
size += put_huffman_table(s, 0, 1, bits_dc_chrominance, val_dc_chrominance);
-
+
size += put_huffman_table(s, 1, 0, bits_ac_luminance, val_ac_luminance);
size += put_huffman_table(s, 1, 1, bits_ac_chrominance, val_ac_chrominance);
ptr[0] = size >> 8;
@@ -401,7 +401,7 @@ static void jpeg_put_comments(MpegEncContext *s)
ptr[1] = size;
}
- if( s->avctx->pix_fmt == PIX_FMT_YUV420P
+ if( s->avctx->pix_fmt == PIX_FMT_YUV420P
||s->avctx->pix_fmt == PIX_FMT_YUV422P
||s->avctx->pix_fmt == PIX_FMT_YUV444P){
put_marker(p, COM);
@@ -423,7 +423,7 @@ void mjpeg_picture_header(MpegEncContext *s)
if (!s->mjpeg_data_only_frames)
{
- jpeg_put_comments(s);
+ jpeg_put_comments(s);
if (s->mjpeg_write_tables) jpeg_table_header(s);
@@ -437,13 +437,13 @@ void mjpeg_picture_header(MpegEncContext *s)
put_bits(&s->pb, 16, s->height);
put_bits(&s->pb, 16, s->width);
put_bits(&s->pb, 8, 3); /* 3 components */
-
+
/* Y component */
put_bits(&s->pb, 8, 1); /* component number */
put_bits(&s->pb, 4, s->mjpeg_hsample[0]); /* H factor */
put_bits(&s->pb, 4, s->mjpeg_vsample[0]); /* V factor */
put_bits(&s->pb, 8, 0); /* select matrix */
-
+
/* Cb component */
put_bits(&s->pb, 8, 2); /* component number */
put_bits(&s->pb, 4, s->mjpeg_hsample[1]); /* H factor */
@@ -469,17 +469,17 @@ void mjpeg_picture_header(MpegEncContext *s)
put_marker(&s->pb, SOS);
put_bits(&s->pb, 16, 12); /* length */
put_bits(&s->pb, 8, 3); /* 3 components */
-
+
/* Y component */
put_bits(&s->pb, 8, 1); /* index */
put_bits(&s->pb, 4, 0); /* DC huffman table index */
put_bits(&s->pb, 4, 0); /* AC huffman table index */
-
+
/* Cb component */
put_bits(&s->pb, 8, 2); /* index */
put_bits(&s->pb, 4, 1); /* DC huffman table index */
put_bits(&s->pb, 4, lossless ? 0 : 1); /* AC huffman table index */
-
+
/* Cr component */
put_bits(&s->pb, 8, 3); /* index */
put_bits(&s->pb, 4, 1); /* DC huffman table index */
@@ -496,10 +496,10 @@ static void escape_FF(MpegEncContext *s, int start)
int i, ff_count;
uint8_t *buf= s->pb.buf + start;
int align= (-(size_t)(buf))&3;
-
+
assert((size&7) == 0);
size >>= 3;
-
+
ff_count=0;
for(i=0; i<size && i<align; i++){
if(buf[i]==0xFF) ff_count++;
@@ -526,12 +526,12 @@ static void escape_FF(MpegEncContext *s, int start)
}
if(ff_count==0) return;
-
+
/* skip put bits */
for(i=0; i<ff_count-3; i+=4)
put_bits(&s->pb, 32, 0);
put_bits(&s->pb, (ff_count-i)*8, 0);
- flush_put_bits(&s->pb);
+ flush_put_bits(&s->pb);
for(i=size-1; ff_count; i--){
int v= buf[i];
@@ -559,7 +559,7 @@ void mjpeg_picture_trailer(MpegEncContext *s)
flush_put_bits(&s->pb);
assert((s->header_bits&7)==0);
-
+
escape_FF(s, s->header_bits>>3);
put_marker(&s->pb, EOI);
@@ -578,11 +578,11 @@ static inline void mjpeg_encode_dc(MpegEncContext *s, int val,
val = -val;
mant--;
}
-
+
nbits= av_log2_16bit(val) + 1;
-
+
put_bits(&s->pb, huff_size[nbits], huff_code[nbits]);
-
+
put_bits(&s->pb, nbits, mant & ((1 << nbits) - 1));
}
}
@@ -594,7 +594,7 @@ static void encode_block(MpegEncContext *s, DCTELEM *block, int n)
MJpegContext *m = s->mjpeg_ctx;
uint8_t *huff_size_ac;
uint16_t *huff_code_ac;
-
+
/* DC coef */
component = (n <= 3 ? 0 : n - 4 + 1);
dc = block[0]; /* overflow is impossible */
@@ -609,9 +609,9 @@ static void encode_block(MpegEncContext *s, DCTELEM *block, int n)
huff_code_ac = m->huff_code_ac_chrominance;
}
s->last_dc[component] = dc;
-
+
/* AC coefs */
-
+
run = 0;
last_index = s->block_last_index[n];
for(i=1;i<=last_index;i++) {
@@ -629,12 +629,12 @@ static void encode_block(MpegEncContext *s, DCTELEM *block, int n)
val = -val;
mant--;
}
-
+
nbits= av_log2(val) + 1;
code = (run << 4) | nbits;
put_bits(&s->pb, huff_size_ac[code], huff_code_ac[code]);
-
+
put_bits(&s->pb, nbits, mant & ((1 << nbits) - 1));
run = 0;
}
@@ -645,7 +645,7 @@ static void encode_block(MpegEncContext *s, DCTELEM *block, int n)
put_bits(&s->pb, huff_size_ac[0], huff_code_ac[0]);
}
-void mjpeg_encode_mb(MpegEncContext *s,
+void mjpeg_encode_mb(MpegEncContext *s,
DCTELEM block[6][64])
{
int i;
@@ -668,11 +668,11 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
*p = *pict;
p->pict_type= FF_I_TYPE;
p->key_frame= 1;
-
+
mjpeg_picture_header(s);
s->header_bits= put_bits_count(&s->pb);
-
+
if(avctx->pix_fmt == PIX_FMT_RGBA32){
int x, y, i;
const int linesize= p->linesize[0];
@@ -691,7 +691,7 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
return -1;
}
-
+
for(i=0; i<3; i++){
top[i]= left[i]= topleft[i]= buffer[0][i];
}
@@ -704,14 +704,14 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
int pred, diff;
PREDICT(pred, topleft[i], top[i], left[i], modified_predictor);
-
+
topleft[i]= top[i];
top[i]= buffer[x+1][i];
-
+
left[i]= buffer[x][i];
diff= ((left[i] - pred + 0x100)&0x1FF) - 0x100;
-
+
if(i==0)
mjpeg_encode_dc(s, diff, m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
else
@@ -723,7 +723,7 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
int mb_x, mb_y, i;
const int mb_width = (width + s->mjpeg_hsample[0] - 1) / s->mjpeg_hsample[0];
const int mb_height = (height + s->mjpeg_vsample[0] - 1) / s->mjpeg_vsample[0];
-
+
for(mb_y = 0; mb_y < mb_height; mb_y++) {
if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < mb_width * 4 * 3 * s->mjpeg_hsample[0] * s->mjpeg_vsample[0]){
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
@@ -756,7 +756,7 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
}
}
-
+
if(i==0)
mjpeg_encode_dc(s, (int8_t)(*ptr - pred), m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
else
@@ -771,13 +771,13 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
h = s->mjpeg_hsample[i];
v = s->mjpeg_vsample[i];
linesize= p->linesize[i];
-
+
for(y=0; y<v; y++){
for(x=0; x<h; x++){
int pred;
ptr = p->data[i] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
-//printf("%d %d %d %d %8X\n", mb_x, mb_y, x, y, ptr);
+//printf("%d %d %d %d %8X\n", mb_x, mb_y, x, y, ptr);
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
if(i==0)
@@ -793,7 +793,7 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
}
emms_c();
-
+
mjpeg_picture_trailer(s);
s->picture_number++;
@@ -828,8 +828,8 @@ typedef struct MJpegDecodeContext {
int bottom_field; /* true if bottom field */
int lossless;
int rgb;
- int rct; /* standard rct */
- int pegasus_rct; /* pegasus reversible colorspace transform */
+ int rct; /* standard rct */
+ int pegasus_rct; /* pegasus reversible colorspace transform */
int bits; /* bits per component */
int width, height;
@@ -866,7 +866,7 @@ typedef struct MJpegDecodeContext {
static int mjpeg_decode_dht(MJpegDecodeContext *s);
-static int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_table,
+static int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_table,
int nb_codes, int use_static)
{
uint8_t huff_size[256];
@@ -874,7 +874,7 @@ static int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_tab
memset(huff_size, 0, sizeof(huff_size));
build_huffman_codes(huff_size, huff_code, bits_table, val_table);
-
+
return init_vlc(vlc, 9, nb_codes, huff_size, 1, 1, huff_code, 2, 2, use_static);
}
@@ -902,7 +902,7 @@ static int mjpeg_decode_init(AVCodecContext *avctx)
s->start_code = -1;
s->first_picture = 1;
s->org_height = avctx->coded_height;
-
+
build_vlc(&s->vlcs[0][0], bits_dc_luminance, val_dc_luminance, 12, 0);
build_vlc(&s->vlcs[0][1], bits_dc_chrominance, val_dc_chrominance, 12, 0);
build_vlc(&s->vlcs[1][0], bits_ac_luminance, val_ac_luminance, 251, 0);
@@ -927,10 +927,10 @@ static int mjpeg_decode_init(AVCodecContext *avctx)
static int find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
int vop_found, i;
uint16_t state;
-
+
vop_found= pc->frame_start_found;
state= pc->state;
-
+
i=0;
if(!vop_found){
for(i=0; i<buf_size; i++){
@@ -951,7 +951,7 @@ static int find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
state= (state<<8) | buf[i];
if(state == 0xFFD8){
pc->frame_start_found=0;
- pc->state=0;
+ pc->state=0;
return i-1;
}
}
@@ -963,12 +963,12 @@ static int find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
static int jpeg_parse(AVCodecParserContext *s,
AVCodecContext *avctx,
- uint8_t **poutbuf, int *poutbuf_size,
+ uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size)
{
ParseContext *pc = s->priv_data;
int next;
-
+
next= find_frame_end(pc, buf, buf_size);
if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
@@ -986,7 +986,7 @@ static int jpeg_parse(AVCodecParserContext *s,
static int mjpeg_decode_dqt(MJpegDecodeContext *s)
{
int len, index, i, j;
-
+
len = get_bits(&s->gb, 16) - 2;
while (len >= 65) {
@@ -1013,7 +1013,7 @@ static int mjpeg_decode_dqt(MJpegDecodeContext *s)
dprintf("qscale[%d]: %d\n", index, s->qscale[index]);
len -= 65;
}
-
+
return 0;
}
@@ -1023,7 +1023,7 @@ static int mjpeg_decode_dht(MJpegDecodeContext *s)
int len, index, i, class, n, v, code_max;
uint8_t bits_table[17];
uint8_t val_table[256];
-
+
len = get_bits(&s->gb, 16) - 2;
while (len > 0) {
@@ -1071,8 +1071,8 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
/* XXX: verify len field validity */
len = get_bits(&s->gb, 16);
s->bits= get_bits(&s->gb, 8);
-
- if(s->pegasus_rct) s->bits=9;
+
+ if(s->pegasus_rct) s->bits=9;
if(s->bits==9 && !s->pegasus_rct) s->rct=1; //FIXME ugly
if (s->bits != 8 && !s->lossless){
@@ -1081,7 +1081,7 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
}
height = get_bits(&s->gb, 16);
width = get_bits(&s->gb, 16);
-
+
dprintf("sof0: picture: %dx%d\n", width, height);
if(avcodec_check_dimensions(s->avctx, width, height))
return -1;
@@ -1109,14 +1109,14 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
dprintf("component %d %d:%d id: %d quant:%d\n", i, s->h_count[i],
s->v_count[i], s->component_id[i], s->quant_index[i]);
}
-
+
if(s->v_max==1 && s->h_max==1 && s->lossless==1) s->rgb=1;
/* if different size, realloc/alloc picture */
/* XXX: also check h_count and v_count */
if (width != s->width || height != s->height) {
av_freep(&s->qscale_table);
-
+
s->width = width;
s->height = height;
avcodec_set_dimensions(s->avctx, width, height);
@@ -1135,10 +1135,10 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
s->first_picture = 0;
}
-
+
if(s->interlaced && s->bottom_field)
return 0;
-
+
/* XXX: not complete test ! */
switch((s->h_count[0] << 4) | s->v_count[0]) {
case 0x11:
@@ -1168,18 +1168,18 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
}
s->picture.pict_type= I_TYPE;
s->picture.key_frame= 1;
-
+
for(i=0; i<3; i++){
s->linesize[i]= s->picture.linesize[i] << s->interlaced;
}
// printf("%d %d %d %d %d %d\n", s->width, s->height, s->linesize[0], s->linesize[1], s->interlaced, s->avctx->height);
-
+
if (len != (8+(3*nb_components)))
{
dprintf("decode_sof0: error, len(%d) mismatch\n", len);
}
-
+
return 0;
}
@@ -1201,7 +1201,7 @@ static inline int mjpeg_decode_dc(MJpegDecodeContext *s, int dc_index)
}
/* decode block and dequantize */
-static int decode_block(MJpegDecodeContext *s, DCTELEM *block,
+static int decode_block(MJpegDecodeContext *s, DCTELEM *block,
int component, int dc_index, int ac_index, int quant_index)
{
int code, i, j, level, val;
@@ -1256,10 +1256,10 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int predictor, int point
int left[3], top[3], topleft[3];
const int linesize= s->linesize[0];
const int mask= (1<<s->bits)-1;
-
+
if((unsigned)s->mb_width > 32768) //dynamic alloc
return -1;
-
+
for(i=0; i<3; i++){
buffer[0][i]= 1 << (s->bits + point_transform - 1);
}
@@ -1284,8 +1284,8 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int predictor, int point
top[i]= buffer[mb_x][i];
PREDICT(pred, topleft[i], top[i], left[i], modified_predictor);
-
- left[i]=
+
+ left[i]=
buffer[mb_x][i]= mask & (pred + (mjpeg_decode_dc(s, s->dc_index[i]) << point_transform));
}
@@ -1338,7 +1338,7 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point
x = 0;
y = 0;
linesize= s->linesize[c];
-
+
for(j=0; j<n; j++) {
int pred;
@@ -1356,7 +1356,7 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
}
}
-
+
if (s->interlaced && s->bottom_field)
ptr += linesize >> 1;
*ptr= pred + (mjpeg_decode_dc(s, s->dc_index[i]) << point_transform);
@@ -1378,7 +1378,7 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point
x = 0;
y = 0;
linesize= s->linesize[c];
-
+
for(j=0; j<n; j++) {
int pred;
@@ -1421,15 +1421,15 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s){
y = 0;
for(j=0;j<n;j++) {
memset(s->block, 0, sizeof(s->block));
- if (decode_block(s, s->block, i,
- s->dc_index[i], s->ac_index[i],
+ if (decode_block(s, s->block, i,
+ s->dc_index[i], s->ac_index[i],
s->quant_index[c]) < 0) {
dprintf("error y=%d x=%d\n", mb_y, mb_x);
return -1;
}
// dprintf("mb: %d %d processed\n", mb_y, mb_x);
- ptr = s->picture.data[c] +
- (((s->linesize[c] * (v * mb_y + y) * 8) +
+ ptr = s->picture.data[c] +
+ (((s->linesize[c] * (v * mb_y + y) * 8) +
(h * mb_x + x) * 8) >> s->avctx->lowres);
if (s->interlaced && s->bottom_field)
ptr += s->linesize[c] >> 1;
@@ -1516,7 +1516,7 @@ static int mjpeg_decode_sos(MJpegDecodeContext *s)
case SOF3:
if (dc_index[i] > 3 || ac_index[i] != 0)
goto out_of_range;
- break;
+ break;
}
#endif
}
@@ -1526,7 +1526,7 @@ static int mjpeg_decode_sos(MJpegDecodeContext *s)
skip_bits(&s->gb, 4); /* Ah */
point_transform= get_bits(&s->gb, 4); /* Al */
- for(i=0;i<nb_components;i++)
+ for(i=0;i<nb_components;i++)
s->last_dc[i] = 1024;
if (nb_components > 1) {
@@ -1545,7 +1545,7 @@ static int mjpeg_decode_sos(MJpegDecodeContext *s)
if(s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_DEBUG, "%s %s p:%d >>:%d\n", s->lossless ? "lossless" : "sequencial DCT", s->rgb ? "RGB" : "", predictor, point_transform);
-
+
/* mjpeg-b can have padding bytes between sos and image data, skip them */
for (i = s->mjpb_skiptosod; i > 0; i--)
skip_bits(&s->gb, 8);
@@ -1595,9 +1595,9 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
len -= 6;
if(s->avctx->debug & FF_DEBUG_STARTCODE){
- av_log(s->avctx, AV_LOG_DEBUG, "APPx %8X\n", id);
+ av_log(s->avctx, AV_LOG_DEBUG, "APPx %8X\n", id);
}
-
+
/* buggy AVID, it puts EOI only at every 10th frame */
/* also this fourcc is used by non-avid files too, it holds some
informations, but it's always present in AVID creates files */
@@ -1624,9 +1624,9 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
// printf("mjpeg: interlace polarity: %d\n", s->interlace_polarity);
goto out;
}
-
+
// len -= 2;
-
+
if (id == ff_get_fourcc("JFIF"))
{
int t_w, t_h, v1, v2;
@@ -1656,7 +1656,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
len -= 10;
goto out;
}
-
+
if (id == ff_get_fourcc("Adob") && (get_bits(&s->gb, 8) == 'e'))
{
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
@@ -1691,7 +1691,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
len -= 9;
goto out;
}
-
+
/* Apple MJPEG-A */
if ((s->start_code == APP1) && (len > (0x28 - 8)))
{
@@ -1815,7 +1815,7 @@ found:
return val;
}
-static int mjpeg_decode_frame(AVCodecContext *avctx,
+static int mjpeg_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
uint8_t *buf, int buf_size)
{
@@ -1835,7 +1835,7 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
goto the_end;
} else {
dprintf("marker=%x avail_size_in_buf=%d\n", start_code, buf_end - buf_ptr);
-
+
if ((buf_end - buf_ptr) > s->buffer_size)
{
av_free(s->buffer);
@@ -1844,7 +1844,7 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
dprintf("buffer too small, expanding to %d bytes\n",
s->buffer_size);
}
-
+
/* unescape buffer of SOS */
if (start_code == SOS)
{
@@ -1868,13 +1868,13 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
}
}
init_get_bits(&s->gb, s->buffer, (dst - s->buffer)*8);
-
+
dprintf("escaping removed %d bytes\n",
(buf_end - buf_ptr) - (dst - s->buffer));
}
else
init_get_bits(&s->gb, buf_ptr, (buf_end - buf_ptr)*8);
-
+
s->start_code = start_code;
if(s->avctx->debug & FF_DEBUG_STARTCODE){
av_log(s->avctx, AV_LOG_DEBUG, "startcode: %X\n", start_code);
@@ -1908,16 +1908,16 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
break;
case SOF0:
s->lossless=0;
- if (mjpeg_decode_sof(s) < 0)
+ if (mjpeg_decode_sof(s) < 0)
return -1;
break;
case SOF3:
s->lossless=1;
- if (mjpeg_decode_sof(s) < 0)
+ if (mjpeg_decode_sof(s) < 0)
return -1;
break;
case EOI:
- if ((s->buggy_avid && !s->interlaced) || s->restart_interval)
+ if ((s->buggy_avid && !s->interlaced) || s->restart_interval)
break;
eoi_parser:
{
@@ -1931,7 +1931,7 @@ eoi_parser:
*data_size = sizeof(AVFrame);
if(!s->lossless){
- picture->quality= FFMAX(FFMAX(s->qscale[0], s->qscale[1]), s->qscale[2]);
+ picture->quality= FFMAX(FFMAX(s->qscale[0], s->qscale[1]), s->qscale[2]);
picture->qstride= 0;
picture->qscale_table= s->qscale_table;
memset(picture->qscale_table, picture->quality, (s->width+15)/16);
@@ -1939,7 +1939,7 @@ eoi_parser:
av_log(s->avctx, AV_LOG_DEBUG, "QP: %d\n", picture->quality);
picture->quality*= FF_QP2LAMBDA;
}
-
+
goto the_end;
}
break;
@@ -1986,7 +1986,7 @@ the_end:
return buf_ptr - buf;
}
-static int mjpegb_decode_frame(AVCodecContext *avctx,
+static int mjpegb_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
uint8_t *buf, int buf_size)
{
@@ -1999,7 +1999,7 @@ static int mjpegb_decode_frame(AVCodecContext *avctx,
buf_ptr = buf;
buf_end = buf + buf_size;
-
+
read_header:
/* reset on every SOI */
s->restart_interval = 0;
@@ -2009,7 +2009,7 @@ read_header:
init_get_bits(&hgb, buf_ptr, /*buf_size*/(buf_end - buf_ptr)*8);
skip_bits(&hgb, 32); /* reserved zeros */
-
+
if (get_bits_long(&hgb, 32) != be2me_32(ff_get_fourcc("mjpg")))
{
dprintf("not mjpeg-b (bad fourcc)\n");
@@ -2032,7 +2032,7 @@ read_header:
s->start_code = DQT;
mjpeg_decode_dqt(s);
}
-
+
dht_offs = get_bits_long(&hgb, 32);
dprintf("dht offs: 0x%x\n", dht_offs);
if (dht_offs)
@@ -2080,9 +2080,9 @@ read_header:
*picture= s->picture;
*data_size = sizeof(AVFrame);
-
+
if(!s->lossless){
- picture->quality= FFMAX(FFMAX(s->qscale[0], s->qscale[1]), s->qscale[2]);
+ picture->quality= FFMAX(FFMAX(s->qscale[0], s->qscale[1]), s->qscale[2]);
picture->qstride= 0;
picture->qscale_table= s->qscale_table;
memset(picture->qscale_table, picture->quality, (s->width+15)/16);
@@ -2096,7 +2096,7 @@ read_header:
#include "sp5x.h"
-static int sp5x_decode_frame(AVCodecContext *avctx,
+static int sp5x_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
uint8_t *buf, int buf_size)
{
@@ -2175,11 +2175,11 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
s->quant_index[2] = 1;
s->h_max = 2;
s->v_max = 2;
-
+
s->qscale_table = av_mallocz((s->width+15)/16);
avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV420P : PIX_FMT_YUVJ420;
s->interlaced = 0;
-
+
s->picture.reference = 0;
if (avctx->get_buffer(avctx, &s->picture) < 0)
{
@@ -2235,7 +2235,7 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
s->v_scount[2] = s->v_count[2];
s->dc_index[2] = 1;
s->ac_index[2] = 1;
-
+
for (i = 0; i < 3; i++)
s->last_dc[i] = 1024;
@@ -2243,7 +2243,7 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
s->mb_height = (s->height * s->v_max * 8 -1) / (s->v_max * 8);
init_get_bits(&s->gb, buf+14, (buf_size-14)*8);
-
+
return mjpeg_decode_scan(s);
#endif
@@ -2257,7 +2257,7 @@ static int mjpeg_decode_end(AVCodecContext *avctx)
av_free(s->buffer);
av_free(s->qscale_table);
-
+
for(i=0;i<2;i++) {
for(j=0;j<4;j++)
free_vlc(&s->vlcs[i][j]);