39 const AVFrame *p,
int *got_packet)
42 const uint16_t
flip = (1 << 15);
43 uint64_t data_size = 0, padded_data_size = 0;
44 int ret, bitpix, naxis3 = 1,
i, j, k, bytes_left;
45 int map[] = {2, 0, 1, 3};
80 data_size = (bitpix >> 3) * avctx->
height * avctx->
width * naxis3;
81 padded_data_size = ((data_size + 2879) / 2880 ) * 2880;
86 bytestream =
pkt->data;
88 for (k = 0; k < naxis3; k++) {
90 const uint8_t *ptr = p->data[
map[k]] + (avctx->
height -
i - 1) * p->linesize[
map[k]];
92 for (j = 0; j < avctx->
width; j++) {
94 bytestream_put_be16(&bytestream,
AV_RB16(ptr) ^
flip);
98 memcpy(bytestream, ptr, avctx->
width);
99 bytestream += avctx->
width;
104 bytes_left = padded_data_size - data_size;
105 memset(bytestream, 0, bytes_left);
const FFCodec ff_fits_encoder
Libavcodec external API header.
#define i(width, name, range_min, range_max)
#define CODEC_PIXFMTS(...)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const VDPAUPixFmtMap * map
static int fits_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *p, int *got_packet)
static void flip(AVCodecContext *avctx, AVFrame *frame)
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
@ AV_PIX_FMT_GBRP16BE
planar GBR 4:4:4 48bpp, big-endian
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.