summaryrefslogtreecommitdiff
path: root/libavcodec/v210enc.c
diff options
context:
space:
mode:
authorJames Darnley <james.darnley@gmail.com>2016-01-15 20:35:05 +0100
committerLuca Barbato <lu_zero@gentoo.org>2016-02-01 13:40:07 +0100
commitd29237e5578a187c5a8d91338cd70ce0fd6f6003 (patch)
treef87423a97c7e7e680c5cda7255c000c889971105 /libavcodec/v210enc.c
parent1ba1fede9dfe03dc48862e5e0530cca7192f5038 (diff)
v210: Add avx2 version of the 8-bit line encoder
Around 35% faster than the avx version. Signed-off-by: Henrik Gramner <henrik@gramner.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec/v210enc.c')
-rw-r--r--libavcodec/v210enc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c
index ca6ad2ee2f..ce690f1634 100644
--- a/libavcodec/v210enc.c
+++ b/libavcodec/v210enc.c
@@ -86,6 +86,7 @@ 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;
if (ARCH_X86)
ff_v210enc_init_x86(s);
@@ -172,13 +173,13 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const uint8_t *v = pic->data[2];
for (h = 0; h < avctx->height; h++) {
uint32_t val;
- w = (avctx->width / 12) * 12;
+ w = (avctx->width / (12 * s->sample_factor)) * 12 * s->sample_factor;
s->pack_line_8(y, u, v, dst, w);
y += w;
u += w >> 1;
v += w >> 1;
- dst += (w / 12) * 32;
+ dst += (w / (12 * s->sample_factor)) * 32 * s->sample_factor;
for (; w < avctx->width - 5; w += 6) {
WRITE_PIXELS8(u, y, v);