On 9/20/19, lance.lmw...@gmail.com <lance.lmw...@gmail.com> wrote: > From: Limin Wang <lance.lmw...@gmail.com> > > Signed-off-by: Limin Wang <lance.lmw...@gmail.com> > --- > libavcodec/v210_template.c | 20 ++++++++++++++++++++ > libavcodec/v210enc.c | 8 +++++--- > 2 files changed, 25 insertions(+), 3 deletions(-) > > diff --git a/libavcodec/v210_template.c b/libavcodec/v210_template.c > index 9e1d9f9..083a9f1 100644 > --- a/libavcodec/v210_template.c > +++ b/libavcodec/v210_template.c > @@ -43,11 +43,31 @@ static void RENAME(v210_enc)(AVCodecContext *avctx, > const TYPE *y = (const TYPE *)pic->data[0]; > const TYPE *u = (const TYPE *)pic->data[1]; > const TYPE *v = (const TYPE *)pic->data[2]; > + const TYPE *u_even = u; > + const TYPE *v_even = v; > const int sample_size = 6 * s->RENAME(sample_factor); > const int sample_w = avctx->width / sample_size; > > for (h = 0; h < avctx->height; h++) { > uint32_t val; > + > + if (pic->format == AV_PIX_FMT_YUV420P10 || > + pic->format == AV_PIX_FMT_YUV420P) { > + int mod = pic->interlaced_frame == 1 ? 4 : 2; > + if (h % mod == 0) { > + u_even = u; > + v_even = v; > + } else { > + /* progressive chroma */ > + if (mod == 2) { > + u = u_even; > + v = v_even; > + } else if (h % 4 == 2) { > + u = u_even; > + v = v_even; > + } > + } > + } > w = sample_w * sample_size; > s->RENAME(pack_line)(y, u, v, dst, w); > > diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c > index 16e8810..2180737 100644 > --- a/libavcodec/v210enc.c > +++ b/libavcodec/v210enc.c > @@ -131,9 +131,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket > *pkt, > } > dst = pkt->data; > > - if (pic->format == AV_PIX_FMT_YUV422P10) > + if (pic->format == AV_PIX_FMT_YUV422P10 || pic->format == > AV_PIX_FMT_YUV420P10) > v210_enc_10(avctx, dst, pic); > - else if(pic->format == AV_PIX_FMT_YUV422P) > + else if(pic->format == AV_PIX_FMT_YUV422P || pic->format == > AV_PIX_FMT_YUV420P) > v210_enc_8(avctx, dst, pic); > > side_data = av_frame_get_side_data(pic, AV_FRAME_DATA_A53_CC); > @@ -165,5 +165,7 @@ AVCodec ff_v210_encoder = { > .priv_data_size = sizeof(V210EncContext), > .init = encode_init, > .encode2 = encode_frame, > - .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV422P10, > AV_PIX_FMT_YUV422P, AV_PIX_FMT_NONE }, > + .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV422P10, > AV_PIX_FMT_YUV422P, > + AV_PIX_FMT_YUV420P10, > AV_PIX_FMT_YUV420P, > + AV_PIX_FMT_NONE }, > }; > -- > 2.6.4 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Why people constantly try to do this? First cinepak, now this? Obviously not accepted. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".