aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2008-03-04 23:10:47 +0000
committerAurelien Jacobs <aurel@gnuage.org>2008-03-04 23:10:47 +0000
commit288a44fb7a4fb21f9c1e92fc009ad06797ef78d3 (patch)
tree6664d12a7fd9cee75a5e65df45fb099c16ff9528 /libavcodec
parent8d4bef64b4ab7e66cf6ca1fb2bc762103390950a (diff)
downloadffmpeg-288a44fb7a4fb21f9c1e92fc009ad06797ef78d3.tar.gz
move ff_emulated_edge_mc() to dsputil
Originally committed as revision 12318 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dsputil.c71
-rw-r--r--libavcodec/dsputil.h4
-rw-r--r--libavcodec/mpegvideo.c71
-rw-r--r--libavcodec/mpegvideo.h2
4 files changed, 75 insertions, 73 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 9e69bf7ae3..cfe3666b5c 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -457,6 +457,77 @@ static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w)
}
}
+/**
+ * Copies a rectangular area of samples to a temporary buffer and replicates the boarder samples.
+ * @param buf destination buffer
+ * @param src source buffer
+ * @param linesize number of bytes between 2 vertically adjacent samples in both the source and destination buffers
+ * @param block_w width of block
+ * @param block_h height of block
+ * @param src_x x coordinate of the top left sample of the block in the source buffer
+ * @param src_y y coordinate of the top left sample of the block in the source buffer
+ * @param w width of the source buffer
+ * @param h height of the source buffer
+ */
+void ff_emulated_edge_mc(uint8_t *buf, uint8_t *src, int linesize, int block_w, int block_h,
+ int src_x, int src_y, int w, int h){
+ int x, y;
+ int start_y, start_x, end_y, end_x;
+
+ if(src_y>= h){
+ src+= (h-1-src_y)*linesize;
+ src_y=h-1;
+ }else if(src_y<=-block_h){
+ src+= (1-block_h-src_y)*linesize;
+ src_y=1-block_h;
+ }
+ if(src_x>= w){
+ src+= (w-1-src_x);
+ src_x=w-1;
+ }else if(src_x<=-block_w){
+ src+= (1-block_w-src_x);
+ src_x=1-block_w;
+ }
+
+ start_y= FFMAX(0, -src_y);
+ start_x= FFMAX(0, -src_x);
+ end_y= FFMIN(block_h, h-src_y);
+ end_x= FFMIN(block_w, w-src_x);
+
+ // copy existing part
+ for(y=start_y; y<end_y; y++){
+ for(x=start_x; x<end_x; x++){
+ buf[x + y*linesize]= src[x + y*linesize];
+ }
+ }
+
+ //top
+ for(y=0; y<start_y; y++){
+ for(x=start_x; x<end_x; x++){
+ buf[x + y*linesize]= buf[x + start_y*linesize];
+ }
+ }
+
+ //bottom
+ for(y=end_y; y<block_h; y++){
+ for(x=start_x; x<end_x; x++){
+ buf[x + y*linesize]= buf[x + (end_y-1)*linesize];
+ }
+ }
+
+ for(y=0; y<block_h; y++){
+ //left
+ for(x=0; x<start_x; x++){
+ buf[x + y*linesize]= buf[start_x + y*linesize];
+ }
+
+ //right
+ for(x=end_x; x<block_w; x++){
+ buf[x + y*linesize]= buf[end_x - 1 + y*linesize];
+ }
+ }
+}
+
static void get_pixels_c(DCTELEM *restrict block, const uint8_t *pixels, int line_size)
{
int i;
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index bde3a1cf52..8135688af3 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -168,6 +168,10 @@ typedef struct ScanTable{
void ff_init_scantable(uint8_t *, ScanTable *st, const uint8_t *src_scantable);
+void ff_emulated_edge_mc(uint8_t *buf, uint8_t *src, int linesize,
+ int block_w, int block_h,
+ int src_x, int src_y, int w, int h);
+
/**
* DSPContext.
*/
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 1c2c385f04..27e6c42b5f 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1342,77 +1342,6 @@ v= (int)(128 + r*sin(theta*3.141592/180));
}
}
-/**
- * Copies a rectangular area of samples to a temporary buffer and replicates the boarder samples.
- * @param buf destination buffer
- * @param src source buffer
- * @param linesize number of bytes between 2 vertically adjacent samples in both the source and destination buffers
- * @param block_w width of block
- * @param block_h height of block
- * @param src_x x coordinate of the top left sample of the block in the source buffer
- * @param src_y y coordinate of the top left sample of the block in the source buffer
- * @param w width of the source buffer
- * @param h height of the source buffer
- */
-void ff_emulated_edge_mc(uint8_t *buf, uint8_t *src, int linesize, int block_w, int block_h,
- int src_x, int src_y, int w, int h){
- int x, y;
- int start_y, start_x, end_y, end_x;
-
- if(src_y>= h){
- src+= (h-1-src_y)*linesize;
- src_y=h-1;
- }else if(src_y<=-block_h){
- src+= (1-block_h-src_y)*linesize;
- src_y=1-block_h;
- }
- if(src_x>= w){
- src+= (w-1-src_x);
- src_x=w-1;
- }else if(src_x<=-block_w){
- src+= (1-block_w-src_x);
- src_x=1-block_w;
- }
-
- start_y= FFMAX(0, -src_y);
- start_x= FFMAX(0, -src_x);
- end_y= FFMIN(block_h, h-src_y);
- end_x= FFMIN(block_w, w-src_x);
-
- // copy existing part
- for(y=start_y; y<end_y; y++){
- for(x=start_x; x<end_x; x++){
- buf[x + y*linesize]= src[x + y*linesize];
- }
- }
-
- //top
- for(y=0; y<start_y; y++){
- for(x=start_x; x<end_x; x++){
- buf[x + y*linesize]= buf[x + start_y*linesize];
- }
- }
-
- //bottom
- for(y=end_y; y<block_h; y++){
- for(x=start_x; x<end_x; x++){
- buf[x + y*linesize]= buf[x + (end_y-1)*linesize];
- }
- }
-
- for(y=0; y<block_h; y++){
- //left
- for(x=0; x<start_x; x++){
- buf[x + y*linesize]= buf[start_x + y*linesize];
- }
-
- //right
- for(x=end_x; x<block_w; x++){
- buf[x + y*linesize]= buf[end_x - 1 + y*linesize];
- }
- }
-}
-
static inline int hpel_motion_lowres(MpegEncContext *s,
uint8_t *dest, uint8_t *src,
int field_based, int field_select,
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 4a365de74e..35ef0e1df7 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -694,8 +694,6 @@ void MPV_common_init_armv4l(MpegEncContext *s);
void MPV_common_init_altivec(MpegEncContext *s);
void ff_clean_intra_table_entries(MpegEncContext *s);
void ff_draw_horiz_band(MpegEncContext *s, int y, int h);
-void ff_emulated_edge_mc(uint8_t *buf, uint8_t *src, int linesize, int block_w, int block_h,
- int src_x, int src_y, int w, int h);
void ff_mpeg_flush(AVCodecContext *avctx);
void ff_print_debug_info(MpegEncContext *s, AVFrame *pict);
void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix);