Merge commit '9a738c27dceb4b975784b23213a46f5cb560d1c2'

* commit '9a738c27dceb4b975784b23213a46f5cb560d1c2':
  v210enc: Add SIMD optimised 8-bit and 10-bit encoders

Conflicts:
	libavcodec/v210enc.c
	libavcodec/v210enc.h
	libavcodec/x86/Makefile
	libavcodec/x86/v210enc.asm
	libavcodec/x86/v210enc_init.c
	tests/ref/vsynth/vsynth1-v210
	tests/ref/vsynth/vsynth2-v210

See: 36091742d1
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-12-06 01:46:39 +01:00
commit 1d048f762d
3 changed files with 33 additions and 28 deletions

View File

@ -48,7 +48,8 @@
} while (0)
static void v210_planar_pack_8_c(const uint8_t *y, const uint8_t *u,
const uint8_t *v, uint8_t *dst, ptrdiff_t width)
const uint8_t *v, uint8_t *dst,
ptrdiff_t width)
{
uint32_t val;
int i;
@ -67,7 +68,8 @@ static void v210_planar_pack_8_c(const uint8_t *y, const uint8_t *u,
}
static void v210_planar_pack_10_c(const uint16_t *y, const uint16_t *u,
const uint16_t *v, uint8_t *dst, ptrdiff_t width)
const uint16_t *v, uint8_t *dst,
ptrdiff_t width)
{
uint32_t val;
int i;
@ -108,18 +110,17 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *pic, int *got_packet)
{
V210EncContext *s = avctx->priv_data;
int aligned_width = ((avctx->width + 47) / 48) * 48;
int stride = aligned_width * 8 / 3;
int line_padding = stride - ((avctx->width * 8 + 11) / 12) * 4;
int h, w, ret;
uint8_t *dst;
if ((ret = ff_alloc_packet(pkt, avctx->height * stride)) < 0) {
ret = ff_alloc_packet(pkt, avctx->height * stride);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
return ret;
}
dst = pkt->data;
if (pic->format == AV_PIX_FMT_YUV422P10) {
@ -156,13 +157,11 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
memset(dst, 0, line_padding);
dst += line_padding;
y += pic->linesize[0] / 2 - avctx->width;
u += pic->linesize[1] / 2 - avctx->width / 2;
v += pic->linesize[2] / 2 - avctx->width / 2;
}
}
else if(pic->format == AV_PIX_FMT_YUV422P) {
} else if(pic->format == AV_PIX_FMT_YUV422P) {
const uint8_t *y = pic->data[0];
const uint8_t *u = pic->data[1];
const uint8_t *v = pic->data[2];
@ -200,7 +199,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
AV_WL32(dst, val);
dst += 4;
}
memset(dst, 0, line_padding);
dst += line_padding;

View File

@ -24,8 +24,10 @@
#include "libavutil/pixfmt.h"
typedef struct {
void (*pack_line_8)(const uint8_t *y, const uint8_t *u, const uint8_t *v, uint8_t *dst, ptrdiff_t width);
void (*pack_line_10)(const uint16_t *y, const uint16_t *u, const uint16_t *v, uint8_t *dst, ptrdiff_t width);
void (*pack_line_8)(const uint8_t *y, const uint8_t *u,
const uint8_t *v, uint8_t *dst, ptrdiff_t width);
void (*pack_line_10)(const uint16_t *y, const uint16_t *u,
const uint16_t *v, uint8_t *dst, ptrdiff_t width);
} V210EncContext;
void ff_v210enc_init_x86(V210EncContext *s);

View File

@ -19,9 +19,14 @@
#include "libavutil/x86/cpu.h"
#include "libavcodec/v210enc.h"
void ff_v210_planar_pack_8_ssse3(const uint8_t *y, const uint8_t *u, const uint8_t *v, uint8_t *dst, ptrdiff_t width);
void ff_v210_planar_pack_8_avx(const uint8_t *y, const uint8_t *u, const uint8_t *v, uint8_t *dst, ptrdiff_t width);
void ff_v210_planar_pack_10_ssse3(const uint16_t *y, const uint16_t *u, const uint16_t *v, uint8_t *dst, ptrdiff_t width);
void ff_v210_planar_pack_8_ssse3(const uint8_t *y, const uint8_t *u,
const uint8_t *v, uint8_t *dst,
ptrdiff_t width);
void ff_v210_planar_pack_8_avx(const uint8_t *y, const uint8_t *u,
const uint8_t *v, uint8_t *dst, ptrdiff_t width);
void ff_v210_planar_pack_10_ssse3(const uint16_t *y, const uint16_t *u,
const uint16_t *v, uint8_t *dst,
ptrdiff_t width);
av_cold void ff_v210enc_init_x86(V210EncContext *s)
{