---
libavcodec/cinepakenc.c | 38 +++++---------------------------------
1 file changed, 5 insertions(+), 33 deletions(-)
diff --git a/libavcodec/cinepakenc.c b/libavcodec/cinepakenc.c
index ddf560a..afa0c8e 100644
--- a/libavcodec/cinepakenc.c
+++ b/libavcodec/cinepakenc.c
@@ -308,8 +308,6 @@ static int64_t calculate_mode_score(CinepakEncContext *s,
int h, strip_info *inf
(info->v4_size ? CHUNK_HEADER_SIZE + info->v4_size *
entry_size : 0) +
CHUNK_HEADER_SIZE) << 3;
- //av_log(s->avctx, AV_LOG_INFO, "sizes %3i %3i -> %9lli score mb_count
%i", info->v1_size, info->v4_size, (long long int)ret, mb_count);
-
switch(info->mode) {
case MODE_V1_ONLY:
//one byte per MB
@@ -802,16 +800,11 @@ static int quantize(CinepakEncContext *s, int h,
i += v1mode ? 1 : 4;
}
}
-// if(i < mbn*(v1mode ? 1 : 4)) {
-// av_log(s->avctx, AV_LOG_INFO, "reducing training set for %s from %i
to %i (encoding %i)\n", v1mode?"v1":"v4", mbn*(v1mode ? 1 : 4), i, encoding);
-// }
if(i == 0) // empty training set, nothing to do
return 0;
- if(i < size) {
- //av_log(s->avctx, (CERTAIN(encoding) ? AV_LOG_ERROR : AV_LOG_INFO),
"WOULD WASTE: %s cbsize %i bigger than training set size %i (encoding %i)\n",
v1mode?"v1":"v4", size, i, encoding);
+ if (i < size)
size = i;
- }
ff_init_elbg(s->codebook_input, entry_size, i, codebook, size, 1,
s->codebook_closest, &s->randctx);
ff_do_elbg(s->codebook_input, entry_size, i, codebook, size, 1,
s->codebook_closest, &s->randctx);
@@ -860,8 +853,6 @@ static int quantize(CinepakEncContext *s, int h,
// check that we did it right in the beginning of the function
av_assert0(i >= size); // training set is no smaller than the codebook
- //av_log(s->avctx, AV_LOG_INFO, "isv1 %i size= %i i= %i error %lli\n",
v1mode, size, i, (long long int)total_error);
-
return size;
}
@@ -903,7 +894,6 @@ static void write_strip_header(CinepakEncContext *s, int y,
int h, int keyframe,
// AV_WB16(&buf[8], y+h); /* using absolute y values works -- rl */
AV_WB16(&buf[8], h); /* using relative values works as well -- rl */
AV_WB16(&buf[10], s->w);
- //av_log(s->avctx, AV_LOG_INFO, "write_strip_header() %x keyframe=%d\n",
buf[0], keyframe);
}
static int rd_strip(CinepakEncContext *s, int y, int h, int keyframe,
@@ -973,17 +963,13 @@ static int rd_strip(CinepakEncContext *s, int y, int h,
int keyframe,
// we assume we _may_ come here with more blocks to encode than before
info.v1_size = v1_size;
new_v1_size = quantize(s, h, data, linesize, 1, &info,
ENC_V1);
- if(new_v1_size < info.v1_size){
- //av_log(s->avctx, AV_LOG_INFO, "mode %i, %3i, %3i:
cut v1 codebook to %i entries\n", mode, v1_size, v4_size, new_v1_size);
+ if (new_v1_size < info.v1_size)
info.v1_size = new_v1_size;
- }
// we assume we _may_ come here with more blocks to encode than before
info.v4_size = v4_size;
new_v4_size = quantize(s, h, data, linesize, 0, &info,
ENC_V4);
- if(new_v4_size < info.v4_size) {
- //av_log(s->avctx, AV_LOG_INFO, "mode %i, %3i, %3i:
cut v4 codebook to %i entries at first iteration\n", mode, v1_size, v4_size,
new_v4_size);
+ if (new_v4_size < info.v4_size)
info.v4_size = new_v4_size;
- }
// calculate the resulting score
// (do not move blocks to codebook encodings now, as some blocks may have
// got bigger errors despite a smaller training set - but we do not
@@ -997,24 +983,18 @@ static int rd_strip(CinepakEncContext *s, int y, int h,
int keyframe,
if(v1shrunk) {
info.v1_size = v1_size;
new_v1_size = quantize(s, h, data, linesize, 1,
&info, ENC_V1);
- if(new_v1_size < info.v1_size){
- //av_log(s->avctx, AV_LOG_INFO, "mode %i, %3i,
%3i: cut v1 codebook to %i entries\n", mode, v1_size, v4_size, new_v1_size);
+ if (new_v1_size < info.v1_size)
info.v1_size = new_v1_size;
- }
}
if(v4shrunk) {
info.v4_size = v4_size;
new_v4_size = quantize(s, h, data, linesize, 0,
&info, ENC_V4);
- if(new_v4_size < info.v4_size) {
- //av_log(s->avctx, AV_LOG_INFO, "mode %i, %3i,
%3i: cut v4 codebook to %i entries\n", mode, v1_size, v4_size, new_v4_size);
+ if (new_v4_size < info.v4_size)
info.v4_size = new_v4_size;
- }
}
}
}
- //av_log(s->avctx, AV_LOG_INFO, "%3i %3i score = %lli\n",
v1_size, v4_size, (long long int)score);
-
if(best_size == 0 || score < *best_score) {
*best_score = score;
@@ -1022,10 +1002,6 @@ static int rd_strip(CinepakEncContext *s, int y, int h,
int keyframe,
scratch_data, scratch_linesize,
last_data, last_linesize, &info,
s->strip_buf + STRIP_HEADER_SIZE);
-
- //av_log(s->avctx, AV_LOG_INFO, "mode %i, %3i, %3i: %18lli
%i B", mode, info.v1_size, info.v4_size, (long long int)score, best_size);
- //av_log(s->avctx, AV_LOG_INFO, "\n");
-
write_strip_header(s, y, h, keyframe, s->strip_buf,
best_size);
}
@@ -1147,15 +1123,11 @@ static int rd_frame(CinepakEncContext *s, const AVFrame
*frame,
score += score_temp;
size += temp_size;
- //av_log(s->avctx, AV_LOG_INFO, "strip %d, isakeyframe=%d", strip,
isakeyframe);
- //av_log(s->avctx, AV_LOG_INFO, "\n");
}
if(best_score == 0 || score < best_score) {
best_score = score;
best_size = size + write_cvid_header(s, s->frame_buf, num_strips,
size, isakeyframe);
- //av_log(s->avctx, AV_LOG_INFO, "best number of strips so far:
%2i, %12lli, %i B\n", num_strips, (long long int)score, best_size);
-
FFSWAP(AVFrame *, s->best_frame, s->scratch_frame);
memcpy(buf, s->frame_buf, best_size);
best_nstrips = num_strips;
--
2.1.4
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel