Since posting this I realised that two particular issues are involved , the ability to rationalise ranges and determine if range(a) is within or overlapping range(b) has been explored in that node. Thankyou all for your input.

However I was not particularly clear about the method of rendering down HMSF (Hour,Min,Sec,Frame) into a common integer that can then be applied to various range operations. Examining my half-baked HMSF->int(Frames) conversion and the irritation afforded me by 30,24,25 frames per second. I began wondering about a way of defining 'arbitary' relationships between an atomic and it's super-representations (you say 750 frames, I say 30 seconds at 25fps). This turned out to be simpler to achieve than I thought, so I ask the Monks - a simpler way?

#!/usr/bin/perl -w use strict; package counter; use Data::Dumper; our %ratio; sub new { my $self = shift; my %data = @_; my $atomic; foreach ( keys %data ) { my $val = $ratio{$_} * $data{$_}; $atomic += $val; } return bless \$atomic , $self; } sub config { my $self = shift; my %cfg = @_; $ratio{$cfg{atomic}}=1; my $key = $cfg{atomic}; while ($key) { my $r = $cfg{$key}->[0]; my $v = $cfg{$key}->[1]; last unless $r; $ratio{$r} = $v * $ratio{$key}; $key = $r; } print Dumper %ratio; } package main; use Data::Dumper; my %pal = ( days=>[], hours=>[ days=>24 ], minutes=>[ hours=>60 ], seconds=>[ minutes=>60 ], frames=>[ seconds=>25], atomic=>'frames', ); my %ntsc = %pal; $ntsc{frames}=[seconds=>30]; my %film = %pal; $film{frames}=[seconds=>24]; my %data = ( days=>0, hours=>0, minutes=>2, seconds=>0, frames=>5, ); counter->config( %pal ); print "In PAL frames " , ${counter->new( %data )}, $/; counter->config( %ntsc ); print "In NTSC frames " , ${counter->new( %data )}, $/; counter->config( %film ); print "In Film frames " , ${counter->new( %data )}, $/;

I can't believe it's not psellchecked edited by boo_radley -- changed title from "Could the considerer please suggest a title."

In reply to Optimizing time format conversions for variable speed video data. by submersible_toaster

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.