91 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 RItype,
int limit_add)
121 int k, ret, temp, map;
122 int Q = 365 + RItype;
126 temp += state->
N[Q] >> 1;
128 for (k = 0; (state->
N[Q] << k) < temp; k++)
140 if (!k && (RItype || ret) && (2 * state->
B[Q] < state->
N[Q]))
145 ret = map - (ret + 1 >> 1);
152 state->
A[Q] +=
FFABS(ret) - RItype;
163 void *last,
void *dst,
int last2,
int w,
174 Ra = x ?
R(dst, x - stride) :
R(last, x);
176 Rc = x ?
R(last, x - stride) : last2;
177 Rd = (x >= w -
stride) ?
R(last, x) :
R(last, x + stride);
192 if (x + r * stride > w)
193 r = (w - x) / stride;
194 for (i = 0; i <
r; i++) {
210 for (i = 0; i <
r; i++) {
217 RItype = (
FFABS(Ra - Rb) <= state->
near) ? 1 : 0;
223 if (state->
near && RItype) {
237 pred =
mid_pred(Ra, Ra + Rb - Rc, Rb);
247 pred = av_clip(pred - state->
C[context], 0, state->
maxval);
250 pred = av_clip(pred + state->
C[context], 0, state->
maxval);
258 if (pred < -state->near)
262 pred = av_clip(pred, 0, state->
maxval);
272 int point_transform,
int ilv)
296 shift = point_transform + (8 - s->
bits);
298 shift = point_transform + (16 - s->
bits);
301 "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) " 302 "RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",
304 state->
T1, state->
T2, state->
T3,
306 av_dlog(s->
avctx,
"JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n",
317 for (i = 0; i < s->
height; i++) {
323 t = *((uint16_t *)last);
333 }
else if (ilv == 1) {
335 int Rc[3] = { 0, 0, 0 };
338 for (i = 0; i < s->
height; i++) {
339 for (j = 0; j < 3; j++) {
341 Rc[j],
width, 3, j, 8);
352 }
else if (ilv == 2) {
366 for (i = 0; i < s->
height; i++) {
367 for (x = off; x < w; x +=
stride)
375 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]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
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.
av_dlog(ac->avr, "%d samples - audio_convert: %s to %s (%s)\, 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 decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
bitstream reader API header.
int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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.
Libavcodec external API header.
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]
For video, size in bytes of each picture line.
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)
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.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
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 av_cold int init(AVCodecParserContext *s)
static int ff_jpegls_quantize(JLSState *s, int v)
Calculate quantized gradient value, used for context determination.
static const uint8_t * align_get_bits(GetBitContext *s)
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)