mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
cljr: simplify CLJRContext
There is no need to have delta, offset and gb in CLJRContext. Signed-off-by: Janne Grunau <janne-libav@jannau.net>
This commit is contained in:
parent
f5edfc9e92
commit
fc9489f6ad
@ -35,9 +35,6 @@
|
|||||||
typedef struct CLJRContext{
|
typedef struct CLJRContext{
|
||||||
AVCodecContext *avctx;
|
AVCodecContext *avctx;
|
||||||
AVFrame picture;
|
AVFrame picture;
|
||||||
int delta[16];
|
|
||||||
int offset[4];
|
|
||||||
GetBitContext gb;
|
|
||||||
} CLJRContext;
|
} CLJRContext;
|
||||||
|
|
||||||
static int decode_frame(AVCodecContext *avctx,
|
static int decode_frame(AVCodecContext *avctx,
|
||||||
@ -47,6 +44,7 @@ static int decode_frame(AVCodecContext *avctx,
|
|||||||
const uint8_t *buf = avpkt->data;
|
const uint8_t *buf = avpkt->data;
|
||||||
int buf_size = avpkt->size;
|
int buf_size = avpkt->size;
|
||||||
CLJRContext * const a = avctx->priv_data;
|
CLJRContext * const a = avctx->priv_data;
|
||||||
|
GetBitContext gb;
|
||||||
AVFrame *picture = data;
|
AVFrame *picture = data;
|
||||||
AVFrame * const p= (AVFrame*)&a->picture;
|
AVFrame * const p= (AVFrame*)&a->picture;
|
||||||
int x, y;
|
int x, y;
|
||||||
@ -67,20 +65,20 @@ static int decode_frame(AVCodecContext *avctx,
|
|||||||
p->pict_type= AV_PICTURE_TYPE_I;
|
p->pict_type= AV_PICTURE_TYPE_I;
|
||||||
p->key_frame= 1;
|
p->key_frame= 1;
|
||||||
|
|
||||||
init_get_bits(&a->gb, buf, buf_size * 8);
|
init_get_bits(&gb, buf, buf_size * 8);
|
||||||
|
|
||||||
for(y=0; y<avctx->height; y++){
|
for(y=0; y<avctx->height; y++){
|
||||||
uint8_t *luma= &a->picture.data[0][ y*a->picture.linesize[0] ];
|
uint8_t *luma= &a->picture.data[0][ y*a->picture.linesize[0] ];
|
||||||
uint8_t *cb= &a->picture.data[1][ y*a->picture.linesize[1] ];
|
uint8_t *cb= &a->picture.data[1][ y*a->picture.linesize[1] ];
|
||||||
uint8_t *cr= &a->picture.data[2][ y*a->picture.linesize[2] ];
|
uint8_t *cr= &a->picture.data[2][ y*a->picture.linesize[2] ];
|
||||||
for(x=0; x<avctx->width; x+=4){
|
for(x=0; x<avctx->width; x+=4){
|
||||||
luma[3] = get_bits(&a->gb, 5) << 3;
|
luma[3] = get_bits(&gb, 5) << 3;
|
||||||
luma[2] = get_bits(&a->gb, 5) << 3;
|
luma[2] = get_bits(&gb, 5) << 3;
|
||||||
luma[1] = get_bits(&a->gb, 5) << 3;
|
luma[1] = get_bits(&gb, 5) << 3;
|
||||||
luma[0] = get_bits(&a->gb, 5) << 3;
|
luma[0] = get_bits(&gb, 5) << 3;
|
||||||
luma+= 4;
|
luma+= 4;
|
||||||
*(cb++) = get_bits(&a->gb, 6) << 2;
|
*(cb++) = get_bits(&gb, 6) << 2;
|
||||||
*(cr++) = get_bits(&a->gb, 6) << 2;
|
*(cr++) = get_bits(&gb, 6) << 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user