92 for(k = 0; (state->
N[Q] << k) < state->
A[Q]; k++);
101 ret = -((ret + 1) >> 1);
106 if(!state->
near && !k && (2 * state->
B[Q] <= -state->
N[Q]))
118 int k, ret, temp, map;
119 int Q = 365 + RItype;
123 temp += state->
N[Q] >> 1;
125 for(k = 0; (state->
N[Q] << k) < temp; k++);
134 if(!k && (RItype || ret) && (2 * state->
B[Q] < state->
N[Q]))
139 ret = map - ((ret + 1) >> 1);
146 state->
A[Q] +=
FFABS(ret) - RItype;
165 Ra = x ?
R(dst, x - stride) :
R(last, x);
167 Rc = x ?
R(last, x - stride) : last2;
168 Rd = (x >= w -
stride) ?
R(last, x) :
R(last, x + stride);
181 if(x + r * stride > w) {
182 r = (w - x) / stride;
184 for(i = 0; i <
r; i++) {
200 for(i = 0; i <
r; i++) {
207 RItype = (
FFABS(Ra - Rb) <= state->
near) ? 1 : 0;
212 if(state->
near && RItype){
224 pred =
mid_pred(Ra, Ra + Rb - Rc, Rb);
234 pred = av_clip(pred - state->
C[context], 0, state->
maxval);
237 pred = av_clip(pred + state->
C[context], 0, state->
maxval);
245 if(pred < -state->near)
249 pred = av_clip(pred, 0, state->
maxval);
281 shift = point_transform + (8 - s->
bits);
283 shift = point_transform + (16 - s->
bits);
285 av_dlog(s->
avctx,
"JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",
287 state->
T1, state->
T2, state->
T3,
289 av_dlog(s->
avctx,
"JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n",
300 for(i = 0; i < s->
height; i++) {
306 t = *((uint16_t*)last);
316 }
else if(ilv == 1) {
318 int Rc[3] = {0, 0, 0};
321 for(i = 0; i < s->
height; i++) {
322 for(j = 0; j < 3; j++) {
334 }
else if (ilv == 2) {
348 for(i = 0; i < s->
height; i++){
349 for(x = off; x < w; x+=
stride){
357 for(i = 0; i < s->
height; i++){
358 for(x = 0; x < w; x++){
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
const uint8_t ff_log2_run[41]
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static void align_get_bits(GetBitContext *s)
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
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)
int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
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]
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)
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.
#define AVERROR_INVALIDDATA
#define AVERROR_PATCHWELCOME
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.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static void ff_jpegls_downscale_state(JLSState *state, int Q)