93 for(k = 0; (state->
N[Q] << k) < state->
A[Q]; k++);
102 ret = -((ret + 1) >> 1);
107 if(!state->
near && !k && (2 * state->
B[Q] <= -state->
N[Q]))
119 int k, ret, temp, map;
120 int Q = 365 + RItype;
124 temp += state->
N[Q] >> 1;
126 for(k = 0; (state->
N[Q] << k) < temp; k++);
135 if(!k && (RItype || ret) && (2 * state->
B[Q] < state->
N[Q]))
140 ret = map - ((ret + 1) >> 1);
147 state->
A[Q] +=
FFABS(ret) - RItype;
166 Ra = x ?
R(dst, x - stride) :
R(last, x);
168 Rc = x ?
R(last, x - stride) : last2;
169 Rd = (x >= w -
stride) ?
R(last, x) :
R(last, x + stride);
182 if(x + r * stride > w) {
183 r = (w - x) / stride;
185 for(i = 0; i <
r; i++) {
201 for(i = 0; i <
r; i++) {
208 RItype = (
FFABS(Ra - Rb) <= state->
near) ? 1 : 0;
213 if(state->
near && RItype){
225 pred =
mid_pred(Ra, Ra + Rb - Rc, Rb);
235 pred = av_clip(pred - state->
C[context], 0, state->
maxval);
238 pred = av_clip(pred + state->
C[context], 0, state->
maxval);
246 if(pred < -state->near)
250 pred = av_clip(pred, 0, state->
maxval);
261 uint8_t *
zero, *last, *cur;
282 shift = point_transform + (8 - s->
bits);
284 shift = point_transform + (16 - s->
bits);
297 for(i = 0; i < s->
height; i++) {
303 t = *((uint16_t*)last);
313 }
else if(ilv == 1) {
315 int Rc[3] = {0, 0, 0};
318 for(i = 0; i < s->
height; i++) {
319 for(j = 0; j < 3; j++) {
331 }
else if (ilv == 2) {
345 for(i = 0; i < s->
height; i++){
346 for(x = off; x < w; x+=
stride){
354 for(i = 0; i < s->
height; i++){
355 for(x = 0; x < w; x++){
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
const uint8_t ff_log2_run[41]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static void align_get_bits(GetBitContext *s)
static int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, int esc_len)
read unsigned golomb rice code (jpegls).
MJPEG encoder and decoder.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
bitstream reader API header.
static int init(AVCodecParserContext *s)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void ff_jpegls_reset_coding_parameters(JLSState *s, int reset_all)
Calculate JPEG-LS codec values.
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static int ff_jpegls_update_state_regular(JLSState *state, int Q, int err)
int ff_jpegls_decode_lse(MJpegDecodeContext *s)
Decode LSE block with initialization parameters.
static const float pred[4]
#define AVERROR_PATCHWELCOME
Not yet implemented in Libav, patches welcome.
static void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *last, void *dst, int last2, int w, int stride, int comp, int bits)
Decode one line of image.
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
static void close(AVCodecParserContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static unsigned int get_bits1(GetBitContext *s)
int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transform, int ilv)
struct MJpegDecodeContext MJpegDecodeContext
static void skip_bits(GetBitContext *s, int n)
static int ls_get_code_regular(GetBitContext *gb, JLSState *state, int Q)
Get context-dependent Golomb code, decode it and update context.
int reset
context halfing intervall ?rename
AVCodec ff_jpegls_decoder
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
static int ls_get_code_runterm(GetBitContext *gb, JLSState *state, int RItype, int limit_add)
Get Golomb code, decode it and update state for run termination.
static int ff_jpegls_quantize(JLSState *s, int v)
Calculate quantized gradient value, used for context determination.
static void comp(unsigned char *dst, int dst_stride, unsigned char *src, int src_stride, int add)
void ff_jpegls_init_state(JLSState *state)
Calculate initial JPEG-LS parameters.
int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
static void ff_jpegls_downscale_state(JLSState *state, int Q)