Skip to content

Commit

Permalink
Merge commit '6906b19346ae8a330bfaa1c16ce535be10789723'
Browse files Browse the repository at this point in the history
* commit '6906b19346ae8a330bfaa1c16ce535be10789723':
  lavc: add missing files for arm
  lavc: introduce VideoDSPContext

Conflicts:
	configure
	libavcodec/arm/dsputil_init_armv5te.c
	libavcodec/dsputil.c
	libavcodec/dsputil.h
	libavcodec/dsputil_template.c
	libavcodec/h264.c
	libavcodec/mpegvideo.h
	libavcodec/mpegvideo_enc.c
	libavcodec/x86/dsputil_mmx.c

Merged-by: Michael Niedermayer <[email protected]>
  • Loading branch information
michaelni committed Dec 21, 2012
2 parents fb3f28e + 6906b19 commit a41bf09
Show file tree
Hide file tree
Showing 41 changed files with 1,277 additions and 943 deletions.
10 changes: 6 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,7 @@ CONFIG_EXTRA="
rangecoder
rtpdec
sinewin
videodsp
vp3dsp
"

Expand Down Expand Up @@ -1726,6 +1727,7 @@ mpeg4_decoder_select="h263_decoder mpeg4video_parser"
mpeg4_encoder_select="h263_encoder"
mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
mpegvideo_select="videodsp"
msmpeg4_crystalhd_decoder_select="crystalhd"
msmpeg4v1_decoder_select="h263_decoder"
msmpeg4v1_encoder_select="h263_encoder"
Expand Down Expand Up @@ -1776,12 +1778,12 @@ vc1_vdpau_decoder_select="vdpau vc1_decoder"
vc1image_decoder_select="vc1_decoder"
vorbis_decoder_select="mdct"
vorbis_encoder_select="mdct"
vp3_decoder_select="vp3dsp"
vp5_decoder_select="vp3dsp"
vp6_decoder_select="huffman vp3dsp"
vp3_decoder_select="vp3dsp videodsp"
vp5_decoder_select="vp3dsp videodsp"
vp6_decoder_select="huffman vp3dsp videodsp"
vp6a_decoder_select="vp6_decoder"
vp6f_decoder_select="vp6_decoder"
vp8_decoder_select="h264pred h264qpel"
vp8_decoder_select="h264pred videodsp"
wmapro_decoder_select="mdct sinewin"
wmav1_decoder_select="mdct sinewin"
wmav1_encoder_select="mdct sinewin"
Expand Down
1 change: 1 addition & 0 deletions libavcodec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ OBJS-$(CONFIG_RDFT) += rdft.o $(RDFT-OBJS-yes)
OBJS-$(CONFIG_SINEWIN) += sinewin.o
OBJS-$(CONFIG_VAAPI) += vaapi.o
OBJS-$(CONFIG_VDPAU) += vdpau.o
OBJS-$(CONFIG_VIDEODSP) += videodsp.o
OBJS-$(CONFIG_VP3DSP) += vp3dsp.o

# decoders/encoders/hardware accelerators
Expand Down
5 changes: 5 additions & 0 deletions libavcodec/arm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_init_arm.o
OBJS-$(CONFIG_RV40_DECODER) += arm/rv34dsp_init_arm.o \
arm/rv40dsp_init_arm.o \

OBJS-$(CONFIG_VIDEODSP) += arm/videodsp_init_arm.o \

OBJS += arm/dsputil_init_arm.o \
arm/dsputil_arm.o \
arm/fft_init_arm.o \
Expand All @@ -41,6 +43,9 @@ OBJS += arm/dsputil_init_arm.o \
ARMV5TE-OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_armv5te.o \
arm/mpegvideo_armv5te_s.o \

ARMV5TE-OBJS-$(CONFIG_VIDEODSP) += arm/videodsp_init_armv5te.o \
arm/videodsp_armv5te.o \

ARMV5TE-OBJS += arm/dsputil_init_armv5te.o \
arm/simple_idct_armv5te.o \

Expand Down
10 changes: 1 addition & 9 deletions libavcodec/arm/dsputil_arm.S
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,7 @@
#include "config.h"
#include "libavutil/arm/asm.S"

#if HAVE_ARMV5TE_EXTERNAL
function ff_prefetch_arm, export=1
subs r2, r2, #1
pld [r0]
add r0, r0, r1
bne ff_prefetch_arm
bx lr
endfunc
#else
#if !HAVE_ARMV5TE_EXTERNAL
#define pld @
#endif

Expand Down
6 changes: 0 additions & 6 deletions libavcodec/arm/dsputil_init_armv5te.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ void ff_simple_idct_armv5te(DCTELEM *data);
void ff_simple_idct_put_armv5te(uint8_t *dest, int line_size, DCTELEM *data);
void ff_simple_idct_add_armv5te(uint8_t *dest, int line_size, DCTELEM *data);

void ff_prefetch_arm(void *mem, int stride, int h);

av_cold void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx)
{
if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 &&
Expand All @@ -37,8 +35,4 @@ av_cold void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx)
c->idct = ff_simple_idct_armv5te;
c->idct_permutation_type = FF_NO_IDCT_PERM;
}

#if HAVE_ARMV5TE_EXTERNAL
c->prefetch = ff_prefetch_arm;
#endif
}
29 changes: 29 additions & 0 deletions libavcodec/arm/videodsp_arm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2009 Mans Rullgard <[email protected]>
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef AVCODEC_ARM_VIDEODSP_ARM_H
#define AVCODEC_ARM_VIDEODSP_ARM_H

#include "libavcodec/avcodec.h"
#include "libavcodec/videodsp.h"

void ff_videodsp_init_armv5te(VideoDSPContext* ctx, int bpc);

#endif /* AVCODEC_ARM_VIDEODSP_ARM_H */
33 changes: 33 additions & 0 deletions libavcodec/arm/videodsp_armv5te.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@
@ ARMv5te optimized DSP utils
@ Copyright (c) 2004 AGAWA Koji <i (AT) atty (DOT) jp>
@
@ This file is part of Libav.
@
@ Libav is free software; you can redistribute it and/or
@ modify it under the terms of the GNU Lesser General Public
@ License as published by the Free Software Foundation; either
@ version 2.1 of the License, or (at your option) any later version.
@
@ Libav is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@ Lesser General Public License for more details.
@
@ You should have received a copy of the GNU Lesser General Public
@ License along with Libav; if not, write to the Free Software
@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@

#include "config.h"
#include "libavutil/arm/asm.S"

#if HAVE_ARMV5TE_EXTERNAL
function ff_prefetch_arm, export=1
subs r2, r2, #1
pld [r0]
add r0, r0, r1
bne ff_prefetch_arm
bx lr
endfunc
#endif
29 changes: 29 additions & 0 deletions libavcodec/arm/videodsp_init_arm.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (C) 2012 Ronald S. Bultje
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "libavutil/arm/cpu.h"
#include "libavcodec/videodsp.h"
#include "videodsp_arm.h"

void ff_videodsp_init_arm(VideoDSPContext *ctx, int bpc)
{
int cpu_flags = av_get_cpu_flags();
if (have_armv5te(cpu_flags)) ff_videodsp_init_armv5te(ctx, bpc);
}
32 changes: 32 additions & 0 deletions libavcodec/arm/videodsp_init_armv5te.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2012 Ronald S. Bultje
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "libavutil/arm/cpu.h"
#include <libavcodec/videodsp.h>
#include "videodsp_arm.h"

void ff_prefetch_arm(uint8_t *mem, ptrdiff_t stride, int h);

