From f7813a5324be39d13ab536c245d15dfc602a7849 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Sun, 29 Dec 2013 12:19:38 +0000 Subject: basic type mechanism working --- ffmpeg/libavcodec/asvenc.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'ffmpeg/libavcodec/asvenc.c') diff --git a/ffmpeg/libavcodec/asvenc.c b/ffmpeg/libavcodec/asvenc.c index a09aa73..dd3d4f5 100644 --- a/ffmpeg/libavcodec/asvenc.c +++ b/ffmpeg/libavcodec/asvenc.c @@ -148,14 +148,16 @@ static inline int encode_mb(ASV1Context *a, int16_t block[6][64]){ return 0; } -static inline void dct_get(ASV1Context *a, int mb_x, int mb_y){ +static inline void dct_get(ASV1Context *a, const AVFrame *frame, + int mb_x, int mb_y) +{ int16_t (*block)[64]= a->block; - int linesize= a->picture.linesize[0]; + int linesize = frame->linesize[0]; int i; - uint8_t *ptr_y = a->picture.data[0] + (mb_y * 16* linesize ) + mb_x * 16; - uint8_t *ptr_cb = a->picture.data[1] + (mb_y * 8 * a->picture.linesize[1]) + mb_x * 8; - uint8_t *ptr_cr = a->picture.data[2] + (mb_y * 8 * a->picture.linesize[2]) + mb_x * 8; + uint8_t *ptr_y = frame->data[0] + (mb_y * 16* linesize ) + mb_x * 16; + uint8_t *ptr_cb = frame->data[1] + (mb_y * 8 * frame->linesize[1]) + mb_x * 8; + uint8_t *ptr_cr = frame->data[2] + (mb_y * 8 * frame->linesize[2]) + mb_x * 8; a->dsp.get_pixels(block[0], ptr_y , linesize); a->dsp.get_pixels(block[1], ptr_y + 8, linesize); @@ -165,8 +167,8 @@ static inline void dct_get(ASV1Context *a, int mb_x, int mb_y){ a->dsp.fdct(block[i]); if(!(a->avctx->flags&CODEC_FLAG_GRAY)){ - a->dsp.get_pixels(block[4], ptr_cb, a->picture.linesize[1]); - a->dsp.get_pixels(block[5], ptr_cr, a->picture.linesize[2]); + a->dsp.get_pixels(block[4], ptr_cb, frame->linesize[1]); + a->dsp.get_pixels(block[5], ptr_cr, frame->linesize[2]); for(i=4; i<6; i++) a->dsp.fdct(block[i]); } @@ -176,7 +178,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet) { ASV1Context * const a = avctx->priv_data; - AVFrame * const p= &a->picture; int size, ret; int mb_x, mb_y; @@ -186,13 +187,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, init_put_bits(&a->pb, pkt->data, pkt->size); - *p = *pict; - p->pict_type= AV_PICTURE_TYPE_I; - p->key_frame= 1; - for(mb_y=0; mb_ymb_height2; mb_y++){ for(mb_x=0; mb_xmb_width2; mb_x++){ - dct_get(a, mb_x, mb_y); + dct_get(a, pict, mb_x, mb_y); encode_mb(a, a->block); } } @@ -200,7 +197,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, if(a->mb_width2 != a->mb_width){ mb_x= a->mb_width2; for(mb_y=0; mb_ymb_height2; mb_y++){ - dct_get(a, mb_x, mb_y); + dct_get(a, pict, mb_x, mb_y); encode_mb(a, a->block); } } @@ -208,7 +205,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, if(a->mb_height2 != a->mb_height){ mb_y= a->mb_height2; for(mb_x=0; mb_xmb_width; mb_x++){ - dct_get(a, mb_x, mb_y); + dct_get(a, pict, mb_x, mb_y); encode_mb(a, a->block); } } @@ -262,6 +259,7 @@ static av_cold int encode_init(AVCodecContext *avctx){ #if CONFIG_ASV1_ENCODER AVCodec ff_asv1_encoder = { .name = "asv1", + .long_name = NULL_IF_CONFIG_SMALL("ASUS V1"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_ASV1, .priv_data_size = sizeof(ASV1Context), @@ -269,13 +267,13 @@ AVCodec ff_asv1_encoder = { .encode2 = encode_frame, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }, - .long_name = NULL_IF_CONFIG_SMALL("ASUS V1"), }; #endif #if CONFIG_ASV2_ENCODER AVCodec ff_asv2_encoder = { .name = "asv2", + .long_name = NULL_IF_CONFIG_SMALL("ASUS V2"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_ASV2, .priv_data_size = sizeof(ASV1Context), @@ -283,6 +281,5 @@ AVCodec ff_asv2_encoder = { .encode2 = encode_frame, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }, - .long_name = NULL_IF_CONFIG_SMALL("ASUS V2"), }; #endif -- cgit v1.2.3