Mercurial > libavcodec.hg
comparison utils.c @ 988:001b7d3045e5 libavcodec
moved avcodec_get_chroma_sub_sample() to imgconvert.c
author | bellard |
---|---|
date | Sat, 11 Jan 2003 00:07:06 +0000 |
parents | 1936a177d482 |
children | b9ca09e5c9ad |
comparison
equal
deleted
inserted
replaced
987:295ec9bebf93 | 988:001b7d3045e5 |
---|---|
87 while (*p != NULL) p = &(*p)->next; | 87 while (*p != NULL) p = &(*p)->next; |
88 *p = format; | 88 *p = format; |
89 format->next = NULL; | 89 format->next = NULL; |
90 } | 90 } |
91 | 91 |
92 void avcodec_get_chroma_sub_sample(int fmt, int *h_shift, int *v_shift){ | |
93 switch(fmt){ | |
94 case PIX_FMT_YUV410P: | |
95 *h_shift=2; | |
96 *v_shift=2; | |
97 break; | |
98 case PIX_FMT_YUV420P: | |
99 *h_shift=1; | |
100 *v_shift=1; | |
101 break; | |
102 case PIX_FMT_YUV411P: | |
103 *h_shift=2; | |
104 *v_shift=0; | |
105 break; | |
106 case PIX_FMT_YUV422P: | |
107 case PIX_FMT_YUV422: | |
108 *h_shift=1; | |
109 *v_shift=0; | |
110 break; | |
111 default: //RGB/... | |
112 *h_shift=0; | |
113 *v_shift=0; | |
114 break; | |
115 } | |
116 } | |
117 | |
118 typedef struct DefaultPicOpaque{ | 92 typedef struct DefaultPicOpaque{ |
119 int last_pic_num; | 93 int last_pic_num; |
120 uint8_t *data[4]; | 94 uint8_t *data[4]; |
121 }DefaultPicOpaque; | 95 }DefaultPicOpaque; |
122 | 96 |
150 break; | 124 break; |
151 case PIX_FMT_RGB24: | 125 case PIX_FMT_RGB24: |
152 case PIX_FMT_BGR24: | 126 case PIX_FMT_BGR24: |
153 pixel_size=3; | 127 pixel_size=3; |
154 break; | 128 break; |
155 case PIX_FMT_BGRA32: | |
156 case PIX_FMT_RGBA32: | 129 case PIX_FMT_RGBA32: |
157 pixel_size=4; | 130 pixel_size=4; |
158 break; | 131 break; |
159 default: | 132 default: |
160 pixel_size=1; | 133 pixel_size=1; |
460 "Video: %s%s", | 433 "Video: %s%s", |
461 codec_name, enc->flags & CODEC_FLAG_HQ ? " (hq)" : ""); | 434 codec_name, enc->flags & CODEC_FLAG_HQ ? " (hq)" : ""); |
462 if (enc->codec_id == CODEC_ID_RAWVIDEO) { | 435 if (enc->codec_id == CODEC_ID_RAWVIDEO) { |
463 snprintf(buf + strlen(buf), buf_size - strlen(buf), | 436 snprintf(buf + strlen(buf), buf_size - strlen(buf), |
464 ", %s", | 437 ", %s", |
465 pix_fmt_str[enc->pix_fmt]); | 438 avcodec_get_pix_fmt_name(enc->pix_fmt)); |
466 } | 439 } |
467 if (enc->width) { | 440 if (enc->width) { |
468 snprintf(buf + strlen(buf), buf_size - strlen(buf), | 441 snprintf(buf + strlen(buf), buf_size - strlen(buf), |
469 ", %dx%d, %0.2f fps", | 442 ", %dx%d, %0.2f fps", |
470 enc->width, enc->height, | 443 enc->width, enc->height, |
575 picture->data[1] = NULL; | 548 picture->data[1] = NULL; |
576 picture->data[2] = NULL; | 549 picture->data[2] = NULL; |
577 picture->linesize[0] = width * 3; | 550 picture->linesize[0] = width * 3; |
578 break; | 551 break; |
579 case PIX_FMT_RGBA32: | 552 case PIX_FMT_RGBA32: |
580 case PIX_FMT_BGRA32: | |
581 picture->data[0] = ptr; | 553 picture->data[0] = ptr; |
582 picture->data[1] = NULL; | 554 picture->data[1] = NULL; |
583 picture->data[2] = NULL; | 555 picture->data[2] = NULL; |
584 picture->linesize[0] = width * 4; | 556 picture->linesize[0] = width * 4; |
585 break; | 557 break; |
615 case PIX_FMT_RGB24: | 587 case PIX_FMT_RGB24: |
616 case PIX_FMT_BGR24: | 588 case PIX_FMT_BGR24: |
617 size = (size * 3); | 589 size = (size * 3); |
618 break; | 590 break; |
619 case PIX_FMT_RGBA32: | 591 case PIX_FMT_RGBA32: |
620 case PIX_FMT_BGRA32: | |
621 size = (size * 4); | 592 size = (size * 4); |
622 break; | 593 break; |
623 case PIX_FMT_YUV422: | 594 case PIX_FMT_YUV422: |
624 size = (size * 2); | 595 size = (size * 2); |
625 break; | 596 break; |