33 #if CONFIG_CLJR_DECODER
35 void *
data,
int *got_frame,
39 int buf_size = avpkt->
size;
51 "Resolution larger than buffer size. Invalid header?\n");
62 for (y = 0; y < avctx->
height; y++) {
66 for (x = 0; x < avctx->
width; x += 4) {
67 luma[3] = (
get_bits(&gb, 5)*33) >> 2;
68 luma[2] = (
get_bits(&gb, 5)*33) >> 2;
69 luma[1] = (
get_bits(&gb, 5)*33) >> 2;
70 luma[0] = (
get_bits(&gb, 5)*33) >> 2;
99 #if CONFIG_CLJR_ENCODER
100 typedef struct CLJRContext {
116 const AVFrame *p,
int *got_packet)
122 static const uint32_t ordered_dither[2][2] =
124 { 0x10400000, 0x104F0000 },
125 { 0xCB2A0000, 0xCB250000 },
136 for (y = 0; y < avctx->
height; y++) {
140 for (x = 0; x < avctx->
width; x += 4) {
141 switch (a->dither_type) {
142 case 0: dither = 0x492A0000;
break;
143 case 1: dither = dither * 1664525 + 1013904223;
break;
144 case 2: dither = ordered_dither[ y&1 ][ (x>>2)&1 ];
break;
146 put_bits(&pb, 5, (249*(luma[3] + (dither>>29) )) >> 11);
147 put_bits(&pb, 5, (249*(luma[2] + ((dither>>26)&7))) >> 11);
148 put_bits(&pb, 5, (249*(luma[1] + ((dither>>23)&7))) >> 11);
149 put_bits(&pb, 5, (249*(luma[0] + ((dither>>20)&7))) >> 11);
151 put_bits(&pb, 6, (253*(*(cb++) + ((dither>>18)&3))) >> 10);
152 put_bits(&pb, 6, (253*(*(cr++) + ((dither>>16)&3))) >> 10);
164 #define OFFSET(x) offsetof(CLJRContext, x)
165 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
171 static const AVClass cljr_class = {
182 .priv_data_size =
sizeof(CLJRContext),
188 .priv_class = &cljr_class,