65 while (
r->sum >
val && cnt < 9) {
105 r->save +=
r->run + 1;
111 v = ((v >> 1) +
r->lossy) ^ -(v & 1);
137 int stride,
const uint8_t *buf,
int buf_size)
171 for (j = 1; j <
height; j++) {
194 for (y=1; y<
height; y++) {
210 const uint8_t *buf = avpkt->
data;
211 int buf_size = avpkt->
size;
217#define ADVANCE_BY_DECODED do { \
218 if (decoded < 0 || decoded >= buf_size) goto buf_too_small; \
219 buf += decoded; buf_size -= decoded; \
224 p->linesize[0], buf, buf_size);
227 p->linesize[1], buf, buf_size);
230 p->linesize[2], buf, buf_size);
234 p->linesize[0], buf, buf_size);
237 p->linesize[2], buf, buf_size);
240 p->linesize[1], buf, buf_size);
244 -p->linesize[1], buf, buf_size);
247 -p->linesize[0], buf, buf_size);
250 -p->linesize[2], buf, buf_size);
251 if (avctx->
width & 1) {
260 -p->linesize[1], buf, buf_size);
263 -p->linesize[0], buf, buf_size);
266 -p->linesize[2], buf, buf_size);
269 -p->linesize[3], buf, buf_size);
275 if (decoded < 0 || decoded > buf_size)
281 return avpkt->
size - buf_size;
311 if (l->
lossy > 65536U) {
static double val(void *priv, double ch)
const FFCodec ff_loco_decoder
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
#define FF_DEBUG_PICT_INFO
#define i(width, name, range_min, range_max)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
bitstream reader API header.
static int get_bits_left(GetBitContext *gb)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static int get_bits_count(const GetBitContext *s)
static int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, int esc_len)
read unsigned golomb rice code (jpegls).
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold int decode_init(AVCodecContext *avctx)
static int decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
static int loco_predict(uint8_t *data, int stride)
static int loco_get_rice(RICEContext *r)
static void rotate_faulty_loco(uint8_t *data, int width, int height, int stride)
#define ADVANCE_BY_DECODED
static int loco_decode_plane(LOCOContext *l, uint8_t *data, int width, int height, int stride, const uint8_t *buf, int buf_size)
static av_cold int decode_init(AVCodecContext *avctx)
static int loco_get_rice_param(RICEContext *r)
static int decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
static void loco_update_rice_param(RICEContext *r, int val)
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
#define avpriv_request_sample(...)