Cosmetics, lots of.
Originally committed as revision 25348 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
bbc26bae11
commit
2a26520a97
@ -98,6 +98,7 @@ static void render_charset(AVCodecContext *avctx, uint8_t *charset,
|
|||||||
index1[a] = i;
|
index1[a] = i;
|
||||||
index2[a] = FFMIN(i + 1, c->mc_pal_size - 1);
|
index2[a] = FFMIN(i + 1, c->mc_pal_size - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* and render charset */
|
/* and render charset */
|
||||||
for (charpos = 0; charpos < CHARSET_CHARS; charpos++) {
|
for (charpos = 0; charpos < CHARSET_CHARS; charpos++) {
|
||||||
lowdiff = 0;
|
lowdiff = 0;
|
||||||
@ -260,8 +261,8 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf,
|
|||||||
int *best_cb = c->mc_best_cb;
|
int *best_cb = c->mc_best_cb;
|
||||||
|
|
||||||
int charset_size = 0x800 * (INTERLACED + 1);
|
int charset_size = 0x800 * (INTERLACED + 1);
|
||||||
int screen_size;
|
|
||||||
int colram_size = 0x100 * c->mc_use_5col;
|
int colram_size = 0x100 * c->mc_use_5col;
|
||||||
|
int screen_size;
|
||||||
|
|
||||||
if(CROP_SCREENS) {
|
if(CROP_SCREENS) {
|
||||||
b_height = FFMIN(avctx->height,C64YRES) >> 3;
|
b_height = FFMIN(avctx->height,C64YRES) >> 3;
|
||||||
@ -284,9 +285,8 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf,
|
|||||||
}
|
}
|
||||||
/* still frames in queue so limit lifetime to remaining frames */
|
/* still frames in queue so limit lifetime to remaining frames */
|
||||||
else c->mc_lifetime = c->mc_frame_counter;
|
else c->mc_lifetime = c->mc_frame_counter;
|
||||||
}
|
|
||||||
/* still new data available */
|
/* still new data available */
|
||||||
else {
|
} else {
|
||||||
/* fill up mc_meta_charset with data until lifetime exceeds */
|
/* fill up mc_meta_charset with data until lifetime exceeds */
|
||||||
if (c->mc_frame_counter < c->mc_lifetime) {
|
if (c->mc_frame_counter < c->mc_lifetime) {
|
||||||
*p = *pict;
|
*p = *pict;
|
||||||
|
@ -86,7 +86,7 @@ static int a64_write_packet(struct AVFormatContext *s, AVPacket *pkt)
|
|||||||
* the data for colram from/to ram first and waste too much time. If we interleave and send the
|
* the data for colram from/to ram first and waste too much time. If we interleave and send the
|
||||||
* charset beforehand, we assemble a new charset chunk by chunk, write current screen data to
|
* charset beforehand, we assemble a new charset chunk by chunk, write current screen data to
|
||||||
* screen-ram to be displayed and decode the colram directly to colram-location $d800 during
|
* screen-ram to be displayed and decode the colram directly to colram-location $d800 during
|
||||||
* the overscan, while reading directly from source
|
* the overscan, while reading directly from source.
|
||||||
* This is the only way so far, to achieve 25fps on c64 */
|
* This is the only way so far, to achieve 25fps on c64 */
|
||||||
if(avctx->extradata) {
|
if(avctx->extradata) {
|
||||||
/* fetch values from extradata */
|
/* fetch values from extradata */
|
||||||
@ -96,33 +96,35 @@ static int a64_write_packet(struct AVFormatContext *s, AVPacket *pkt)
|
|||||||
frame_size = AV_RB32(avctx->extradata + 12);
|
frame_size = AV_RB32(avctx->extradata + 12);
|
||||||
|
|
||||||
/* TODO: sanity checks? */
|
/* TODO: sanity checks? */
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
av_log(avctx, AV_LOG_ERROR, "extradata not set\n");
|
av_log(avctx, AV_LOG_ERROR, "extradata not set\n");
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ch_chunksize=charset_size/lifetime;
|
ch_chunksize=charset_size/lifetime;
|
||||||
/* TODO: check if charset/size is % lifetime, but maybe check in codec */
|
/* TODO: check if charset/size is % lifetime, but maybe check in codec */
|
||||||
|
|
||||||
if(pkt->data) num_frames = lifetime;
|
if(pkt->data) num_frames = lifetime;
|
||||||
else num_frames = c->prev_frame_count;
|
else num_frames = c->prev_frame_count;
|
||||||
|
|
||||||
for(i = 0; i < num_frames; i++) {
|
for(i = 0; i < num_frames; i++) {
|
||||||
if(pkt->data) {
|
if(pkt->data) {
|
||||||
/* if available, put newest charset chunk into buffer */
|
/* if available, put newest charset chunk into buffer */
|
||||||
put_buffer(s->pb, pkt->data + ch_chunksize * i, ch_chunksize);
|
put_buffer(s->pb, pkt->data + ch_chunksize * i, ch_chunksize);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* a bit ugly, but is there an alternative to put many zeros? */
|
/* a bit ugly, but is there an alternative to put many zeros? */
|
||||||
for(j = 0; j < ch_chunksize; j++) put_byte(s->pb, 0);
|
for(j = 0; j < ch_chunksize; j++) put_byte(s->pb, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(c->prev_pkt.data) {
|
if(c->prev_pkt.data) {
|
||||||
/* put frame (screen + colram) from last packet into buffer */
|
/* put frame (screen + colram) from last packet into buffer */
|
||||||
put_buffer(s->pb, c->prev_pkt.data + charset_size + frame_size * i, frame_size);
|
put_buffer(s->pb, c->prev_pkt.data + charset_size + frame_size * i, frame_size);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* a bit ugly, but is there an alternative to put many zeros? */
|
/* a bit ugly, but is there an alternative to put many zeros? */
|
||||||
for(j = 0; j < frame_size; j++) put_byte(s->pb, 0);
|
for(j = 0; j < frame_size; j++) put_byte(s->pb, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* backup current packet for next turn */
|
/* backup current packet for next turn */
|
||||||
if(pkt->data) {
|
if(pkt->data) {
|
||||||
/* no backup packet yet? create one! */
|
/* no backup packet yet? create one! */
|
||||||
@ -136,6 +138,7 @@ static int a64_write_packet(struct AVFormatContext *s, AVPacket *pkt)
|
|||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c->prev_frame_count = frame_count;
|
c->prev_frame_count = frame_count;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user