Go to the documentation of this file.
29 #define BITSTREAM_READER_LE
45 2, -3, 8, -8, 18, -18, 36, -36,
49 1, -1, 2, -3, 8, -8, 18, -18, 36, -36, 54, -54, 96, -96, 144, -144,
62 uint8_t header_buffer[128] = { 0 };
63 const uint8_t *buf = avpkt->
data;
73 header_size = ((buf[0] >> 5) | (buf[0] << 3)) & 0x7f;
74 if (header_size < 10) {
79 if (header_size + 1 >
size) {
85 for (
i = 1;
i < header_size;
i++)
86 header_buffer[
i - 1] = buf[
i] ^ buf[
i + 1];
88 s->delta_size = header_buffer[1];
89 s->hscale = 1 + !!header_buffer[3];
90 if (
s->delta_size < 2 ||
s->delta_size > 4)
111 int x, y, delta_mode;
118 if ((avctx->
width +
s->hscale - 1)/
s->hscale * avctx->
height *
s->delta_size > avpkt->
size * 8LL * 4)
130 delta_mode =
s->delta_size - 2;
132 for (y = 0; y < avctx->
height; y++) {
134 for (x = 0; x < avctx->
width; x +=
s->hscale) {
143 for (y = 0; y < avctx->
height; y++) {
144 for (x = 1; x < avctx->
width; x +=
s->hscale)
151 for (y = 0; y < avctx->
height; y++) {
152 for (x = 0; x < avctx->
width; x++)
158 for (y = 0; y < avctx->
height >> 2; y++) {
160 for (x = 0; x < avctx->
width >> 2; x +=
s->hscale) {
169 for (y = 0; y < avctx->
height >> 2; y++) {
170 for (x = 1; x < avctx->
width >> 2; x +=
s->hscale)
177 for (y = 0; y < avctx->
height >> 2; y++) {
178 for (x = 0; x < avctx->
width >> 2; x++)
179 dst[x] += (dst[x] - 128) / 8;
184 for (y = 0; y < avctx->
height >> 2; y++) {
186 for (x = 0; x < avctx->
width >> 2; x +=
s->hscale) {
195 for (y = 0; y < avctx->
height >> 2; y++) {
196 for (x = 1; x < avctx->
width >> 2; x +=
s->hscale)
203 for (y = 0; y < avctx->
height >> 2; y++) {
204 for (x = 0; x < avctx->
width >> 2; x++)
205 dst[x] += (dst[x] - 128) / 8;
223 .
name =
"truemotion2rt",
@ AV_CODEC_ID_TRUEMOTION2RT
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
This structure describes decoded (raw) audio or video data.
static const int16_t *const delta_tabs[]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
const AVCodec ff_truemotion2rt_decoder
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static const int16_t delta_tab2[]
int key_frame
1 -> keyframe, 0-> not
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
static const int16_t delta_tab4[]
@ AV_PICTURE_TYPE_I
Intra.
enum AVPictureType pict_type
Picture type of the frame.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static const int16_t delta_tab3[]
#define i(width, name, range_min, range_max)
static int truemotion2rt_decode_header(AVCodecContext *avctx, const AVPacket *avpkt)
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
main external API structure.
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
static av_always_inline int diff(const uint32_t a, const uint32_t b)
static int truemotion2rt_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
This structure stores compressed data.
int width
picture width / height.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static av_cold int truemotion2rt_decode_init(AVCodecContext *avctx)