40 const AVFrame *p,
int *got_packet)
46 static const uint32_t ordered_dither[2][2] =
48 { 0x10400000, 0x104F0000 },
49 { 0xCB2A0000, 0xCB250000 },
54 "Widths which are not a multiple of 4 might fail with some decoders, "
55 "use vstrict=-1 / -strict -1 to use %d anyway.\n", avctx->
width);
64 for (y = 0; y < avctx->
height; y++) {
69 for (x = 0; x < avctx->
width; x += 4) {
71 case 0: dither = 0x492A0000;
break;
72 case 1: dither = dither * 1664525 + 1013904223;
break;
73 case 2: dither = ordered_dither[ y&1 ][ (x>>2)&1 ];
break;
75 if (x+3 >= avctx->
width) {
76 memset(luma_tmp, 0,
sizeof(luma_tmp));
77 memcpy(luma_tmp, luma, avctx->
width - x);
80 put_bits(&pb, 5, (249*(luma[3] + (dither>>29) )) >> 11);
81 put_bits(&pb, 5, (249*(luma[2] + ((dither>>26)&7))) >> 11);
82 put_bits(&pb, 5, (249*(luma[1] + ((dither>>23)&7))) >> 11);
83 put_bits(&pb, 5, (249*(luma[0] + ((dither>>20)&7))) >> 11);
85 put_bits(&pb, 6, (253*(*(cb++) + ((dither>>18)&3))) >> 10);
86 put_bits(&pb, 6, (253*(*(cr++) + ((dither>>16)&3))) >> 10);
98 #define OFFSET(x) offsetof(CLJRContext, x)
99 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
This structure describes decoded (raw) audio or video data.
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
#define LIBAVUTIL_VERSION_INT
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
static double cb(void *priv, double x, double y)
static const AVClass cljr_class
#define FF_COMPLIANCE_UNOFFICIAL
Allow unofficial extensions.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static const AVOption options[]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static const uint8_t dither[8][8]
const char * name
Name of the codec implementation.
int flags
A combination of AV_PKT_FLAG values.
static int put_bits_count(PutBitContext *s)
int width
picture width / height.
#define AVERROR_EXPERIMENTAL
Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it...
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
Describe the class of an AVClass context structure.
static enum AVPixelFormat pix_fmts[]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *p, int *got_packet)
common internal api header.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
common internal and external API header
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
int frame_number
Frame counter, set by libavcodec.
static double cr(void *priv, double x, double y)
AVPixelFormat
Pixel format.
This structure stores compressed data.
int strict_std_compliance
strictly follow the standard (MPEG-4, ...).