Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: source/patched-ffmpeg-mt/libavcodec/imgconvert.c

Issue 3384002: ffmpeg source update for sep 09 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Misc image conversion routines 2 * Misc image conversion routines
3 * Copyright (c) 2001, 2002, 2003 Fabrice Bellard 3 * Copyright (c) 2001, 2002, 2003 Fabrice Bellard
4 * 4 *
5 * This file is part of FFmpeg. 5 * This file is part of FFmpeg.
6 * 6 *
7 * FFmpeg is free software; you can redistribute it and/or 7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version. 10 * version 2.1 of the License, or (at your option) any later version.
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 } 494 }
495 pal[i] = b + (g<<8) + (r<<16); 495 pal[i] = b + (g<<8) + (r<<16);
496 } 496 }
497 497
498 return 0; 498 return 0;
499 } 499 }
500 500
501 #if LIBAVCODEC_VERSION_MAJOR < 53 501 #if LIBAVCODEC_VERSION_MAJOR < 53
502 int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width) 502 int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width)
503 { 503 {
504 return av_fill_image_linesizes(picture->linesize, pix_fmt, width); 504 return av_image_fill_linesizes(picture->linesize, pix_fmt, width);
505 } 505 }
506 506
507 int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt, 507 int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt,
508 int height) 508 int height)
509 { 509 {
510 return av_fill_image_pointers(picture->data, pix_fmt, height, ptr, picture-> linesize); 510 return av_image_fill_pointers(picture->data, pix_fmt, height, ptr, picture-> linesize);
511 } 511 }
512 #endif 512 #endif
513 513
514 int avpicture_fill(AVPicture *picture, uint8_t *ptr, 514 int avpicture_fill(AVPicture *picture, uint8_t *ptr,
515 enum PixelFormat pix_fmt, int width, int height) 515 enum PixelFormat pix_fmt, int width, int height)
516 { 516 {
517 517
518 if(av_check_image_size(width, height, 0, NULL)) 518 if(av_image_check_size(width, height, 0, NULL))
519 return -1; 519 return -1;
520 520
521 if (av_fill_image_linesizes(picture->linesize, pix_fmt, width)) 521 if (av_image_fill_linesizes(picture->linesize, pix_fmt, width))
522 return -1; 522 return -1;
523 523
524 return av_fill_image_pointers(picture->data, pix_fmt, height, ptr, picture-> linesize); 524 return av_image_fill_pointers(picture->data, pix_fmt, height, ptr, picture-> linesize);
525 } 525 }
526 526
527 int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height, 527 int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height,
528 unsigned char *dest, int dest_size) 528 unsigned char *dest, int dest_size)
529 { 529 {
530 const PixFmtInfo* pf = &pix_fmt_info[pix_fmt]; 530 const PixFmtInfo* pf = &pix_fmt_info[pix_fmt];
531 const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; 531 const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
532 int i, j, w, ow, h, oh, data_planes; 532 int i, j, w, ow, h, oh, data_planes;
533 const unsigned char* s; 533 const unsigned char* s;
534 int size = avpicture_get_size(pix_fmt, width, height); 534 int size = avpicture_get_size(pix_fmt, width, height);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 590
591 if (pf->pixel_type == FF_PIXEL_PALETTE) 591 if (pf->pixel_type == FF_PIXEL_PALETTE)
592 memcpy((unsigned char *)(((size_t)dest + 3) & ~3), src->data[1], 256 * 4 ); 592 memcpy((unsigned char *)(((size_t)dest + 3) & ~3), src->data[1], 256 * 4 );
593 593
594 return size; 594 return size;
595 } 595 }
596 596
597 int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height) 597 int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height)
598 { 598 {
599 AVPicture dummy_pict; 599 AVPicture dummy_pict;
600 if(av_check_image_size(width, height, 0, NULL)) 600 if(av_image_check_size(width, height, 0, NULL))
601 return -1; 601 return -1;
602 switch (pix_fmt) { 602 switch (pix_fmt) {
603 case PIX_FMT_RGB8: 603 case PIX_FMT_RGB8:
604 case PIX_FMT_BGR8: 604 case PIX_FMT_BGR8:
605 case PIX_FMT_RGB4_BYTE: 605 case PIX_FMT_RGB4_BYTE:
606 case PIX_FMT_BGR4_BYTE: 606 case PIX_FMT_BGR4_BYTE:
607 case PIX_FMT_GRAY8: 607 case PIX_FMT_GRAY8:
608 // do not include palette for these pseudo-paletted formats 608 // do not include palette for these pseudo-paletted formats
609 return width * height; 609 return width * height;
610 } 610 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 if (loss_mask == 0) 774 if (loss_mask == 0)
775 break; 775 break;
776 } 776 }
777 return PIX_FMT_NONE; 777 return PIX_FMT_NONE;
778 found: 778 found:
779 if (loss_ptr) 779 if (loss_ptr)
780 *loss_ptr = avcodec_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha ); 780 *loss_ptr = avcodec_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha );
781 return dst_pix_fmt; 781 return dst_pix_fmt;
782 } 782 }
783 783
784 #if LIBAVCODEC_VERSION_MAJOR < 53
784 void ff_img_copy_plane(uint8_t *dst, int dst_wrap, 785 void ff_img_copy_plane(uint8_t *dst, int dst_wrap,
785 const uint8_t *src, int src_wrap, 786 const uint8_t *src, int src_wrap,
786 int width, int height) 787 int width, int height)
787 { 788 {
788 if((!dst) || (!src)) 789 av_image_copy_plane(dst, dst_wrap, src, src_wrap, width, height);
789 return;
790 for(;height > 0; height--) {
791 memcpy(dst, src, width);
792 dst += dst_wrap;
793 src += src_wrap;
794 }
795 } 790 }
796 791
797 int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane) 792 int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane)
798 { 793 {
799 int bits; 794 return av_image_get_linesize(pix_fmt, width, plane);
800 const PixFmtInfo *pf = &pix_fmt_info[pix_fmt]; 795 }
801 const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
802 796
803 pf = &pix_fmt_info[pix_fmt]; 797 void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4],
804 switch(pf->pixel_type) { 798 uint8_t *src_data[4], int src_linesize[4],
805 case FF_PIXEL_PACKED: 799 enum PixelFormat pix_fmt, int width, int height)
806 switch(pix_fmt) { 800 {
807 case PIX_FMT_YUYV422: 801 av_image_copy(dst_data, dst_linesize, src_data, src_linesize,
808 case PIX_FMT_UYVY422: 802 pix_fmt, width, height);
809 case PIX_FMT_RGB565BE:
810 case PIX_FMT_RGB565LE:
811 case PIX_FMT_RGB555BE:
812 case PIX_FMT_RGB555LE:
813 case PIX_FMT_RGB444BE:
814 case PIX_FMT_RGB444LE:
815 case PIX_FMT_BGR565BE:
816 case PIX_FMT_BGR565LE:
817 case PIX_FMT_BGR555BE:
818 case PIX_FMT_BGR555LE:
819 case PIX_FMT_BGR444BE:
820 case PIX_FMT_BGR444LE:
821 bits = 16;
822 break;
823 case PIX_FMT_UYYVYY411:
824 bits = 12;
825 break;
826 default:
827 bits = pf->depth * pf->nb_channels;
828 break;
829 }
830 return (width * bits + 7) >> 3;
831 break;
832 case FF_PIXEL_PLANAR:
833 if ((pix_fmt != PIX_FMT_NV12 && pix_fmt != PIX_FMT_NV21) &&
834 (plane == 1 || plane == 2))
835 width= -((-width)>>desc->log2_chroma_w);
836
837 return (width * pf->depth + 7) >> 3;
838 break;
839 case FF_PIXEL_PALETTE:
840 if (plane == 0)
841 return width;
842 break;
843 }
844
845 return -1;
846 } 803 }
804 #endif
847 805
848 void av_picture_copy(AVPicture *dst, const AVPicture *src, 806 void av_picture_copy(AVPicture *dst, const AVPicture *src,
849 enum PixelFormat pix_fmt, int width, int height) 807 enum PixelFormat pix_fmt, int width, int height)
850 { 808 {
851 int i; 809 av_image_copy(dst->data, dst->linesize, src->data,
852 const PixFmtInfo *pf = &pix_fmt_info[pix_fmt]; 810 src->linesize, pix_fmt, width, height);
853 const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
854
855 switch(pf->pixel_type) {
856 case FF_PIXEL_PACKED:
857 case FF_PIXEL_PLANAR:
858 for(i = 0; i < pf->nb_channels; i++) {
859 int h;
860 int bwidth = ff_get_plane_bytewidth(pix_fmt, width, i);
861 h = height;
862 if (i == 1 || i == 2) {
863 h= -((-height)>>desc->log2_chroma_h);
864 }
865 ff_img_copy_plane(dst->data[i], dst->linesize[i],
866 src->data[i], src->linesize[i],
867 bwidth, h);
868 }
869 break;
870 case FF_PIXEL_PALETTE:
871 ff_img_copy_plane(dst->data[0], dst->linesize[0],
872 src->data[0], src->linesize[0],
873 width, height);
874 /* copy the palette */
875 memcpy(dst->data[1], src->data[1], 4*256);
876 break;
877 }
878 } 811 }
879 812
880 /* 2x2 -> 1x1 */ 813 /* 2x2 -> 1x1 */
881 void ff_shrink22(uint8_t *dst, int dst_wrap, 814 void ff_shrink22(uint8_t *dst, int dst_wrap,
882 const uint8_t *src, int src_wrap, 815 const uint8_t *src, int src_wrap,
883 int width, int height) 816 int width, int height)
884 { 817 {
885 int w; 818 int w;
886 const uint8_t *s1, *s2; 819 const uint8_t *s1, *s2;
887 uint8_t *d; 820 uint8_t *d;
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 } else { 1209 } else {
1277 deinterlace_bottom_field(dst->data[i],dst->linesize[i], 1210 deinterlace_bottom_field(dst->data[i],dst->linesize[i],
1278 src->data[i], src->linesize[i], 1211 src->data[i], src->linesize[i],
1279 width, height); 1212 width, height);
1280 } 1213 }
1281 } 1214 }
1282 emms_c(); 1215 emms_c();
1283 return 0; 1216 return 0;
1284 } 1217 }
1285 1218
OLDNEW
« no previous file with comments | « source/patched-ffmpeg-mt/libavcodec/imgconvert.h ('k') | source/patched-ffmpeg-mt/libavcodec/indeo3.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698