void ff_videodsp_init_armv5te(VideoDSPContext *ctx, int bpc)
{
#if HAVE_ARMV5TE_EXTERNAL
ctx->prefetch = ff_prefetch_arm;
#endif
}
6 changes: 3 additions & 3 deletions libavcodec/cavs.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ static inline void mc_dir_part(AVSContext *h,Picture *pic,
|| full_my < 0-extra_height
|| full_mx + 16/*FIXME*/ > pic_width + extra_width
|| full_my + 16/*FIXME*/ > pic_height + extra_height){
s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->l_stride, h->l_stride,
s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->l_stride, h->l_stride,
16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height);
src_y= s->edge_emu_buffer + 2 + 2*h->l_stride;
emu=1;
Expand All @@ -401,14 +401,14 @@ static inline void mc_dir_part(AVSContext *h,Picture *pic,
qpix_op[luma_xy](dest_y, src_y, h->l_stride); //FIXME try variable height perhaps?

if(emu){
s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cb, h->c_stride,
s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src_cb, h->c_stride,
9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
src_cb= s->edge_emu_buffer;
}
chroma_op(dest_cb, src_cb, h->c_stride, chroma_height, mx&7, my&7);

if(emu){
s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cr, h->c_stride,
s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src_cr, h->c_stride,
9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
src_cr= s->edge_emu_buffer;
}
Expand Down
5 changes: 0 additions & 5 deletions libavcodec/dsputil.c
Original file line number Diff line number Diff line change
Expand Up @@ -2768,8 +2768,6 @@ static void ff_jref_idct1_add(uint8_t *dest, int line_size, DCTELEM *block)
dest[0] = av_clip_uint8(dest[0] + ((block[0] + 4)>>3));
}

static void just_return(void *mem av_unused, int stride av_unused, int h av_unused) { return; }

/* init static data */
av_cold void ff_dsputil_static_init(void)
{
Expand Down Expand Up @@ -3037,8 +3035,6 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->shrink[2]= ff_shrink44;
c->shrink[3]= ff_shrink88;

c->prefetch= just_return;

memset(c->put_2tap_qpel_pixels_tab, 0, sizeof(c->put_2tap_qpel_pixels_tab));
memset(c->avg_2tap_qpel_pixels_tab, 0, sizeof(c->avg_2tap_qpel_pixels_tab));

Expand Down Expand Up @@ -3075,7 +3071,6 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx)
#define BIT_DEPTH_FUNCS(depth, dct)\
c->get_pixels = FUNCC(get_pixels ## dct , depth);\
c->draw_edges = FUNCC(draw_edges , depth);\
c->emulated_edge_mc = FUNC (ff_emulated_edge_mc , depth);\
c->clear_block = FUNCC(clear_block ## dct , depth);\
c->clear_blocks = FUNCC(clear_blocks ## dct , depth);\
c->add_pixels8 = FUNCC(add_pixels8 ## dct , depth);\
Expand Down
24 changes: 2 additions & 22 deletions libavcodec/dsputil.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,12 @@ void ff_init_scantable_permutation(uint8_t *idct_permutation,
int idct_permutation_type);

#define EMULATED_EDGE(depth) \
void ff_emulated_edge_mc_ ## depth (uint8_t *buf, const uint8_t *src, int linesize,\
void ff_emulated_edge_mc_ ## depth (uint8_t *buf, const uint8_t *src, ptrdiff_t linesize,\
int block_w, int block_h,\
int src_x, int src_y, int w, int h);

EMULATED_EDGE(8)
EMULATED_EDGE(9)
EMULATED_EDGE(10)
EMULATED_EDGE(12)
EMULATED_EDGE(14)
EMULATED_EDGE(16)

/**
* DSPContext.
Expand All @@ -224,21 +221,6 @@ typedef struct DSPContext {
void (*add_pixels8)(uint8_t *pixels, DCTELEM *block, int line_size);
void (*add_pixels4)(uint8_t *pixels, DCTELEM *block, int line_size);
int (*sum_abs_dctelem)(DCTELEM *block/*align 16*/);
/**
* Motion estimation with emulated edge values.
* @param buf pointer to destination buffer (unaligned)
* @param src pointer to pixel source (unaligned)
* @param linesize width (in pixels) for src/buf
* @param block_w number of pixels (per row) to copy to buf
* @param block_h nummber of pixel rows to copy to buf
* @param src_x offset of src to start of row - this may be negative
* @param src_y offset of src to top of image - this may be negative
* @param w width of src in pixels
* @param h height of src in pixels
*/
void (*emulated_edge_mc)(uint8_t *buf, const uint8_t *src, int linesize,
int block_w, int block_h,
int src_x, int src_y, int w, int h);
/**
* translational global motion compensation.
*/
Expand Down Expand Up @@ -475,8 +457,6 @@ typedef struct DSPContext {
#define EDGE_TOP 1
#define EDGE_BOTTOM 2

void (*prefetch)(void *mem, int stride, int h);

void (*shrink[4])(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);

/**
Expand Down
Loading

0 comments on commit a41bf09

Please sign in to comment.