comparison mjpegdec.c @ 6222:01e909d2a435 libavcodec

const
author michael
date Fri, 01 Feb 2008 03:40:46 +0000
parents e0a872dd3ea1
children 7fa807dd7958
comparison
equal deleted inserted replaced
6221:b42a510e0939 6222:01e909d2a435
1071 } 1071 }
1072 #endif 1072 #endif
1073 1073
1074 /* return the 8 bit start code value and update the search 1074 /* return the 8 bit start code value and update the search
1075 state. Return -1 if no start code found */ 1075 state. Return -1 if no start code found */
1076 static int find_marker(uint8_t **pbuf_ptr, uint8_t *buf_end) 1076 static int find_marker(const uint8_t **pbuf_ptr, const uint8_t *buf_end)
1077 { 1077 {
1078 uint8_t *buf_ptr; 1078 const uint8_t *buf_ptr;
1079 unsigned int v, v2; 1079 unsigned int v, v2;
1080 int val; 1080 int val;
1081 #ifdef DEBUG 1081 #ifdef DEBUG
1082 int skipped=0; 1082 int skipped=0;
1083 #endif 1083 #endif
1103 return val; 1103 return val;
1104 } 1104 }
1105 1105
1106 int ff_mjpeg_decode_frame(AVCodecContext *avctx, 1106 int ff_mjpeg_decode_frame(AVCodecContext *avctx,
1107 void *data, int *data_size, 1107 void *data, int *data_size,
1108 uint8_t *buf, int buf_size) 1108 const uint8_t *buf, int buf_size)
1109 { 1109 {
1110 MJpegDecodeContext *s = avctx->priv_data; 1110 MJpegDecodeContext *s = avctx->priv_data;
1111 uint8_t *buf_end, *buf_ptr; 1111 const uint8_t *buf_end, *buf_ptr;
1112 int start_code; 1112 int start_code;
1113 AVFrame *picture = data; 1113 AVFrame *picture = data;
1114 1114
1115 buf_ptr = buf; 1115 buf_ptr = buf;
1116 buf_end = buf + buf_size; 1116 buf_end = buf + buf_size;
1134 } 1134 }
1135 1135
1136 /* unescape buffer of SOS, use special treatment for JPEG-LS */ 1136 /* unescape buffer of SOS, use special treatment for JPEG-LS */
1137 if (start_code == SOS && !s->ls) 1137 if (start_code == SOS && !s->ls)
1138 { 1138 {
1139 uint8_t *src = buf_ptr; 1139 const uint8_t *src = buf_ptr;
1140 uint8_t *dst = s->buffer; 1140 uint8_t *dst = s->buffer;
1141 1141
1142 while (src<buf_end) 1142 while (src<buf_end)
1143 { 1143 {
1144 uint8_t x = *(src++); 1144 uint8_t x = *(src++);
1161 1161
1162 av_log(avctx, AV_LOG_DEBUG, "escaping removed %td bytes\n", 1162 av_log(avctx, AV_LOG_DEBUG, "escaping removed %td bytes\n",
1163 (buf_end - buf_ptr) - (dst - s->buffer)); 1163 (buf_end - buf_ptr) - (dst - s->buffer));
1164 } 1164 }
1165 else if(start_code == SOS && s->ls){ 1165 else if(start_code == SOS && s->ls){
1166 uint8_t *src = buf_ptr; 1166 const uint8_t *src = buf_ptr;
1167 uint8_t *dst = s->buffer; 1167 uint8_t *dst = s->buffer;
1168 int bit_count = 0; 1168 int bit_count = 0;
1169 int t = 0, b = 0; 1169 int t = 0, b = 0;
1170 PutBitContext pb; 1170 PutBitContext pb;
1171 1171