45 #define BITMAPINFOHEADER_SIZE 0x28 46 #define TDSF_HEADER_SIZE 0x56 47 #define TDSB_HEADER_SIZE 0x08 141 #define APPLY_ALPHA(src, new, alpha) \ 142 src = (src * (256 - alpha) + new * alpha) >> 8 158 if (x + w > ctx->
width)
177 for (j = 0; j <
h; j++) {
178 for (i = 0; i <
w; i++) {
180 APPLY_ALPHA(dst[i * 3 + 0], cursor[i * 4 + 1], alpha);
181 APPLY_ALPHA(dst[i * 3 + 1], cursor[i * 4 + 2], alpha);
182 APPLY_ALPHA(dst[i * 3 + 2], cursor[i * 4 + 3], alpha);
193 int i, j, k,
ret, cursor_fmt;
202 cursor_fmt = bytestream2_get_le32(&ctx->
gbc);
206 "Invalid cursor position (%d.%d outside %dx%d).\n",
213 "Invalid cursor dimensions %dx%d.\n",
233 switch (cursor_fmt) {
235 for (j = 0; j < ctx->
cursor_h; j++) {
236 for (i = 0; i < ctx->
cursor_w; i += 32) {
237 uint32_t
bits = bytestream2_get_be32(&ctx->
gbc);
238 for (k = 0; k < 32; k++) {
239 dst[0] = !!(bits & 0x80000000);
248 for (j = 0; j < ctx->
cursor_h; j++) {
249 for (i = 0; i < ctx->
cursor_w; i += 32) {
250 uint32_t
bits = bytestream2_get_be32(&ctx->
gbc);
251 for (k = 0; k < 32; k++) {
252 int mask_bit = !!(bits & 0x80000000);
253 switch (dst[0] * 2 + mask_bit) {
284 if (cursor_fmt & 8) {
285 for (j = 0; j < ctx->
cursor_h; j++) {
286 for (i = 0; i < ctx->
cursor_w; i++) {
287 int val = bytestream2_get_be32(&ctx->
gbc);
296 for (j = 0; j < ctx->
cursor_h; j++) {
297 for (i = 0; i < ctx->
cursor_w; i++) {
298 int val = bytestream2_get_be32(&ctx->
gbc);
320 out[1] =
av_clip_uint8(Y + (-22554 * U - 46802 * V + 32768 >> 16));
326 const uint8_t *srcy,
int srcy_stride,
331 for (line = 0; line <
height; line++) {
332 for (col = 0; col <
width; col++)
334 srcu[col >> 1] - 128, srcv[col >> 1] - 128);
338 srcu += srcuv_stride * (line & 1);
339 srcv += srcuv_stride * (line & 1);
345 int x,
int y,
int w,
int h)
364 "JPEG decoding error (%d).\n", ret);
392 for (i = 0; i < number_tiles; i++) {
395 int x, y, x2, y2,
w,
h;
399 bytestream2_get_le32(&ctx->
gbc) !=
MKTAG(
'T',
'D',
'S',
'B') ||
405 tile_size = bytestream2_get_le32(&ctx->
gbc);
409 tile_mode = bytestream2_get_le32(&ctx->
gbc);
411 x = bytestream2_get_le32(&ctx->
gbc);
412 y = bytestream2_get_le32(&ctx->
gbc);
413 x2 = bytestream2_get_le32(&ctx->
gbc);
414 y2 = bytestream2_get_le32(&ctx->
gbc);
416 if (x < 0 || y < 0 || x2 <= x || y2 <= y ||
420 "Invalid tile position (%d.%d %d.%d outside %dx%d).\n",
433 if (tile_mode ==
MKTAG(
'G',
'E',
'P',
'J')) {
438 }
else if (tile_mode ==
MKTAG(
' ',
'W',
'A',
'R')) {
465 w = bytestream2_get_le32(&ctx->
gbc);
466 h = -bytestream2_get_le32(&ctx->
gbc);
468 if (bytestream2_get_le16(&ctx->
gbc) != 1 ||
469 bytestream2_get_le16(&ctx->
gbc) != 24)
501 int action = bytestream2_get_le32(&ctx->
gbc);
505 if (action == 2 || action == 3) {
529 int ret, tag_header, keyframe = 0;
562 tag_header = bytestream2_get_le32(&ctx->
gbc);
564 if (tag_header ==
MKTAG(
'T',
'D',
'S',
'F')) {
571 number_tiles = bytestream2_get_le32(&ctx->
gbc);
574 keyframe = bytestream2_get_le32(&ctx->
gbc) == 0x30;
582 tag_header = bytestream2_get_le32(&ctx->
gbc);
586 if (tag_header ==
MKTAG(
'D',
'T',
'S',
'M')) {
588 int tag_size = bytestream2_get_le32(&ctx->
gbc);
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int tdsc_decode_tiles(AVCodecContext *avctx, int number_tiles)
This structure describes decoded (raw) audio or video data.
int dct_algo
DCT algorithm, see FF_DCT_* below.
ptrdiff_t const GLvoid * data
#define AV_LOG_WARNING
Something somehow does not look correct.
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.
#define avpriv_request_sample(...)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static av_cold int tdsc_init(AVCodecContext *avctx)
AVCodecContext * jpeg_avctx
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define BITMAPINFOHEADER_SIZE
static int tdsc_parse_dtsm(AVCodecContext *avctx)
static av_always_inline void tdsc_blit(uint8_t *dst, int dst_stride, const uint8_t *srcy, int srcy_stride, const uint8_t *srcu, const uint8_t *srcv, int srcuv_stride, int width, int height)
static av_cold int tdsc_close(AVCodecContext *avctx)
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
static int tdsc_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Return decoded output data from a decoder.
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int flags
AV_CODEC_FLAG_*.
const char * name
Name of the codec implementation.
static int tdsc_parse_tdsf(AVCodecContext *avctx, int number_tiles)
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
enum AVPictureType pict_type
Picture type of the frame.
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
int width
picture width / height.
int idct_algo
IDCT algorithm, see FF_IDCT_* below.
static int tdsc_decode_jpeg_tile(AVCodecContext *avctx, int tile_size, int x, int y, int w, int h)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
#define AV_EF_EXPLODE
abort decoding on minor error detection
packed RGB 8:8:8, 24bpp, BGRBGR...
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
static void tdsc_paint_cursor(AVCodecContext *avctx, uint8_t *dst, int stride)
Libavcodec external API header.
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer...
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
static const int16_t alpha[]
main external API structure.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
GLint GLenum GLboolean GLsizei stride
The official guide to swscale for confused that consecutive non overlapping rectangles of slice_bottom special converter These generally are unscaled converters of common like for each output line the vertical scaler pulls lines from a ring buffer When the ring buffer does not contain the wanted line
common internal api header.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
int key_frame
1 -> keyframe, 0-> not
#define APPLY_ALPHA(src, new, alpha)
static void tdsc_yuv2rgb(uint8_t *out, int Y, int U, int V)
int flags2
AV_CODEC_FLAG2_*.
static int tdsc_load_cursor(AVCodecContext *avctx)
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
#define MKTAG(a, b, c, d)
static double val(void *priv, double ch)
This structure stores compressed data.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators...