diff options
author | Tobias Bindhammer <tobias.bindhammer@uni-ulm.de> | 2010-10-05 16:14:23 +0400 |
---|---|---|
committer | Tobias Bindhammer <tobias.bindhammer@uni-ulm.de> | 2010-10-05 16:14:23 +0400 |
commit | 90a3ffe27650ab75e00658fc1afa3d715eca2f9d (patch) | |
tree | a95555b939696bb163fda7598beda956e7c1a145 /libavcodec | |
parent | 93ee7f9c41c4083c49cd031b6325dd92e0b21b84 (diff) |
Add possibility to crop screens inside of encoded frames.
Originally committed as revision 25346 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/a64multienc.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/libavcodec/a64multienc.c b/libavcodec/a64multienc.c index f6d4c1ecd5..1cbd06492f 100644 --- a/libavcodec/a64multienc.c +++ b/libavcodec/a64multienc.c @@ -33,6 +33,7 @@ #define DITHERSTEPS 8 #define CHARSET_CHARS 256 #define INTERLACED 1 +#define CROP_SCREENS 1 /* gray gradient */ static const int mc_colors[5]={0x0,0xb,0xc,0xf,0x1}; @@ -245,7 +246,9 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf, AVFrame *const p = (AVFrame *) & c->picture; int frame; - int a; + int x, y; + int b_height; + int b_width; int req_size; int num_frames = c->mc_lifetime; @@ -257,9 +260,19 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf, int *best_cb = c->mc_best_cb; int charset_size = 0x800 * (INTERLACED + 1); - int screen_size = 0x400; + int screen_size; int colram_size = 0x100 * c->mc_use_5col; + if(CROP_SCREENS) { + b_height = FFMIN(avctx->height,C64YRES) >> 3; + b_width = FFMIN(avctx->width ,C64XRES) >> 3; + screen_size = b_width * b_height; + } else { + b_height = C64YRES >> 3; + b_width = C64XRES >> 3; + screen_size = 0x400; + } + /* no data, means end encoding asap */ if (!data) { /* all done, end encoding */ @@ -312,8 +325,10 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf, /* write x frames to buf */ for (frame = 0; frame < c->mc_lifetime; frame++) { /* copy charmap to buf. buf is uchar*, charmap is int*, so no memcpy here, sorry */ - for (a = 0; a < 1000; a++) { - buf[a] = charmap[a]; + for (y = 0; y < b_height; y++) { + for (x = 0; x < b_width; x++) { + buf[y * b_width + x] = charmap[y * b_width + x]; + } } /* advance pointers */ buf += screen_size; |