~ubuntu-branches/ubuntu/hardy/avidemux/hardy

« back to all changes in this revision

Viewing changes to avidemux/ADM_videoFilter/ADM_vidFlipV.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Matvey Kozhev
  • Date: 2007-12-18 13:53:04 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20071218135304-cdqec2lg2bglyz15
Tags: 1:2.4~preview3-0.0ubuntu1
* Upload to Ubuntu. (LP: #163287, LP: #126572)
* debian/changelog: re-added Ubuntu releases.
* debian/control:
  - Require debhelper >= 5.0.51 (for dh_icons) and imagemagick.
  - Build-depend on libsdl1.2-dev instead of libsdl-dev.
  - Build against newer libx264-dev. (LP: #138854)
  - Removed libamrnb-dev, not in Ubuntu yet.
* debian/rules:
  - Install all icon sizes, using convert (upstream installs none).
  - Added missing calls to dh_installmenu, dh_installman, dh_icons and
    dh_desktop.
* debian/menu, debian/avidemux-qt.menu:
  - Corrected package and executable names.
* debian/avidemux-common.install: Install icons.
* debian/avidemux.common.manpages: Install man/avidemux.1.
* debian/links, debian/avidemux-cli.links, debian/avidemux-gtk.links:
  - Link manpages to avidemux.1.gz.
* debian/install, debian/avidemux-qt.install, debian/avidemux-gtk.desktop,
  debian/avidemux-qt.desktop: Install desktop files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          ADM_vidFlipV.cpp  -  description
 
3
                             -------------------
 
4
    begin                : Wed Nov 6 2002
 
5
    copyright            : (C) 2002 by mean
 
6
    email                : fixounet@free.fr
 
7
 ***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *                                                                         *
 
11
 *   This program is free software; you can redistribute it and/or modify  *
 
12
 *   it under the terms of the GNU General Public License as published by  *
 
13
 *   the Free Software Foundation; either version 2 of the License, or     *
 
14
 *   (at your option) any later version.                                   *
 
15
 *                                                                         *
 
16
 ***************************************************************************/
 
17
 
 
18
 #include <stdio.h>
 
19
#include <stdlib.h>
 
20
#include <string.h>
 
21
#include <ADM_assert.h>
 
22
 
 
23
#include "config.h"
 
24
#include "fourcc.h"
 
25
#include "avio.hxx"
 
26
#include "config.h"
 
27
#include "avi_vars.h"
 
28
#ifdef HAVE_ENCODER
 
29
 
 
30
 
 
31
#include "ADM_toolkit/toolkit.hxx"
 
32
#include "ADM_editor/ADM_edit.hxx"
 
33
#include "ADM_video/ADM_genvideo.hxx"
 
34
#include "ADM_vidFlipV.h"
 
35
#include "ADM_filter/video_filters.h"
 
36
 
 
37
 
 
38
static FILTER_PARAM flipParam={0,{""}};
 
39
 
 
40
 
 
41
SCRIPT_CREATE(flipv_script,ADMVideoFlipV,flipParam);
 
42
BUILD_CREATE(flipv_create,ADMVideoFlipV);
 
43
 
 
44
 
 
45
char *ADMVideoFlipV::printConf( void )
 
46
{
 
47
        static char buf[50];
 
48
        
 
49
        sprintf((char *)buf," V-Flip");
 
50
        return buf;
 
51
}
 
52
 
 
53
ADMVideoFlipV::ADMVideoFlipV(  AVDMGenericVideoStream *in,CONFcouple *setup)
 
54
{
 
55
    UNUSED_ARG(setup);
 
56
        _in=in;         
 
57
        memcpy(&_info,_in->getInfo(),sizeof(_info));    
 
58
        _info.encoding=1;       
 
59
        _uncompressed=new ADMImage(_in->getInfo()->width,_in->getInfo()->height);
 
60
        ADM_assert(_uncompressed);              
 
61
}
 
62
ADMVideoFlipV::~ADMVideoFlipV()
 
63
{
 
64
        delete  _uncompressed;  
 
65
        _uncompressed=NULL;
 
66
  
 
67
}
 
68
uint8_t ADMVideoFlipV::getFrameNumberNoAlloc(uint32_t frame,
 
69
                                uint32_t *len,
 
70
                                ADMImage *data,
 
71
                                uint32_t *flags)
 
72
{
 
73
 
 
74
        if(frame>= _info.nb_frames) return 0;
 
75
        // read uncompressed frame
 
76
        if(!_in->getFrameNumberNoAlloc(frame, len,_uncompressed,flags)) return 0;
 
77
 
 
78
         uint8_t *in,*out;
 
79
         uint32_t stride=_info.width;
 
80
         uint32_t h=_info.height;
 
81
         uint32_t page,qpage;
 
82
        
 
83
 
 
84
          
 
85
         page=stride*h;
 
86
         qpage=page>>2;
 
87
         
 
88
         in=YPLANE(_uncompressed);
 
89
         out=YPLANE(data)+(h-1)*stride;
 
90
         // flip y
 
91
         for(uint32_t y=h;y>0;y--)
 
92
         {
 
93
                 memcpy(out,in,stride);
 
94
                 in+=stride;
 
95
                 out-=stride;
 
96
        }
 
97
        // Flip U & V                            
 
98
        stride>>=1;
 
99
        in=UPLANE(_uncompressed);       
 
100
        out=UPLANE(data)+qpage-stride;
 
101
         // flip u
 
102
         for(uint32_t y=h>>1;y>0;y--)
 
103
         {
 
104
                 memcpy(out,in,stride);
 
105
                 in+=stride;
 
106
                 out-=stride;
 
107
        }
 
108
        in=VPLANE(_uncompressed);
 
109
        out=VPLANE(data)+qpage-stride;
 
110
       
 
111
      
 
112
         // flip u
 
113
         for(uint32_t y=h>>1;y>0;y--)
 
114
         {
 
115
                 memcpy(out,in,stride);
 
116
                 in+=stride;
 
117
                 out-=stride;
 
118
        }   
 
119
        data->copyInfo(_uncompressed);
 
120
        return 1;
 
121
}
 
122
 
 
123
 
 
124
 
 
125
#endif