X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fsnowenc.c;h=16d2b7c302ef33e2f2ad58d0aa1b4ba6f990b8c7;hb=1ab3ae6fd5b1866aa42cfc0c5d79700adb7281d8;hp=61a658fa4401ae2904bd83710588c318cdde62a8;hpb=ce47f1589e9f5a6cf8372a269bdd862ff0cc3f91;p=ffmpeg diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index 61a658fa440..16d2b7c302e 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -25,6 +25,7 @@ #include "libavutil/pixdesc.h" #include "avcodec.h" #include "internal.h" +#include "packet_internal.h" #include "snow_dwt.h" #include "snow.h" @@ -81,6 +82,7 @@ FF_ENABLE_DEPRECATION_WARNINGS s->m.bit_rate= avctx->bit_rate; s->m.lmin = avctx->mb_lmin; s->m.lmax = avctx->mb_lmax; + s->m.mb_num = (avctx->width * avctx->height + 255) / 256; // For ratecontrol s->m.me.temp = s->m.me.scratchpad= av_mallocz_array((avctx->width+64), 2*16*2*sizeof(uint8_t)); @@ -312,7 +314,7 @@ static int encode_q_branch(SnowContext *s, int level, int x, int y){ if(P_LEFT[1] > (c->ymax<ymax< (c->xmax<xmax< (c->ymax<ymax<xmin<xmin<xmin * (1<xmin * (1< (c->xmax<xmax< (c->ymax<ymax<lambda = 0; }//else keep previous frame's qlog until after motion estimation +#if FF_API_CODED_FRAME +FF_DISABLE_DEPRECATION_WARNINGS + av_frame_unref(avctx->coded_frame); +FF_ENABLE_DEPRECATION_WARNINGS +#endif + if (s->current_picture->data[0]) { int w = s->avctx->width; int h = s->avctx->height; +#if FF_API_CODED_FRAME + ret = av_frame_make_writable(s->current_picture); + if (ret < 0) + return ret; +#endif + s->mpvencdsp.draw_edges(s->current_picture->data[0], s->current_picture->linesize[0], w , h , EDGE_WIDTH , EDGE_WIDTH , EDGE_TOP | EDGE_BOTTOM); @@ -1644,7 +1658,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, ff_snow_frame_start(s); #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS - av_frame_unref(avctx->coded_frame); ret = av_frame_ref(avctx->coded_frame, s->current_picture); FF_ENABLE_DEPRECATION_WARNINGS #endif @@ -1774,7 +1787,7 @@ FF_ENABLE_DEPRECATION_WARNINGS }else{ for(y=0; yspatial_dwt_buffer[y*w + x]=s->spatial_idwt_buffer[y*w + x]<spatial_dwt_buffer[y*w + x]= s->spatial_idwt_buffer[y*w + x] * (1 << ENCODER_EXTRA_BITS); } } } @@ -1899,7 +1912,7 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif - pkt->size = ff_rac_terminate(c); + pkt->size = ff_rac_terminate(c, 0); if (s->current_picture->key_frame) pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; @@ -1935,6 +1948,11 @@ static const AVOption options[] = { { "pred", "Spatial decomposition type", OFFSET(pred), AV_OPT_TYPE_INT, { .i64 = 0 }, DWT_97, DWT_53, VE, "pred" }, { "dwt97", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "pred" }, { "dwt53", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "pred" }, + { "rc_eq", "Set rate control equation. When computing the expression, besides the standard functions " + "defined in the section 'Expression Evaluation', the following functions are available: " + "bits2qp(bits), qp2bits(qp). Also the following constants are available: iTex pTex tex mv " + "fCode iCount mcVar var isI isP isB avgQP qComp avgIITex avgPITex avgPPTex avgBPTex avgTex.", + OFFSET(m.rc_eq), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, VE }, { NULL }, };