On Thu, Jan 28, 2016 at 12:02 AM, Luca Barbato <lu_z...@gentoo.org> wrote: > And while at it simplify a little the code. > --- > libavcodec/v210enc.c | 17 ++++++++++++----- > libavcodec/v210enc.h | 3 ++- > libavcodec/x86/v210enc_init.c | 7 ++++--- > 3 files changed, 18 insertions(+), 9 deletions(-) > > diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c > index da0b23f..2ee5a1b 100644 > --- a/libavcodec/v210enc.c > +++ b/libavcodec/v210enc.c > @@ -86,7 +86,8 @@ av_cold void ff_v210enc_init(V210EncContext *s) > { > s->pack_line_8 = v210_planar_pack_8_c; > s->pack_line_10 = v210_planar_pack_10_c; > - s->sample_factor = 1; > + s->sample_factor_8 = 1; > + s->sample_factor_10 = 1; > > if (ARCH_X86) > ff_v210enc_init_x86(s); > @@ -133,15 +134,18 @@ static int encode_frame(AVCodecContext *avctx, AVPacket > *pkt, > const uint16_t *y = (const uint16_t *)pic->data[0]; > const uint16_t *u = (const uint16_t *)pic->data[1]; > const uint16_t *v = (const uint16_t *)pic->data[2]; > + int sample_size = 6 * s->sample_factor_10; > + int sample_w = avctx->width / sample_size; > + > for (h = 0; h < avctx->height; h++) { > uint32_t val; > - w = (avctx->width / (6 * s->sample_factor)) * 6 * > s->sample_factor; > + w = sample_w * sample_size; > s->pack_line_10(y, u, v, dst, w); > > y += w; > u += w >> 1; > v += w >> 1; > - dst += (w / (6 * s->sample_factor)) * 16 * s->sample_factor; > + dst += sample_w * 16 * s->sample_factor_10;
Does this not break the rounding? Kieran _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel