mirror of https://git.ffmpeg.org/ffmpeg.git
Merge commit 'e280fe13291e9c712a5f4aa13b5263f3e8afed45'
* commit 'e280fe13291e9c712a5f4aa13b5263f3e8afed45': v210: Use separate sample_factors Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
This commit is contained in:
commit
04e4166536
|
@ -86,7 +86,8 @@ av_cold void ff_v210enc_init(V210EncContext *s)
|
||||||
{
|
{
|
||||||
s->pack_line_8 = v210_planar_pack_8_c;
|
s->pack_line_8 = v210_planar_pack_8_c;
|
||||||
s->pack_line_10 = v210_planar_pack_10_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)
|
if (ARCH_X86)
|
||||||
ff_v210enc_init_x86(s);
|
ff_v210enc_init_x86(s);
|
||||||
|
@ -133,15 +134,19 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||||
const uint16_t *y = (const uint16_t *)pic->data[0];
|
const uint16_t *y = (const uint16_t *)pic->data[0];
|
||||||
const uint16_t *u = (const uint16_t *)pic->data[1];
|
const uint16_t *u = (const uint16_t *)pic->data[1];
|
||||||
const uint16_t *v = (const uint16_t *)pic->data[2];
|
const uint16_t *v = (const uint16_t *)pic->data[2];
|
||||||
|
|
||||||
|
const int sample_size = 6 * s->sample_factor_10;
|
||||||
|
const int sample_w = avctx->width / sample_size;
|
||||||
|
|
||||||
for (h = 0; h < avctx->height; h++) {
|
for (h = 0; h < avctx->height; h++) {
|
||||||
uint32_t val;
|
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);
|
s->pack_line_10(y, u, v, dst, w);
|
||||||
|
|
||||||
y += w;
|
y += w;
|
||||||
u += w >> 1;
|
u += w >> 1;
|
||||||
v += w >> 1;
|
v += w >> 1;
|
||||||
dst += (w / (6 * s->sample_factor)) * 16 * s->sample_factor;
|
dst += sample_w * 16 * s->sample_factor_10;
|
||||||
|
|
||||||
for (; w < avctx->width - 5; w += 6) {
|
for (; w < avctx->width - 5; w += 6) {
|
||||||
WRITE_PIXELS(u, y, v);
|
WRITE_PIXELS(u, y, v);
|
||||||
|
@ -178,15 +183,19 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||||
const uint8_t *y = pic->data[0];
|
const uint8_t *y = pic->data[0];
|
||||||
const uint8_t *u = pic->data[1];
|
const uint8_t *u = pic->data[1];
|
||||||
const uint8_t *v = pic->data[2];
|
const uint8_t *v = pic->data[2];
|
||||||
|
|
||||||
|
const int sample_size = 12 * s->sample_factor_8;
|
||||||
|
const int sample_w = avctx->width / sample_size;
|
||||||
|
|
||||||
for (h = 0; h < avctx->height; h++) {
|
for (h = 0; h < avctx->height; h++) {
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
w = (avctx->width / (12 * s->sample_factor)) * 12 * s->sample_factor;
|
w = sample_w * sample_size;
|
||||||
s->pack_line_8(y, u, v, dst, w);
|
s->pack_line_8(y, u, v, dst, w);
|
||||||
|
|
||||||
y += w;
|
y += w;
|
||||||
u += w >> 1;
|
u += w >> 1;
|
||||||
v += w >> 1;
|
v += w >> 1;
|
||||||
dst += (w / (12 * s->sample_factor)) * 32 * s->sample_factor;
|
dst += sample_w * 32 * s->sample_factor_8;
|
||||||
|
|
||||||
for (; w < avctx->width - 5; w += 6) {
|
for (; w < avctx->width - 5; w += 6) {
|
||||||
WRITE_PIXELS8(u, y, v);
|
WRITE_PIXELS8(u, y, v);
|
||||||
|
|
|
@ -28,8 +28,8 @@ typedef struct V210EncContext {
|
||||||
const uint8_t *v, uint8_t *dst, ptrdiff_t width);
|
const uint8_t *v, uint8_t *dst, ptrdiff_t width);
|
||||||
void (*pack_line_10)(const uint16_t *y, const uint16_t *u,
|
void (*pack_line_10)(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);
|
||||||
int sample_factor; /* This value must be the same for both 8-and 10-bit
|
int sample_factor_8;
|
||||||
functions otherwise the output will be incorrect. */
|
int sample_factor_10;
|
||||||
} V210EncContext;
|
} V210EncContext;
|
||||||
|
|
||||||
void ff_v210enc_init(V210EncContext *s);
|
void ff_v210enc_init(V210EncContext *s);
|
||||||
|
|
|
@ -45,9 +45,10 @@ av_cold void ff_v210enc_init_x86(V210EncContext *s)
|
||||||
if (EXTERNAL_AVX(cpu_flags))
|
if (EXTERNAL_AVX(cpu_flags))
|
||||||
s->pack_line_8 = ff_v210_planar_pack_8_avx;
|
s->pack_line_8 = ff_v210_planar_pack_8_avx;
|
||||||
|
|
||||||
if (EXTERNAL_AVX2_FAST(cpu_flags)) {
|
if (EXTERNAL_AVX2(cpu_flags)) {
|
||||||
s->pack_line_8 = ff_v210_planar_pack_8_avx2;
|
s->sample_factor_8 = 2;
|
||||||
s->pack_line_10 = ff_v210_planar_pack_10_avx2;
|
s->pack_line_8 = ff_v210_planar_pack_8_avx2;
|
||||||
s->sample_factor = 2;
|
s->sample_factor_10 = 2;
|
||||||
|
s->pack_line_10 = ff_v210_planar_pack_10_avx2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue