[FFmpeg-devel] [PATCH] avcodec/sheervideo: Hack to extract init_vlc style tables for RGB [not to be pushed]
Michael Niedermayer
michael at niedermayer.cc
Mon Jun 6 16:40:24 CEST 2016
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/sheervideo.c | 33 +++++++++++++++++++++++++++------
1 file changed, 27 insertions(+), 6 deletions(-)
diff --git a/libavcodec/sheervideo.c b/libavcodec/sheervideo.c
index e41645e..88fb174 100644
--- a/libavcodec/sheervideo.c
+++ b/libavcodec/sheervideo.c
@@ -1029,14 +1029,15 @@ static int decode_frame(AVCodecContext *avctx,
unsigned format;
int ret;
- if (avpkt->size <= 20)
- return AVERROR_INVALIDDATA;
-
- if (AV_RL32(avpkt->data) != MKTAG('S','h','i','r'))
- return AVERROR_INVALIDDATA;
+// if (avpkt->size <= 20)
+// return AVERROR_INVALIDDATA;
+//
+// if (AV_RL32(avpkt->data) != MKTAG('S','h','i','r'))
+// return AVERROR_INVALIDDATA;
format = AV_RL32(avpkt->data + 16);
switch (format) {
+ default:
case MKTAG(' ', 'R', 'G', 'B'):
avctx->pix_fmt = AV_PIX_FMT_RGB0;
s->lut_l[0] = (uint8_t *)&lut_r;
@@ -1059,11 +1060,31 @@ static int decode_frame(AVCodecContext *avctx,
s->lut_s[3] = (uint8_t *)&lut_sbg;
s->decode_frame = decode_argb;
break;
- default:
+
avpriv_report_missing_feature(avctx, "unsupported format: 0x%X", format);
return AVERROR_PATCHWELCOME;
}
+ for(int table=0; table < 3; table++) {
+ uint8_t array[32];
+ uint64_t index=0;
+ int code, len;
+ av_log(0,0, "Table %d\n", table);
+ for(;;) {
+ AV_WB64(array, index);
+ if ((ret = init_get_bits8(&gb, array, sizeof(array))) < 0)
+ return ret;
+ code = get_vlc3(&gb, s->lut_l[table], s->lut_s[table]) & 0xFF;
+ len = get_bits_count(&gb);
+ av_log(0,0, "code: %5d, len:%2d, bits:%8LX\n", code, len, index >> (64 - len));
+ index += 1ULL << (64-len);
+ if(!index)
+ break;
+ }
+ }
+ exit(0);
+
+
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
--
1.7.9.5
More information about the ffmpeg-devel
mailing list