29 if (avctx->
width & 1) {
52 int buf_size,
void *
data)
55 int aligned_width = ((avctx->
width + 47) / 48) * 48;
56 int stride = aligned_width * 8 / 3;
58 const uint16_t *y = (
const uint16_t*)pic->
data[0];
59 const uint16_t *u = (
const uint16_t*)pic->
data[1];
60 const uint16_t *
v = (
const uint16_t*)pic->
data[2];
64 if (buf_size < aligned_width * avctx->
height * 8 / 3) {
69 #define CLIP(v) av_clip(v, 4, 1019)
71 #define WRITE_PIXELS(a, b, c) \
74 val |= (CLIP(*b++) << 10) | \
76 bytestream_put_le32(&p, val); \
79 for (h = 0; h < avctx->
height; h++) {
81 for (w = 0; w < avctx->
width - 5; w += 6) {
87 if (w < avctx->
width - 1) {
91 if (w == avctx->
width - 2)
92 bytestream_put_le32(&p, val);
94 if (w < avctx->
width - 3) {
95 val |= (
CLIP(*u++) << 10) | (
CLIP(*y++) << 20);
96 bytestream_put_le32(&p, val);
98 val =
CLIP(*v++) | (
CLIP(*y++) << 10);
99 bytestream_put_le32(&p, val);
103 memset(p, 0, pdst - p);
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
AVFrame * coded_frame
the picture in the bitstream
#define AV_LOG_WARNING
Something somehow does not look correct.
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
#define WRITE_PIXELS(a, b, c)
static av_cold int encode_init(AVCodecContext *avctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
AVFrame * avcodec_alloc_frame(void)
Allocate an AVFrame and set its fields to default values.
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
int width
picture width / height.
static av_cold int encode_close(AVCodecContext *avctx)
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
#define PIX_FMT_YUV422P10
main external API structure.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data)
int key_frame
1 -> keyframe, 0-> not