56 case MKTAG(
'U',
'L',
'H',
'0'):
61 case MKTAG(
'U',
'L',
'H',
'2'):
67 case MKTAG(
'U',
'L',
'Y',
'0'):
71 case MKTAG(
'U',
'L',
'Y',
'2'):
75 case MKTAG(
'U',
'L',
'R',
'G'):
79 case MKTAG(
'U',
'L',
'R',
'A'):
84 case MKTAG(
'U',
'Q',
'Y',
'2'):
91 "Not a Ut Video FOURCC: %X\n", avctx->
codec_tag);
98 if (format == UTVF_v210)
124 utv->
codec = CCodec::CreateInstance(UNFCC(avctx->
codec_tag),
"libavcodec");
131 if (begin_ret != 0) {
133 "Could not initialize decoder: %d\n", begin_ret);
158 pic->linesize[0] = w;
159 pic->linesize[1] = pic->linesize[2] = w / 2;
160 pic->data[0] = utv->
buffer;
161 pic->data[2] = utv->
buffer + (w *
h);
162 pic->data[1] = pic->data[2] + (w *
h / 4);
165 pic->linesize[0] = w * 2;
166 pic->data[0] = utv->
buffer;
171 int linesize = ((w + 47) / 48) * 128;
173 pic->linesize[0] = w * 2;
175 pic->linesize[2] = w;
176 pic->data[0] = utv->
buffer + linesize *
h;
177 pic->data[1] = pic->data[0] + h*pic->linesize[0];
178 pic->data[2] = pic->data[1] + h*pic->linesize[1];
179 y = (uint16_t*)pic->data[0];
180 u = (uint16_t*)pic->data[1];
181 v = (uint16_t*)pic->data[2];
182 for (j = 0; j <
h; j++) {
185 for (i = 0; i + 1 < w; i += 6, in += 4) {
191 *y++ = (a>>10) & 0x3FF;
192 *v++ = (a>>20) & 0x3FF;
200 *u++ = (b>>10) & 0x3FF;
201 *y++ = (b>>20) & 0x3FF;
203 *y++ = (a>>10) & 0x3FF;
210 *u++ = (a>>20) & 0x3FF;
212 *v++ = (b>>10) & 0x3FF;
213 *y++ = (b>>20) & 0x3FF;
241 utv->
codec->DecodeEnd();
242 CCodec::DeleteInstance(utv->
codec);
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
AVFrame * coded_frame
the picture in the bitstream
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
bitstream reader API header.
int interlaced_frame
The content of the picture is interlaced.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Libavcodec external API header.
int width
picture width / height.
Known FOURCCs: 'ULY0' (YCbCr 4:2:0), 'ULY2' (YCbCr 4:2:2), 'ULRG' (RGB), 'ULRA' (RGBA), 'ULH0' (YCbCr 4:2:0 BT.709), 'ULH2' (YCbCr 4:2:2 BT.709)
packed RGB 8:8:8, 24bpp, BGRBGR...
main external API structure.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
static av_cold int utvideo_decode_close(AVCodecContext *avctx)
enum AVColorSpace colorspace
YUV colorspace type.
#define AV_PIX_FMT_YUV422P10
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
int top_field_first
If the content is interlaced, is top field displayed first.
int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height)
Calculate the size in bytes that a picture of the given width and height would occupy if stored in th...
static av_cold int utvideo_decode_init(AVCodecContext *avctx)
AVCodec ff_libutvideo_decoder
static int utvideo_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define MKTAG(a, b, c, d)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
This structure stores compressed data.
#define UTVF_NFCC_BGRA_BU